From 4457fe40fcb55ae8e3f6d5ae4f2aac83b5e507ef Mon Sep 17 00:00:00 2001 From: sudonim1 Date: Sun, 25 Apr 2010 00:31:27 +0000 Subject: [PATCH] Removed all trailing whitespace in *.c *.cpp *.h because it irritates me. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2897 96395faa-99c1-11dd-bbfe-3dabce05a288 --- 3rdparty/GL/glew.h | 30 +- 3rdparty/GL/glxew.h | 98 +- 3rdparty/GL/wglew.h | 40 +- 3rdparty/GL/wglext.h | 6 +- 3rdparty/SoundTouch/3dnow_win.cpp | 52 +- 3rdparty/SoundTouch/AAFilter.cpp | 24 +- 3rdparty/SoundTouch/AAFilter.h | 20 +- 3rdparty/SoundTouch/BPMDetect.h | 20 +- 3rdparty/SoundTouch/FIFOSampleBuffer.cpp | 44 +- 3rdparty/SoundTouch/FIFOSampleBuffer.h | 48 +- 3rdparty/SoundTouch/FIFOSamplePipe.h | 38 +- 3rdparty/SoundTouch/FIRFilter.cpp | 26 +- 3rdparty/SoundTouch/FIRFilter.h | 32 +- 3rdparty/SoundTouch/RateTransposer.cpp | 116 +- 3rdparty/SoundTouch/RateTransposer.h | 40 +- 3rdparty/SoundTouch/STTypes.h | 30 +- 3rdparty/SoundTouch/SoundTouch.cpp | 80 +- 3rdparty/SoundTouch/SoundTouch.h | 54 +- 3rdparty/SoundTouch/TDStretch.cpp | 150 +-- 3rdparty/SoundTouch/TDStretch.h | 42 +- 3rdparty/SoundTouch/WavFile.cpp | 48 +- 3rdparty/SoundTouch/WavFile.h | 32 +- 3rdparty/SoundTouch/cpu_detect.h | 4 +- 3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp | 4 +- 3rdparty/SoundTouch/cpu_detect_x86_win.cpp | 8 +- 3rdparty/SoundTouch/mmx_optimized.cpp | 22 +- 3rdparty/SoundTouch/sse_optimized.cpp | 58 +- 3rdparty/bzip2/blocksort.c | 132 +- 3rdparty/bzip2/bzlib.c | 224 ++-- 3rdparty/bzip2/bzlib.h | 164 +-- 3rdparty/bzip2/bzlib_private.h | 24 +- 3rdparty/bzip2/compress.c | 86 +- 3rdparty/bzip2/crctable.c | 2 +- 3rdparty/bzip2/decompress.c | 48 +- 3rdparty/bzip2/huffman.c | 10 +- 3rdparty/bzip2/randtable.c | 106 +- 3rdparty/glew/glew.c | 32 +- 3rdparty/libjpeg/jcapimin.c | 2 +- 3rdparty/libjpeg/jcarith.c | 2 +- 3rdparty/libjpeg/jchuff.c | 64 +- 3rdparty/libjpeg/jcmarker.c | 72 +- 3rdparty/libjpeg/jcmaster.c | 28 +- 3rdparty/libjpeg/jcparam.c | 8 +- 3rdparty/libjpeg/jdapimin.c | 8 +- 3rdparty/libjpeg/jdarith.c | 2 +- 3rdparty/libjpeg/jdct.h | 2 +- 3rdparty/libjpeg/jdhuff.c | 16 +- 3rdparty/libjpeg/jdinput.c | 22 +- 3rdparty/libjpeg/jdmarker.c | 62 +- 3rdparty/libjpeg/jdmaster.c | 2 +- 3rdparty/libjpeg/jdsample.c | 2 +- 3rdparty/libjpeg/jidctflt.c | 16 +- 3rdparty/libjpeg/jidctfst.c | 16 +- 3rdparty/libjpeg/jidctint.c | 86 +- 3rdparty/libjpeg/jmemmgr.c | 4 +- 3rdparty/libjpeg/jpeglib.h | 22 +- 3rdparty/libjpeg/jquant1.c | 2 +- 3rdparty/libjpeg/jquant2.c | 26 +- 3rdparty/portaudio/include/pa_asio.h | 20 +- 3rdparty/portaudio/include/pa_jack.h | 6 +- 3rdparty/portaudio/include/pa_linux_alsa.h | 6 +- 3rdparty/portaudio/include/pa_mac_core.h | 12 +- 3rdparty/portaudio/include/pa_win_ds.h | 10 +- 3rdparty/portaudio/include/pa_win_wasapi.h | 48 +- .../portaudio/include/pa_win_waveformat.h | 28 +- 3rdparty/portaudio/include/pa_win_wmme.h | 16 +- 3rdparty/portaudio/include/portaudio.h | 78 +- 3rdparty/portaudio/pablio/pablio.c | 6 +- 3rdparty/portaudio/pablio/pablio.h | 6 +- 3rdparty/portaudio/pablio/test_rw.c | 6 +- 3rdparty/portaudio/pablio/test_rw_echo.c | 6 +- 3rdparty/portaudio/pablio/test_w_saw.c | 6 +- 3rdparty/portaudio/pablio/test_w_saw8.c | 6 +- 3rdparty/portaudio/src/common/pa_allocation.c | 16 +- 3rdparty/portaudio/src/common/pa_allocation.h | 8 +- 3rdparty/portaudio/src/common/pa_converters.c | 98 +- 3rdparty/portaudio/src/common/pa_converters.h | 12 +- 3rdparty/portaudio/src/common/pa_cpuload.c | 6 +- 3rdparty/portaudio/src/common/pa_cpuload.h | 8 +- 3rdparty/portaudio/src/common/pa_debugprint.c | 2 +- 3rdparty/portaudio/src/common/pa_debugprint.h | 4 +- 3rdparty/portaudio/src/common/pa_dither.c | 82 +- 3rdparty/portaudio/src/common/pa_dither.h | 6 +- 3rdparty/portaudio/src/common/pa_endianness.h | 6 +- 3rdparty/portaudio/src/common/pa_front.c | 98 +- 3rdparty/portaudio/src/common/pa_hostapi.h | 44 +- .../portaudio/src/common/pa_memorybarrier.h | 6 +- 3rdparty/portaudio/src/common/pa_process.c | 138 +- 3rdparty/portaudio/src/common/pa_process.h | 50 +- 3rdparty/portaudio/src/common/pa_ringbuffer.c | 8 +- 3rdparty/portaudio/src/common/pa_ringbuffer.h | 14 +- 3rdparty/portaudio/src/common/pa_skeleton.c | 60 +- 3rdparty/portaudio/src/common/pa_stream.c | 6 +- 3rdparty/portaudio/src/common/pa_stream.h | 10 +- 3rdparty/portaudio/src/common/pa_trace.c | 6 +- 3rdparty/portaudio/src/common/pa_trace.h | 18 +- 3rdparty/portaudio/src/common/pa_types.h | 8 +- 3rdparty/portaudio/src/common/pa_util.h | 8 +- .../src/hostapi/alsa/pa_linux_alsa.c | 66 +- .../src/hostapi/asihpi/pa_linux_asihpi.c | 12 +- .../hostapi/asio/iasiothiscallresolver.cpp | 10 +- .../portaudio/src/hostapi/asio/pa_asio.cpp | 102 +- .../src/hostapi/coreaudio/pa_mac_core.c | 60 +- .../hostapi/coreaudio/pa_mac_core_blocking.c | 8 +- .../hostapi/coreaudio/pa_mac_core_blocking.h | 8 +- .../hostapi/coreaudio/pa_mac_core_internal.h | 8 +- .../src/hostapi/coreaudio/pa_mac_core_old.c | 154 +-- .../hostapi/coreaudio/pa_mac_core_utilities.c | 56 +- .../hostapi/coreaudio/pa_mac_core_utilities.h | 36 +- .../portaudio/src/hostapi/dsound/pa_win_ds.c | 188 +-- .../src/hostapi/dsound/pa_win_ds_dynlink.c | 10 +- .../src/hostapi/dsound/pa_win_ds_dynlink.h | 10 +- 3rdparty/portaudio/src/hostapi/oss/recplay.c | 2 +- .../src/hostapi/wasapi/pa_win_wasapi.c | 8 +- .../src/hostapi/wdmks/pa_win_wdmks.c | 32 +- .../portaudio/src/hostapi/wmme/pa_win_wmme.c | 314 ++--- .../portaudio/src/os/unix/pa_unix_hostapis.c | 8 +- 3rdparty/portaudio/src/os/unix/pa_unix_util.c | 26 +- 3rdparty/portaudio/src/os/unix/pa_unix_util.h | 6 +- .../portaudio/src/os/win/pa_win_hostapis.c | 6 +- 3rdparty/portaudio/src/os/win/pa_win_util.c | 12 +- .../portaudio/src/os/win/pa_win_waveformat.c | 32 +- .../portaudio/src/os/win/pa_win_wdmks_utils.c | 30 +- .../portaudio/src/os/win/pa_win_wdmks_utils.h | 8 +- .../src/os/win/pa_x86_plain_converters.c | 72 +- .../src/os/win/pa_x86_plain_converters.h | 6 +- 3rdparty/tinyxml/tinystr.h | 2 +- 3rdparty/tinyxml/tinyxml.cpp | 80 +- 3rdparty/tinyxml/tinyxml.h | 140 +- 3rdparty/tinyxml/tinyxmlerror.cpp | 8 +- 3rdparty/tinyxml/tinyxmlparser.cpp | 138 +- 3rdparty/w32pthreads/cleanup.c | 14 +- 3rdparty/w32pthreads/create.c | 14 +- 3rdparty/w32pthreads/dll.c | 12 +- 3rdparty/w32pthreads/errno.c | 10 +- 3rdparty/w32pthreads/exit.c | 10 +- 3rdparty/w32pthreads/global.c | 14 +- 3rdparty/w32pthreads/include/implement.h | 16 +- 3rdparty/w32pthreads/include/pthread.h | 18 +- 3rdparty/w32pthreads/include/sched.h | 12 +- 3rdparty/w32pthreads/include/semaphore.h | 10 +- 3rdparty/w32pthreads/pthread_attr_destroy.c | 10 +- .../w32pthreads/pthread_attr_getdetachstate.c | 10 +- .../pthread_attr_getinheritsched.c | 12 +- .../w32pthreads/pthread_attr_getschedparam.c | 12 +- .../w32pthreads/pthread_attr_getschedpolicy.c | 12 +- 3rdparty/w32pthreads/pthread_attr_getscope.c | 10 +- .../w32pthreads/pthread_attr_getstackaddr.c | 10 +- .../w32pthreads/pthread_attr_getstacksize.c | 10 +- 3rdparty/w32pthreads/pthread_attr_init.c | 10 +- .../w32pthreads/pthread_attr_setdetachstate.c | 10 +- .../pthread_attr_setinheritsched.c | 12 +- .../w32pthreads/pthread_attr_setschedparam.c | 12 +- .../w32pthreads/pthread_attr_setschedpolicy.c | 12 +- 3rdparty/w32pthreads/pthread_attr_setscope.c | 10 +- .../w32pthreads/pthread_attr_setstackaddr.c | 10 +- .../w32pthreads/pthread_attr_setstacksize.c | 10 +- .../w32pthreads/pthread_barrier_destroy.c | 10 +- 3rdparty/w32pthreads/pthread_barrier_init.c | 10 +- 3rdparty/w32pthreads/pthread_barrier_wait.c | 10 +- .../w32pthreads/pthread_barrierattr_destroy.c | 10 +- .../pthread_barrierattr_getpshared.c | 10 +- .../w32pthreads/pthread_barrierattr_init.c | 10 +- .../pthread_barrierattr_setpshared.c | 10 +- 3rdparty/w32pthreads/pthread_cancel.c | 16 +- 3rdparty/w32pthreads/pthread_cond_destroy.c | 12 +- 3rdparty/w32pthreads/pthread_cond_init.c | 10 +- 3rdparty/w32pthreads/pthread_cond_signal.c | 10 +- 3rdparty/w32pthreads/pthread_cond_wait.c | 74 +- .../w32pthreads/pthread_condattr_destroy.c | 10 +- .../w32pthreads/pthread_condattr_getpshared.c | 10 +- 3rdparty/w32pthreads/pthread_condattr_init.c | 10 +- .../w32pthreads/pthread_condattr_setpshared.c | 10 +- 3rdparty/w32pthreads/pthread_delay_np.c | 28 +- 3rdparty/w32pthreads/pthread_detach.c | 10 +- 3rdparty/w32pthreads/pthread_equal.c | 10 +- 3rdparty/w32pthreads/pthread_exit.c | 10 +- 3rdparty/w32pthreads/pthread_getconcurrency.c | 10 +- 3rdparty/w32pthreads/pthread_getschedparam.c | 12 +- 3rdparty/w32pthreads/pthread_getspecific.c | 14 +- .../pthread_getw32threadhandle_np.c | 10 +- 3rdparty/w32pthreads/pthread_join.c | 12 +- 3rdparty/w32pthreads/pthread_key_create.c | 10 +- 3rdparty/w32pthreads/pthread_key_delete.c | 10 +- 3rdparty/w32pthreads/pthread_kill.c | 10 +- 3rdparty/w32pthreads/pthread_mutex_destroy.c | 10 +- 3rdparty/w32pthreads/pthread_mutex_init.c | 10 +- 3rdparty/w32pthreads/pthread_mutex_lock.c | 10 +- .../w32pthreads/pthread_mutex_timedlock.c | 14 +- 3rdparty/w32pthreads/pthread_mutex_trylock.c | 10 +- 3rdparty/w32pthreads/pthread_mutex_unlock.c | 10 +- .../w32pthreads/pthread_mutexattr_destroy.c | 10 +- .../pthread_mutexattr_getkind_np.c | 10 +- .../pthread_mutexattr_getpshared.c | 10 +- .../w32pthreads/pthread_mutexattr_gettype.c | 10 +- 3rdparty/w32pthreads/pthread_mutexattr_init.c | 10 +- .../pthread_mutexattr_setkind_np.c | 10 +- .../pthread_mutexattr_setpshared.c | 10 +- .../w32pthreads/pthread_mutexattr_settype.c | 16 +- .../w32pthreads/pthread_num_processors_np.c | 10 +- 3rdparty/w32pthreads/pthread_once.c | 12 +- 3rdparty/w32pthreads/pthread_rwlock_destroy.c | 10 +- 3rdparty/w32pthreads/pthread_rwlock_init.c | 10 +- 3rdparty/w32pthreads/pthread_rwlock_rdlock.c | 10 +- .../w32pthreads/pthread_rwlock_timedrdlock.c | 10 +- .../w32pthreads/pthread_rwlock_timedwrlock.c | 10 +- .../w32pthreads/pthread_rwlock_tryrdlock.c | 10 +- .../w32pthreads/pthread_rwlock_trywrlock.c | 10 +- 3rdparty/w32pthreads/pthread_rwlock_unlock.c | 10 +- 3rdparty/w32pthreads/pthread_rwlock_wrlock.c | 10 +- .../w32pthreads/pthread_rwlockattr_destroy.c | 10 +- .../pthread_rwlockattr_getpshared.c | 10 +- .../w32pthreads/pthread_rwlockattr_init.c | 10 +- .../pthread_rwlockattr_setpshared.c | 10 +- 3rdparty/w32pthreads/pthread_self.c | 10 +- 3rdparty/w32pthreads/pthread_setcancelstate.c | 10 +- 3rdparty/w32pthreads/pthread_setcanceltype.c | 10 +- 3rdparty/w32pthreads/pthread_setconcurrency.c | 10 +- 3rdparty/w32pthreads/pthread_setschedparam.c | 12 +- 3rdparty/w32pthreads/pthread_setspecific.c | 10 +- 3rdparty/w32pthreads/pthread_spin_destroy.c | 10 +- 3rdparty/w32pthreads/pthread_spin_init.c | 10 +- 3rdparty/w32pthreads/pthread_spin_lock.c | 10 +- 3rdparty/w32pthreads/pthread_spin_trylock.c | 10 +- 3rdparty/w32pthreads/pthread_spin_unlock.c | 10 +- 3rdparty/w32pthreads/pthread_testcancel.c | 10 +- .../pthread_timechange_handler_np.c | 10 +- .../pthread_win32_attach_detach_np.c | 14 +- 3rdparty/w32pthreads/ptw32_MCS_lock.c | 40 +- .../ptw32_callUserDestroyRoutines.c | 10 +- 3rdparty/w32pthreads/ptw32_calloc.c | 10 +- 3rdparty/w32pthreads/ptw32_cancel.c | 12 +- .../w32pthreads/ptw32_cond_check_need_init.c | 10 +- 3rdparty/w32pthreads/ptw32_getprocessors.c | 10 +- 3rdparty/w32pthreads/ptw32_is_attr.c | 10 +- .../w32pthreads/ptw32_mutex_check_need_init.c | 12 +- 3rdparty/w32pthreads/ptw32_new.c | 12 +- .../w32pthreads/ptw32_processInitialize.c | 16 +- 3rdparty/w32pthreads/ptw32_processTerminate.c | 12 +- 3rdparty/w32pthreads/ptw32_relmillisecs.c | 14 +- 3rdparty/w32pthreads/ptw32_reuse.c | 14 +- .../w32pthreads/ptw32_rwlock_cancelwrwait.c | 10 +- .../ptw32_rwlock_check_need_init.c | 10 +- 3rdparty/w32pthreads/ptw32_semwait.c | 10 +- .../ptw32_spinlock_check_need_init.c | 10 +- 3rdparty/w32pthreads/ptw32_threadDestroy.c | 10 +- 3rdparty/w32pthreads/ptw32_threadStart.c | 10 +- 3rdparty/w32pthreads/ptw32_throw.c | 10 +- 3rdparty/w32pthreads/ptw32_timespec.c | 10 +- 3rdparty/w32pthreads/ptw32_tkAssocCreate.c | 14 +- 3rdparty/w32pthreads/ptw32_tkAssocDestroy.c | 10 +- 3rdparty/w32pthreads/resource.h | 2 +- 3rdparty/w32pthreads/sched_get_priority_max.c | 18 +- 3rdparty/w32pthreads/sched_get_priority_min.c | 18 +- 3rdparty/w32pthreads/sched_getscheduler.c | 12 +- 3rdparty/w32pthreads/sched_setscheduler.c | 12 +- 3rdparty/w32pthreads/sched_yield.c | 12 +- 3rdparty/w32pthreads/sem_close.c | 10 +- 3rdparty/w32pthreads/sem_destroy.c | 10 +- 3rdparty/w32pthreads/sem_getvalue.c | 10 +- 3rdparty/w32pthreads/sem_init.c | 10 +- 3rdparty/w32pthreads/sem_open.c | 10 +- 3rdparty/w32pthreads/sem_post.c | 10 +- 3rdparty/w32pthreads/sem_post_multiple.c | 10 +- 3rdparty/w32pthreads/sem_timedwait.c | 14 +- 3rdparty/w32pthreads/sem_trywait.c | 10 +- 3rdparty/w32pthreads/sem_unlink.c | 10 +- 3rdparty/w32pthreads/sem_wait.c | 10 +- 3rdparty/w32pthreads/signal.c | 10 +- 3rdparty/w32pthreads/w32_CancelableWait.c | 12 +- 3rdparty/wxWidgets/include/msvc/wx/setup.h | 4 +- 3rdparty/wxWidgets/include/wx/animdecod.h | 4 +- 3rdparty/wxWidgets/include/wx/app.h | 2 +- 3rdparty/wxWidgets/include/wx/aui/floatpane.h | 8 +- 3rdparty/wxWidgets/include/wx/aui/tabmdi.h | 6 +- 3rdparty/wxWidgets/include/wx/combo.h | 2 +- 3rdparty/wxWidgets/include/wx/dataview.h | 14 +- 3rdparty/wxWidgets/include/wx/dc.h | 2 +- 3rdparty/wxWidgets/include/wx/dcgraph.h | 8 +- 3rdparty/wxWidgets/include/wx/debug.h | 2 +- 3rdparty/wxWidgets/include/wx/dlimpexp.h | 2 +- .../wxWidgets/include/wx/generic/buttonbar.h | 6 +- .../wxWidgets/include/wx/generic/clrpickerg.h | 2 +- .../wxWidgets/include/wx/generic/dataview.h | 8 +- .../wxWidgets/include/wx/generic/dragimgg.h | 4 +- 3rdparty/wxWidgets/include/wx/generic/grid.h | 6 +- .../wxWidgets/include/wx/generic/listctrl.h | 4 +- 3rdparty/wxWidgets/include/wx/graphics.h | 4 +- 3rdparty/wxWidgets/include/wx/html/webkit.h | 22 +- 3rdparty/wxWidgets/include/wx/mimetype.h | 2 +- .../wxWidgets/include/wx/msw/HeapAllocator.h | 36 +- 3rdparty/wxWidgets/include/wx/msw/bitmap.h | 2 +- 3rdparty/wxWidgets/include/wx/msw/combobox.h | 2 +- 3rdparty/wxWidgets/include/wx/msw/dc.h | 2 +- 3rdparty/wxWidgets/include/wx/msw/dcmemory.h | 2 +- 3rdparty/wxWidgets/include/wx/msw/palette.h | 4 +- 3rdparty/wxWidgets/include/wx/msw/printdlg.h | 18 +- .../wxWidgets/include/wx/msw/setup_microwin.h | 2 +- 3rdparty/wxWidgets/include/wx/msw/tbar95.h | 2 +- 3rdparty/wxWidgets/include/wx/msw/toplevel.h | 4 +- 3rdparty/wxWidgets/include/wx/msw/window.h | 4 +- 3rdparty/wxWidgets/include/wx/msw/wrapwin.h | 6 +- 3rdparty/wxWidgets/include/wx/object.h | 4 +- 3rdparty/wxWidgets/include/wx/printdlg.h | 10 +- 3rdparty/wxWidgets/include/wx/protocol/ftp.h | 4 +- 3rdparty/wxWidgets/include/wx/rawbmp.h | 2 +- 3rdparty/wxWidgets/include/wx/scrolwin.h | 2 +- 3rdparty/wxWidgets/include/wx/toplevel.h | 2 +- 3rdparty/wxWidgets/include/wx/univ/choice.h | 6 +- 3rdparty/wxWidgets/include/wx/univ/textctrl.h | 2 +- 3rdparty/wxWidgets/include/wx/vms_x_fix.h | 10 +- 3rdparty/wxWidgets/include/wx/window.h | 8 +- 3rdparty/wxWidgets/include/wx/wx_cwcocoa_cm.h | 2 +- 3rdparty/wxWidgets/include/wx/wxprec.h | 2 +- 3rdparty/wxWidgets/include/wx/xml/xml.h | 2 +- 3rdparty/wxWidgets/include/wx/xrc/xh_spin.h | 2 +- 3rdparty/wxWidgets/include/wx/xrc/xmlres.h | 4 +- 3rdparty/wxWidgets/src/common/appcmn.cpp | 4 +- 3rdparty/wxWidgets/src/common/artstd.cpp | 2 +- 3rdparty/wxWidgets/src/common/combocmn.cpp | 2 +- 3rdparty/wxWidgets/src/common/containr.cpp | 2 +- 3rdparty/wxWidgets/src/common/datavcmn.cpp | 28 +- 3rdparty/wxWidgets/src/common/dcgraph.cpp | 18 +- 3rdparty/wxWidgets/src/common/encconv.cpp | 2 +- 3rdparty/wxWidgets/src/common/ffile.cpp | 2 +- 3rdparty/wxWidgets/src/common/fileback.cpp | 2 +- 3rdparty/wxWidgets/src/common/filesys.cpp | 6 +- 3rdparty/wxWidgets/src/common/fontenumcmn.cpp | 6 +- 3rdparty/wxWidgets/src/common/fs_inet.cpp | 2 +- 3rdparty/wxWidgets/src/common/gbsizer.cpp | 10 +- 3rdparty/wxWidgets/src/common/graphcmn.cpp | 72 +- 3rdparty/wxWidgets/src/common/imagjpeg.cpp | 2 +- 3rdparty/wxWidgets/src/common/log.cpp | 2 +- 3rdparty/wxWidgets/src/common/overlaycmn.cpp | 12 +- 3rdparty/wxWidgets/src/common/popupcmn.cpp | 4 +- 3rdparty/wxWidgets/src/common/powercmn.cpp | 2 +- 3rdparty/wxWidgets/src/common/prntbase.cpp | 80 +- 3rdparty/wxWidgets/src/common/sckipc.cpp | 2 +- 3rdparty/wxWidgets/src/common/sckstrm.cpp | 4 +- .../src/common/socketevtdispatch.cpp | 4 +- 3rdparty/wxWidgets/src/common/strconv.cpp | 6 +- 3rdparty/wxWidgets/src/common/string.cpp | 8 +- 3rdparty/wxWidgets/src/common/toplvcmn.cpp | 2 +- 3rdparty/wxWidgets/src/common/utilscmn.cpp | 2 +- 3rdparty/wxWidgets/src/common/zipstrm.cpp | 2 +- 3rdparty/wxWidgets/src/common/zstream.cpp | 8 +- 3rdparty/wxWidgets/src/generic/animateg.cpp | 10 +- 3rdparty/wxWidgets/src/generic/clrpickerg.cpp | 4 +- 3rdparty/wxWidgets/src/generic/combog.cpp | 2 +- 3rdparty/wxWidgets/src/generic/datectlg.cpp | 2 +- 3rdparty/wxWidgets/src/generic/graphicc.cpp | 130 +- 3rdparty/wxWidgets/src/generic/htmllbox.cpp | 2 +- 3rdparty/wxWidgets/src/generic/hyperlink.cpp | 8 +- 3rdparty/wxWidgets/src/generic/listctrl.cpp | 2 +- 3rdparty/wxWidgets/src/generic/paletteg.cpp | 4 +- 3rdparty/wxWidgets/src/generic/renderg.cpp | 22 +- 3rdparty/wxWidgets/src/generic/scrlwing.cpp | 6 +- 3rdparty/wxWidgets/src/msw/bitmap.cpp | 6 +- 3rdparty/wxWidgets/src/msw/choice.cpp | 2 +- 3rdparty/wxWidgets/src/msw/crashrpt.cpp | 2 +- 3rdparty/wxWidgets/src/msw/graphics.cpp | 14 +- 3rdparty/wxWidgets/src/msw/palette.cpp | 4 +- 3rdparty/wxWidgets/src/msw/printdlg.cpp | 10 +- 3rdparty/wxWidgets/src/msw/renderer.cpp | 24 +- 3rdparty/wxWidgets/src/msw/spinbutt.cpp | 2 +- 3rdparty/wxWidgets/src/msw/tooltip.cpp | 2 +- 3rdparty/wxWidgets/src/png/pngpread.c | 4 +- 3rdparty/wxWidgets/src/png/pngwutil.c | 2 +- common/include/PS2Edefs.h | 6 +- common/include/PS2Eext.h | 18 +- common/include/PS2Etypes.h | 8 +- common/include/Pcsx2Api.h | 10 +- common/include/Pcsx2Defs.h | 2 +- common/include/Pcsx2Types.h | 8 +- common/include/PluginCallbacks.h | 14 +- common/include/Utilities/Assertions.h | 2 +- common/include/Utilities/CheckedStaticBox.h | 2 +- common/include/Utilities/Console.h | 2 +- common/include/Utilities/EventSource.h | 6 +- common/include/Utilities/FixedPointTypes.h | 8 +- common/include/Utilities/General.h | 4 +- common/include/Utilities/MemcpyFast.h | 2 +- common/include/Utilities/Path.h | 6 +- common/include/Utilities/PersistentThread.h | 10 +- common/include/Utilities/RedtapeWindows.h | 4 +- common/include/Utilities/SafeArray.h | 36 +- common/include/Utilities/ScopedPtr.h | 16 +- common/include/Utilities/StringHelpers.h | 2 +- common/include/Utilities/Threading.h | 2 +- common/include/Utilities/pxCheckBox.h | 8 +- common/include/Utilities/pxRadioPanel.h | 16 +- common/include/Utilities/pxStaticText.h | 4 +- common/include/Utilities/win_memzero.h | 2 +- common/include/Utilities/wxAppWithHelpers.h | 12 +- common/include/Utilities/wxBaseTools.h | 2 +- common/include/Utilities/wxGuiTools.h | 20 +- common/include/afxresmw.h | 2 +- common/include/api/Dev9Api.h | 8 +- common/include/api/FWApi.h | 8 +- common/include/api/Spu2Api.h | 8 +- common/include/api/USBApi.h | 8 +- common/include/x86emitter/implement/dwshift.h | 2 +- common/include/x86emitter/implement/group1.h | 2 +- common/include/x86emitter/implement/group2.h | 2 +- common/include/x86emitter/implement/group3.h | 4 +- common/include/x86emitter/implement/helpers.h | 4 +- common/include/x86emitter/implement/incdec.h | 2 +- common/include/x86emitter/implement/movs.h | 4 +- .../x86emitter/implement/simd_arithmetic.h | 10 +- .../x86emitter/implement/simd_comparisons.h | 14 +- .../x86emitter/implement/simd_helpers.h | 4 +- .../x86emitter/implement/simd_moremovs.h | 16 +- .../x86emitter/implement/simd_shufflepack.h | 10 +- .../implement/simd_templated_helpers.h | 2 +- common/include/x86emitter/implement/test.h | 2 +- common/include/x86emitter/implement/xchg.h | 2 +- common/include/x86emitter/instructions.h | 4 +- common/include/x86emitter/internal.h | 2 +- .../include/x86emitter/legacy_instructions.h | 542 ++++---- common/include/x86emitter/legacy_internal.h | 2 +- common/include/x86emitter/legacy_types.h | 64 +- common/include/x86emitter/macros.h | 234 ++-- common/include/x86emitter/sse_helpers.h | 2 +- common/include/x86emitter/tools.h | 12 +- common/include/x86emitter/x86emitter.h | 2 +- common/include/x86emitter/x86types.h | 4 +- common/src/Utilities/CheckedStaticBox.cpp | 2 +- common/src/Utilities/Console.cpp | 2 +- common/src/Utilities/Linux/LnxMisc.cpp | 2 +- common/src/Utilities/Linux/LnxThreads.cpp | 2 +- common/src/Utilities/Mutex.cpp | 2 +- common/src/Utilities/ThreadTools.cpp | 14 +- common/src/Utilities/ThreadingInternal.h | 4 +- common/src/Utilities/Windows/WinHostSys.cpp | 6 +- common/src/Utilities/Windows/WinMisc.cpp | 4 +- common/src/Utilities/Windows/WinThreads.cpp | 8 +- common/src/Utilities/pxCheckBox.cpp | 2 +- common/src/Utilities/pxRadioPanel.cpp | 8 +- common/src/Utilities/pxStaticText.cpp | 4 +- common/src/Utilities/wxAppWithHelpers.cpp | 2 +- common/src/Utilities/wxGuiTools.cpp | 12 +- common/src/Utilities/wxHelpers.cpp | 6 +- common/src/x86emitter/3dnow.cpp | 68 +- common/src/x86emitter/WinCpuDetect.cpp | 4 +- common/src/x86emitter/cpudetect.cpp | 10 +- common/src/x86emitter/fpu.cpp | 54 +- common/src/x86emitter/jmp.cpp | 6 +- common/src/x86emitter/legacy.cpp | 2 +- common/src/x86emitter/legacy_sse.cpp | 2 +- common/src/x86emitter/movs.cpp | 4 +- common/src/x86emitter/tools.cpp | 42 +- common/src/x86emitter/x86emitter.cpp | 2 +- common/vsprops/svnrev_unknown.h | 2 +- fps2bios/intro/romdir.c | 2 +- fps2bios/kernel/eeload/eedata.c | 190 +-- fps2bios/kernel/eeload/eeelf.c | 92 +- fps2bios/kernel/eeload/eeinit.c | 42 +- fps2bios/kernel/eeload/eeirq.c | 10 +- fps2bios/kernel/eeload/eekernel.c | 116 +- fps2bios/kernel/eeload/include/eekernel.h | 4 +- fps2bios/kernel/eeload/romdir.c | 2 +- fps2bios/kernel/iopload/dmacman/dmacman.c | 4 +- fps2bios/kernel/iopload/excepman/excepman.c | 10 +- fps2bios/kernel/iopload/heaplib/heaplib.c | 6 +- fps2bios/kernel/iopload/include/err.h | 6 +- fps2bios/kernel/iopload/include/iopelf.h | 6 +- fps2bios/kernel/iopload/include/kexcepman.h | 2 +- fps2bios/kernel/iopload/include/romdir.h | 8 +- fps2bios/kernel/iopload/intrman/intrman.c | 46 +- fps2bios/kernel/iopload/iopboot/iopboot.c | 36 +- fps2bios/kernel/iopload/iopelf.c | 92 +- fps2bios/kernel/iopload/loadcore/loadcore.c | 48 +- fps2bios/kernel/iopload/romdir.c | 24 +- fps2bios/kernel/iopload/sifcmd/sifcmd.c | 18 +- fps2bios/kernel/iopload/sio2man/sio2man.c | 4 +- fps2bios/kernel/iopload/ssbusc/ssbusc.c | 8 +- fps2bios/kernel/iopload/sysclib/sysclib.c | 6 +- fps2bios/kernel/iopload/sysmem/sysmem.c | 16 +- fps2bios/kernel/iopload/threadman/threadman.c | 4 +- fps2bios/kernel/iopload/timrman/timrman.c | 4 +- fps2bios/kernel/iopload/vblank/vblank.c | 14 +- fps2bios/kernel/romdir.c | 2 +- fps2bios/loader/loader.c | 2 +- fps2bios/loader/romdir.c | 2 +- fps2bios/ps2romgen.c | 2 +- fps2bios/romdir.c | 2 +- fps2bios/romver.c | 2 +- pcsx2/CDVD/CDVD.cpp | 24 +- pcsx2/CDVD/CDVD.h | 2 +- pcsx2/CDVD/CDVD_internal.h | 38 +- pcsx2/CDVD/CDVDaccess.cpp | 2 +- pcsx2/CDVD/CDVDaccess.h | 4 +- pcsx2/CDVD/CDVDisoReader.cpp | 20 +- pcsx2/CDVD/CDVDisoReader.h | 6 +- pcsx2/CDVD/CdRom.cpp | 116 +- pcsx2/CDVD/CdRom.h | 2 +- pcsx2/CDVD/IsoFS/IsoDirectory.h | 6 +- pcsx2/CDVD/IsoFS/IsoFS.cpp | 8 +- pcsx2/CDVD/IsoFS/IsoFSCDVD.cpp | 4 +- pcsx2/CDVD/IsoFS/IsoFile.cpp | 14 +- pcsx2/CDVD/IsoFS/IsoFileDescriptor.h | 4 +- pcsx2/CDVD/IsoFS/SectorSource.h | 2 +- pcsx2/CDVD/IsoFileFormats.cpp | 8 +- pcsx2/COP0.cpp | 78 +- pcsx2/COP0.h | 4 +- pcsx2/COP2.cpp | 50 +- pcsx2/Cache.cpp | 36 +- pcsx2/Cache.h | 4 +- pcsx2/Config.h | 4 +- pcsx2/Counters.cpp | 4 +- pcsx2/Counters.h | 2 +- pcsx2/DebugTools/Debug.h | 2 +- pcsx2/DebugTools/DisASM.h | 18 +- pcsx2/DebugTools/DisR3000A.cpp | 16 +- pcsx2/DebugTools/DisR5900.cpp | 100 +- pcsx2/DebugTools/DisR5900asm.cpp | 456 +++---- pcsx2/DebugTools/DisVU0Micro.cpp | 6 +- pcsx2/DebugTools/DisVU1Micro.cpp | 8 +- pcsx2/DebugTools/DisVUmicro.h | 2 +- pcsx2/DebugTools/DisVUops.h | 2 +- pcsx2/Dmac.h | 100 +- pcsx2/Dump.h | 4 +- pcsx2/Elfheader.cpp | 42 +- pcsx2/Elfheader.h | 14 +- pcsx2/FPU.cpp | 20 +- pcsx2/FiFo.cpp | 2 +- pcsx2/GS.cpp | 14 +- pcsx2/GS.h | 34 +- pcsx2/GSState.cpp | 4 +- pcsx2/Gif.cpp | 6 +- pcsx2/Gif.h | 32 +- pcsx2/Hardware.h | 2 +- pcsx2/HostGui.h | 4 +- pcsx2/Hw.cpp | 48 +- pcsx2/Hw.h | 2 +- pcsx2/HwRead.cpp | 30 +- pcsx2/HwWrite.cpp | 40 +- pcsx2/IPU/IPU.cpp | 100 +- pcsx2/IPU/IPU.h | 24 +- pcsx2/IPU/IPU_Fifo.h | 10 +- pcsx2/IPU/coroutine.cpp | 10 +- pcsx2/IPU/coroutine.h | 4 +- pcsx2/IPU/mpeg2lib/Mpeg.h | 6 +- pcsx2/IPU/yuv2rgb.h | 2 +- pcsx2/Interpreter.cpp | 258 ++-- pcsx2/IopBios.cpp | 56 +- pcsx2/IopBios.h | 2 +- pcsx2/IopCommon.h | 4 +- pcsx2/IopCounters.cpp | 36 +- pcsx2/IopCounters.h | 2 +- pcsx2/IopDma.cpp | 14 +- pcsx2/IopDma.h | 2 +- pcsx2/IopHw.cpp | 8 +- pcsx2/IopHw.h | 14 +- pcsx2/IopIrq.cpp | 2 +- pcsx2/IopMem.cpp | 36 +- pcsx2/IopMem.h | 2 +- pcsx2/IopSio2.cpp | 18 +- pcsx2/IopSio2.h | 2 +- pcsx2/Linux/LnxKeyCodes.cpp | 2 +- pcsx2/MTGS.cpp | 20 +- pcsx2/Mdec.cpp | 58 +- pcsx2/Mdec.h | 2 +- pcsx2/Memory.cpp | 8 +- pcsx2/Memory.h | 2 +- pcsx2/Patch.cpp | 4 +- pcsx2/PathDefs.h | 6 +- pcsx2/Pcsx2Config.cpp | 4 +- pcsx2/PluginManager.cpp | 10 +- pcsx2/Plugins.h | 12 +- pcsx2/R3000A.cpp | 14 +- pcsx2/R3000A.h | 10 +- pcsx2/R3000AInterpreter.cpp | 70 +- pcsx2/R3000AOpcodeTables.cpp | 18 +- pcsx2/R5900.cpp | 58 +- pcsx2/R5900.h | 12 +- pcsx2/R5900Exceptions.h | 14 +- pcsx2/R5900OpcodeImpl.cpp | 90 +- pcsx2/R5900OpcodeTables.cpp | 138 +- pcsx2/R5900OpcodeTables.h | 414 +++--- pcsx2/RDebug/deci2.cpp | 2 +- pcsx2/RDebug/deci2.h | 2 +- pcsx2/RDebug/deci2_dbgp.cpp | 14 +- pcsx2/RDebug/deci2_dbgp.h | 2 +- pcsx2/RDebug/deci2_dcmp.cpp | 6 +- pcsx2/RDebug/deci2_dcmp.h | 2 +- pcsx2/RDebug/deci2_drfp.cpp | 4 +- pcsx2/RDebug/deci2_drfp.h | 4 +- pcsx2/RDebug/deci2_iloadp.cpp | 4 +- pcsx2/RDebug/deci2_iloadp.h | 2 +- pcsx2/RDebug/deci2_netmp.cpp | 4 +- pcsx2/RDebug/deci2_netmp.h | 2 +- pcsx2/RDebug/deci2_ttyp.cpp | 2 +- pcsx2/RDebug/deci2_ttyp.h | 2 +- pcsx2/RecoverySystem.cpp | 32 +- pcsx2/SPR.cpp | 58 +- pcsx2/SPR.h | 2 +- pcsx2/SaveState.h | 10 +- pcsx2/ShiftJisToUnicode.cpp | 2 +- pcsx2/Sif.cpp | 4 +- pcsx2/Sif.h | 14 +- pcsx2/Sif0.cpp | 70 +- pcsx2/Sif1.cpp | 68 +- pcsx2/Sifcmd.h | 2 +- pcsx2/Sio.cpp | 2 +- pcsx2/Sio.h | 2 +- pcsx2/SourceLog.cpp | 62 +- pcsx2/Stats.cpp | 4 +- pcsx2/Stats.h | 2 +- pcsx2/StringUtils.h | 2 +- pcsx2/System.cpp | 8 +- pcsx2/System.h | 2 +- pcsx2/System/PageFaultSource.h | 2 +- pcsx2/System/SysCoreThread.cpp | 14 +- pcsx2/System/SysThreadBase.cpp | 6 +- pcsx2/System/SysThreads.h | 12 +- pcsx2/Utilities/AsciiFile.h | 4 +- pcsx2/Utilities/FileUtils.cpp | 2 +- pcsx2/VU.h | 6 +- pcsx2/VU0.cpp | 24 +- pcsx2/VU0micro.cpp | 678 +++++----- pcsx2/VU0microInterp.cpp | 32 +- pcsx2/VU1micro.cpp | 678 +++++----- pcsx2/VU1microInterp.cpp | 24 +- pcsx2/VUflags.cpp | 58 +- pcsx2/VUflags.h | 2 +- pcsx2/VUmicro.h | 18 +- pcsx2/VUmicroMem.cpp | 8 +- pcsx2/VUops.cpp | 1180 ++++++++--------- pcsx2/VUops.h | 18 +- pcsx2/Vif.cpp | 10 +- pcsx2/Vif.h | 6 +- pcsx2/Vif0_Dma.cpp | 6 +- pcsx2/Vif1_Dma.cpp | 12 +- pcsx2/Vif1_MFIFO.cpp | 2 +- pcsx2/Vif_Codes.cpp | 10 +- pcsx2/Vif_Dma.h | 10 +- pcsx2/Vif_Transfer.cpp | 6 +- pcsx2/Vif_Unpack.cpp | 4 +- pcsx2/Vif_Unpack.h | 2 +- pcsx2/cheatscpp.h | 2 +- pcsx2/gui/AdvancedDialog.cpp | 2 +- pcsx2/gui/AdvancedDialog.h | 2 +- pcsx2/gui/App.h | 20 +- pcsx2/gui/AppAssert.cpp | 12 +- pcsx2/gui/AppConfig.cpp | 22 +- pcsx2/gui/AppConfig.h | 14 +- pcsx2/gui/AppCoreThread.cpp | 8 +- pcsx2/gui/AppEventSources.cpp | 4 +- pcsx2/gui/AppForwardDefs.h | 4 +- pcsx2/gui/AppInit.cpp | 22 +- pcsx2/gui/AppMain.cpp | 38 +- pcsx2/gui/AppRes.cpp | 4 +- pcsx2/gui/AppSaveStates.h | 2 +- pcsx2/gui/ApplyState.h | 2 +- pcsx2/gui/ConsoleLogger.cpp | 20 +- pcsx2/gui/ConsoleLogger.h | 10 +- pcsx2/gui/CpuUsageProvider.cpp | 4 +- pcsx2/gui/CpuUsageProvider.h | 6 +- pcsx2/gui/CpuUsageProviderMSW.cpp | 22 +- pcsx2/gui/Dialogs/AboutBoxDialog.cpp | 2 +- pcsx2/gui/Dialogs/BaseConfigurationDialog.cpp | 2 +- pcsx2/gui/Dialogs/ConfigurationDialog.h | 8 +- pcsx2/gui/Dialogs/ConfirmationDialogs.cpp | 18 +- pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp | 6 +- pcsx2/gui/Dialogs/FirstTimeWizard.cpp | 2 +- pcsx2/gui/Dialogs/ImportSettingsDialog.cpp | 2 +- pcsx2/gui/Dialogs/LogOptionsDialog.cpp | 2 +- pcsx2/gui/Dialogs/LogOptionsDialog.h | 4 +- pcsx2/gui/Dialogs/ModalPopups.h | 14 +- pcsx2/gui/Dialogs/PickUserModeDialog.cpp | 2 +- pcsx2/gui/Dialogs/SysConfigDialog.cpp | 4 +- pcsx2/gui/FrameForGS.cpp | 24 +- pcsx2/gui/GlobalCommands.cpp | 10 +- pcsx2/gui/IniInterface.cpp | 8 +- pcsx2/gui/IniInterface.h | 8 +- pcsx2/gui/IsoDropTarget.cpp | 4 +- pcsx2/gui/MainFrame.cpp | 2 +- pcsx2/gui/MainFrame.h | 2 +- pcsx2/gui/MainMenuClicks.cpp | 20 +- pcsx2/gui/MemoryCardFile.cpp | 14 +- pcsx2/gui/Panels/AudioPanel.cpp | 4 +- .../gui/Panels/BaseApplicableConfigPanel.cpp | 4 +- pcsx2/gui/Panels/ConfigurationPanels.h | 22 +- pcsx2/gui/Panels/CpuPanel.cpp | 18 +- pcsx2/gui/Panels/DirPickerPanel.cpp | 8 +- pcsx2/gui/Panels/GSWindowPanel.cpp | 10 +- pcsx2/gui/Panels/GameFixesPanel.cpp | 16 +- pcsx2/gui/Panels/LogOptionsPanels.cpp | 18 +- pcsx2/gui/Panels/LogOptionsPanels.h | 4 +- pcsx2/gui/Panels/MemoryCardListPanel.cpp | 8 +- pcsx2/gui/Panels/MemoryCardListView.h | 6 +- pcsx2/gui/Panels/MemoryCardsPanel.cpp | 8 +- pcsx2/gui/Panels/MiscPanelStuff.cpp | 10 +- pcsx2/gui/Panels/PathsPanel.cpp | 6 +- pcsx2/gui/Panels/PluginSelectorPanel.cpp | 4 +- pcsx2/gui/Panels/SpeedhacksPanel.cpp | 20 +- pcsx2/gui/Panels/VideoPanel.cpp | 28 +- pcsx2/gui/Plugins.cpp | 18 +- pcsx2/gui/RecentIsoList.cpp | 10 +- pcsx2/gui/RecentIsoList.h | 6 +- pcsx2/gui/Resources/EmbeddedImage.h | 2 +- pcsx2/gui/Saveslots.cpp | 2 +- pcsx2/gui/i18n.cpp | 6 +- pcsx2/gui/i18n.h | 6 +- pcsx2/pcsx2hostfs.cpp | 2 +- pcsx2/ps2/BiosTools.h | 2 +- pcsx2/ps2/GIFpath.cpp | 22 +- pcsx2/ps2/Iop/IopHwRead.cpp | 14 +- pcsx2/sio_internal.h | 2 +- pcsx2/vtlb.cpp | 10 +- pcsx2/vtlb.h | 2 +- pcsx2/windows/DwmSetup.cpp | 8 +- pcsx2/windows/PatchBrowser.cpp | 26 +- pcsx2/windows/SamplProf.cpp | 14 +- pcsx2/windows/VCprojects/IopSif.cpp | 30 +- pcsx2/windows/Win32.h | 2 +- pcsx2/windows/WinCompressNTFS.cpp | 14 +- pcsx2/windows/WinConsolePipe.cpp | 24 +- pcsx2/windows/WinSysExec.cpp | 4 +- pcsx2/windows/cheats/browser.cpp | 102 +- pcsx2/windows/cheats/cheats.cpp | 26 +- pcsx2/windows/cheats/cheats.h | 4 +- pcsx2/windows/ini.cpp | 4 +- pcsx2/windows/resource.h | 2 +- pcsx2/x86/BaseblockEx.cpp | 2 +- pcsx2/x86/BaseblockEx.h | 8 +- pcsx2/x86/iCOP0.cpp | 14 +- pcsx2/x86/iCOP0.h | 4 +- pcsx2/x86/iCore.cpp | 164 +-- pcsx2/x86/iCore.h | 12 +- pcsx2/x86/iFPU.cpp | 288 ++-- pcsx2/x86/iFPU.h | 6 +- pcsx2/x86/iFPUd.cpp | 494 +++---- pcsx2/x86/iMMI.cpp | 174 +-- pcsx2/x86/iMMI.h | 6 +- pcsx2/x86/iPsxMem.cpp | 20 +- pcsx2/x86/iR3000A.h | 2 +- pcsx2/x86/iR3000Atables.cpp | 74 +- pcsx2/x86/iR5900.h | 2 +- pcsx2/x86/iR5900Arit.h | 6 +- pcsx2/x86/iR5900AritImm.h | 6 +- pcsx2/x86/iR5900Branch.h | 6 +- pcsx2/x86/iR5900Jump.h | 6 +- pcsx2/x86/iR5900LoadStore.h | 6 +- pcsx2/x86/iR5900Misc.cpp | 32 +- pcsx2/x86/iR5900Move.h | 6 +- pcsx2/x86/iR5900MultDiv.h | 6 +- pcsx2/x86/iR5900Shift.h | 2 +- pcsx2/x86/iVU1micro.cpp | 22 +- pcsx2/x86/ir5900tables.cpp | 2 +- pcsx2/x86/ix86-32/iCore-32.cpp | 4 +- pcsx2/x86/ix86-32/iR5900-32.cpp | 6 +- pcsx2/x86/ix86-32/iR5900Arit.cpp | 2 +- pcsx2/x86/ix86-32/iR5900AritImm.cpp | 30 +- pcsx2/x86/ix86-32/iR5900Branch.cpp | 70 +- pcsx2/x86/ix86-32/iR5900Jump.cpp | 20 +- pcsx2/x86/ix86-32/iR5900LoadStore.cpp | 32 +- pcsx2/x86/ix86-32/iR5900Move.cpp | 24 +- pcsx2/x86/ix86-32/iR5900MultDiv.cpp | 38 +- pcsx2/x86/ix86-32/iR5900Shift.cpp | 50 +- pcsx2/x86/ix86-32/iR5900Templates.cpp | 14 +- pcsx2/x86/ix86-32/recVTLB.cpp | 24 +- pcsx2/x86/microVU.cpp | 30 +- pcsx2/x86/microVU.h | 12 +- pcsx2/x86/microVU_Misc.h | 14 +- pcsx2/x86/newVif_BlockBuffer.h | 4 +- pcsx2/x86/newVif_Dynarec.cpp | 12 +- pcsx2/x86/newVif_HashBucket.h | 4 +- pcsx2/x86/newVif_Unpack.cpp | 10 +- pcsx2/x86/newVif_UnpackSSE.cpp | 8 +- pcsx2/x86/newVif_UnpackSSE.h | 4 +- pcsx2/x86/sVU_Debug.h | 2 +- pcsx2/x86/sVU_Lower.cpp | 88 +- pcsx2/x86/sVU_Micro.cpp | 52 +- pcsx2/x86/sVU_Micro.h | 4 +- pcsx2/x86/sVU_Upper.cpp | 182 +-- pcsx2/x86/sVU_zerorec.cpp | 16 +- pcsx2/x86/sVU_zerorec.h | 2 +- pcsx2hostfs/ee/cmdHandler.c | 16 +- pcsx2hostfs/ee/excepHandler.c | 36 +- pcsx2hostfs/ee/ps2link.c | 4 +- pcsx2hostfs/ee/r5900_regs.h | 6 +- pcsx2hostfs/include/byteorder.h | 2 +- pcsx2hostfs/iop/excepHandler.c | 14 +- pcsx2hostfs/iop/net_fio.c | 4 +- pcsx2hostfs/iop/net_fsys.c | 24 +- pcsx2hostfs/iop/ps2link.c | 2 +- plugins/CDVDiso/src/CDVDisop.cpp | 14 +- plugins/CDVDiso/src/Linux/Config.cpp | 32 +- plugins/CDVDiso/src/Linux/Config.h | 2 +- plugins/CDVDiso/src/Linux/Linux.cpp | 42 +- plugins/CDVDiso/src/libiso.cpp | 50 +- plugins/CDVDiso/src/mkiso/mkiso.cpp | 14 +- plugins/CDVDisoEFP/src/bzip2/blocksort.c | 144 +- plugins/CDVDisoEFP/src/bzip2/bzlib.c | 232 ++-- plugins/CDVDisoEFP/src/bzip2/bzlib.h | 172 +-- plugins/CDVDisoEFP/src/bzip2/bzlib_private.h | 32 +- plugins/CDVDisoEFP/src/bzip2/compress.c | 94 +- plugins/CDVDisoEFP/src/bzip2/crctable.c | 10 +- plugins/CDVDisoEFP/src/bzip2/decompress.c | 56 +- plugins/CDVDisoEFP/src/bzip2/huffman.c | 18 +- plugins/CDVDisoEFP/src/bzip2/randtable.c | 114 +- plugins/CDVDlinuz/Src/Linux/CD.c | 6 +- plugins/CDVDlinuz/Src/Linux/CDVDlinuz.c | 2 +- plugins/CDVDlinuz/Src/Linux/DVD.c | 24 +- plugins/CDVDlinuz/Src/Linux/conf.c | 2 +- plugins/CDVDlinuz/Src/Linux/device.c | 8 +- plugins/CDVDlinuz/Src/PS2Edefs.h | 4 +- plugins/CDVDlinuz/Src/Win32/CDVDlinuz.c | 8 +- plugins/CDVDlinuz/Src/buffer.c | 2 +- plugins/CDVDlinuz/Src/ini.c | 4 +- plugins/CDVDnull/CDVD.cpp | 6 +- plugins/CDVDnull/CDVD.h | 6 +- plugins/CDVDnull/Linux/Config.cpp | 2 +- plugins/CDVDolio/CDVDDialog.cpp | 20 +- plugins/CDVDolio/CDVDDialog.h | 16 +- plugins/CDVDolio/SettingsDlg.cpp | 2 +- plugins/CDVDolio/cdvd.cpp | 12 +- plugins/CDVDolio/cdvd.h | 8 +- plugins/CDVDolio/resource.h | 2 +- plugins/CDVDolio/stdafx.cpp | 20 +- plugins/CDVDolio/stdafx.h | 4 +- plugins/CDVDpeops/CDVDiso.c | 14 +- plugins/CDVDpeops/CDVDisodrv.c | 2 +- plugins/CDVDpeops/CDVDlib.h | 6 +- plugins/CDVDpeops/Cdr.c | 130 +- plugins/CDVDpeops/Cfg.c | 78 +- plugins/CDVDpeops/CheckDiskType.c | 4 +- plugins/CDVDpeops/Ioctrl.c | 42 +- plugins/CDVDpeops/PS2Edefs.h | 4 +- plugins/CDVDpeops/Scsi.c | 46 +- plugins/CDVDpeops/StdAfx.h | 2 +- plugins/CDVDpeops/cdda.c | 6 +- plugins/CDVDpeops/cdvdPeops.c | 4 +- plugins/CDVDpeops/defines.h | 14 +- plugins/CDVDpeops/externals.h | 6 +- plugins/CDVDpeops/generic.c | 18 +- plugins/CDVDpeops/libiso.c | 8 +- plugins/CDVDpeops/ppf.c | 30 +- plugins/CDVDpeops/read.c | 112 +- plugins/CDVDpeops/resource.h | 2 +- plugins/CDVDpeops/sub.c | 34 +- plugins/CDVDpeops/toc.c | 8 +- plugins/CDVDpeops/wnaspi32.h | 2 +- plugins/FWnull/Config.cpp | 12 +- plugins/FWnull/FW.cpp | 40 +- plugins/FWnull/FW.h | 4 +- plugins/FWnull/Windows/Config.cpp | 6 +- plugins/FWnull/Windows/Win32.cpp | 10 +- plugins/FWnull/Windows/resource.h | 2 +- plugins/GSdx/GS.cpp | 36 +- plugins/GSdx/GS.h | 36 +- plugins/GSdx/GSAlignedClass.cpp | 8 +- plugins/GSdx/GSAlignedClass.h | 10 +- plugins/GSdx/GSBlock.cpp | 8 +- plugins/GSdx/GSBlock.h | 196 +-- plugins/GSdx/GSCapture.cpp | 26 +- plugins/GSdx/GSCapture.h | 8 +- plugins/GSdx/GSCaptureDlg.cpp | 12 +- plugins/GSdx/GSCaptureDlg.h | 8 +- plugins/GSdx/GSClut.cpp | 14 +- plugins/GSdx/GSClut.h | 8 +- plugins/GSdx/GSCodeBuffer.cpp | 10 +- plugins/GSdx/GSCodeBuffer.h | 10 +- plugins/GSdx/GSCrc.cpp | 30 +- plugins/GSdx/GSCrc.h | 24 +- plugins/GSdx/GSDevice.cpp | 24 +- plugins/GSdx/GSDevice.h | 10 +- plugins/GSdx/GSDevice11.cpp | 46 +- plugins/GSdx/GSDevice11.h | 12 +- plugins/GSdx/GSDevice9.cpp | 34 +- plugins/GSdx/GSDevice9.h | 16 +- plugins/GSdx/GSDeviceDX.h | 18 +- plugins/GSdx/GSDeviceNull.cpp | 8 +- plugins/GSdx/GSDeviceNull.h | 8 +- plugins/GSdx/GSDialog.cpp | 20 +- plugins/GSdx/GSDialog.h | 10 +- plugins/GSdx/GSDirtyRect.cpp | 10 +- plugins/GSdx/GSDirtyRect.h | 10 +- plugins/GSdx/GSDrawScanline.cpp | 52 +- plugins/GSdx/GSDrawScanline.h | 14 +- plugins/GSdx/GSDrawScanlineCodeGenerator.cpp | 70 +- plugins/GSdx/GSDrawScanlineCodeGenerator.h | 10 +- plugins/GSdx/GSDrawingContext.h | 12 +- plugins/GSdx/GSDrawingEnvironment.h | 10 +- plugins/GSdx/GSDump.cpp | 10 +- plugins/GSdx/GSDump.h | 10 +- plugins/GSdx/GSFunctionMap.cpp | 8 +- plugins/GSdx/GSFunctionMap.h | 26 +- plugins/GSdx/GSLocalMemory.cpp | 46 +- plugins/GSdx/GSLocalMemory.h | 82 +- plugins/GSdx/GSPerfMon.cpp | 12 +- plugins/GSdx/GSPerfMon.h | 8 +- plugins/GSdx/GSRasterizer.cpp | 34 +- plugins/GSdx/GSRasterizer.h | 10 +- plugins/GSdx/GSRenderer.cpp | 62 +- plugins/GSdx/GSRenderer.h | 14 +- plugins/GSdx/GSRendererDX.cpp | 10 +- plugins/GSdx/GSRendererDX.h | 32 +- plugins/GSdx/GSRendererDX11.cpp | 32 +- plugins/GSdx/GSRendererDX11.h | 10 +- plugins/GSdx/GSRendererDX9.cpp | 40 +- plugins/GSdx/GSRendererDX9.h | 8 +- plugins/GSdx/GSRendererHW.cpp | 10 +- plugins/GSdx/GSRendererHW.h | 56 +- plugins/GSdx/GSRendererNull.cpp | 8 +- plugins/GSdx/GSRendererNull.h | 14 +- plugins/GSdx/GSRendererSW.cpp | 36 +- plugins/GSdx/GSRendererSW.h | 10 +- plugins/GSdx/GSScanlineEnvironment.h | 12 +- plugins/GSdx/GSSetting.cpp | 8 +- plugins/GSdx/GSSetting.h | 14 +- plugins/GSdx/GSSettingsDlg.cpp | 24 +- plugins/GSdx/GSSettingsDlg.h | 12 +- plugins/GSdx/GSSetupPrimCodeGenerator.cpp | 14 +- plugins/GSdx/GSSetupPrimCodeGenerator.h | 10 +- plugins/GSdx/GSState.cpp | 84 +- plugins/GSdx/GSState.h | 12 +- plugins/GSdx/GSTables.cpp | 48 +- plugins/GSdx/GSTables.h | 12 +- plugins/GSdx/GSTexture.cpp | 10 +- plugins/GSdx/GSTexture.h | 8 +- plugins/GSdx/GSTexture11.cpp | 10 +- plugins/GSdx/GSTexture11.h | 8 +- plugins/GSdx/GSTexture9.cpp | 14 +- plugins/GSdx/GSTexture9.h | 10 +- plugins/GSdx/GSTextureCache.cpp | 58 +- plugins/GSdx/GSTextureCache.h | 8 +- plugins/GSdx/GSTextureCache11.cpp | 14 +- plugins/GSdx/GSTextureCache11.h | 8 +- plugins/GSdx/GSTextureCache9.cpp | 14 +- plugins/GSdx/GSTextureCache9.h | 10 +- plugins/GSdx/GSTextureCacheSW.cpp | 8 +- plugins/GSdx/GSTextureCacheSW.h | 8 +- plugins/GSdx/GSTextureFX.cpp | 12 +- plugins/GSdx/GSTextureFX11.cpp | 22 +- plugins/GSdx/GSTextureFX9.cpp | 16 +- plugins/GSdx/GSTextureNull.cpp | 8 +- plugins/GSdx/GSTextureNull.h | 8 +- plugins/GSdx/GSThread.cpp | 8 +- plugins/GSdx/GSThread.h | 8 +- plugins/GSdx/GSUtil.cpp | 32 +- plugins/GSdx/GSUtil.h | 8 +- plugins/GSdx/GSVector.cpp | 8 +- plugins/GSdx/GSVector.h | 284 ++-- plugins/GSdx/GSVertex.h | 10 +- plugins/GSdx/GSVertexHW.h | 18 +- plugins/GSdx/GSVertexList.cpp | 10 +- plugins/GSdx/GSVertexList.h | 8 +- plugins/GSdx/GSVertexSW.cpp | 8 +- plugins/GSdx/GSVertexSW.h | 32 +- plugins/GSdx/GSVertexTrace.cpp | 48 +- plugins/GSdx/GSVertexTrace.h | 10 +- plugins/GSdx/GSWnd.cpp | 26 +- plugins/GSdx/GSWnd.h | 8 +- plugins/GSdx/GSdx.cpp | 10 +- plugins/GSdx/GSdx.h | 12 +- plugins/GSdx/baseclasses/amextra.h | 2 +- plugins/GSdx/baseclasses/amvideo.cpp | 22 +- plugins/GSdx/baseclasses/ddmm.h | 2 +- plugins/GSdx/baseclasses/msgthrd.h | 2 +- plugins/GSdx/baseclasses/mtype.cpp | 4 +- plugins/GSdx/baseclasses/outputq.cpp | 4 +- plugins/GSdx/baseclasses/outputq.h | 2 +- plugins/GSdx/baseclasses/renbase.cpp | 12 +- plugins/GSdx/baseclasses/schedule.cpp | 4 +- plugins/GSdx/baseclasses/source.cpp | 2 +- plugins/GSdx/baseclasses/source.h | 2 +- plugins/GSdx/baseclasses/strmctl.h | 2 +- plugins/GSdx/baseclasses/sysclock.cpp | 4 +- plugins/GSdx/baseclasses/transfrm.h | 2 +- plugins/GSdx/baseclasses/transip.cpp | 10 +- plugins/GSdx/baseclasses/wxdebug.cpp | 46 +- plugins/GSdx/baseclasses/wxdebug.h | 6 +- plugins/GSdx/baseclasses/wxlist.h | 4 +- plugins/GSdx/baseclasses/wxutil.cpp | 14 +- plugins/GSdx/resource.h | 2 +- plugins/GSdx/stdafx.cpp | 20 +- plugins/GSdx/stdafx.h | 8 +- plugins/GSdx/vtune/JITProfiling.h | 28 +- plugins/GSnull/GS.cpp | 28 +- plugins/GSnull/GS.h | 2 +- plugins/GSnull/GifTransfer.cpp | 2 +- plugins/GSnull/GifTransfer.h | 2 +- plugins/GSnull/Linux/Config.cpp | 26 +- plugins/GSnull/Linux/GSLinux.cpp | 20 +- plugins/GSnull/Linux/GSLinux.h | 2 +- plugins/GSnull/Linux/Linux.cpp | 6 +- plugins/GSnull/Registers.h | 24 +- plugins/GSnull/Windows/Config.cpp | 10 +- plugins/GSnull/Windows/GSwin.cpp | 8 +- plugins/GSnull/Windows/GSwin.h | 2 +- plugins/GSnull/Windows/Win32.cpp | 12 +- plugins/GSnull/Windows/resource.h | 2 +- plugins/GSnull/null/GSnull.cpp | 6 +- plugins/GSnull/null/GSnull.h | 4 +- plugins/LilyPad/Config.cpp | 10 +- plugins/LilyPad/DirectInput.cpp | 26 +- plugins/LilyPad/InputManager.h | 2 +- plugins/LilyPad/LilyPad.cpp | 4 +- plugins/LilyPad/RawInput.cpp | 4 +- plugins/LilyPad/WindowsMessaging.cpp | 2 +- plugins/LilyPad/WndProcEater.cpp | 4 +- plugins/LilyPad/WndProcEater.h | 2 +- plugins/PadNull/Linux/Config.cpp | 28 +- plugins/PadNull/Linux/PadLinux.cpp | 6 +- plugins/PadNull/Linux/PadLinux.h | 10 +- plugins/PadNull/Pad.cpp | 28 +- plugins/PadNull/Pad.h | 4 +- plugins/PadNull/Windows/Config.cpp | 6 +- plugins/PadNull/Windows/PadWin.cpp | 12 +- plugins/PadNull/Windows/PadWin.h | 10 +- plugins/PadNull/Windows/Win32.cpp | 12 +- plugins/PadNull/Windows/resource.h | 2 +- plugins/PeopsSPU2/adsr.c | 36 +- plugins/PeopsSPU2/alsa.c | 2 +- plugins/PeopsSPU2/cfg.c | 16 +- plugins/PeopsSPU2/debug.c | 44 +- plugins/PeopsSPU2/dma.c | 64 +- plugins/PeopsSPU2/dma.h | 2 +- plugins/PeopsSPU2/dsound.c | 38 +- plugins/PeopsSPU2/externals.h | 26 +- plugins/PeopsSPU2/freeze.c | 12 +- plugins/PeopsSPU2/gauss_i.h | 258 ++-- plugins/PeopsSPU2/oss.c | 2 +- plugins/PeopsSPU2/psemuxa.h | 2 +- plugins/PeopsSPU2/record.c | 8 +- plugins/PeopsSPU2/registers.c | 72 +- plugins/PeopsSPU2/registers.h | 176 +-- plugins/PeopsSPU2/resource.h | 2 +- plugins/PeopsSPU2/reverb.c | 18 +- plugins/PeopsSPU2/spu.c | 200 +-- plugins/PeopsSPU2/spu2PeopsSound.c | 4 +- plugins/PeopsSPU2/spunew.c | 196 +-- plugins/PeopsSPU2/stdafx.h | 2 +- plugins/PeopsSPU2/xa.c | 24 +- plugins/SPU2null/Linux/Config.cpp | 16 +- plugins/SPU2null/SPU2.cpp | 36 +- plugins/SPU2null/SPU2.h | 12 +- plugins/SPU2null/Windows/Config.cpp | 6 +- plugins/SPU2null/Windows/Win32.cpp | 10 +- plugins/SPU2null/Windows/resource.h | 2 +- plugins/SSSPSXPAD/PadSSSPSXres.h | 2 +- plugins/USBnull/Config.cpp | 4 +- plugins/USBnull/USB.cpp | 24 +- plugins/USBnull/Windows/Config.cpp | 6 +- plugins/USBnull/Windows/Win32.cpp | 10 +- plugins/USBnull/Windows/resource.h | 2 +- plugins/cdvdGigaherz/src/CDVD.cpp | 44 +- plugins/cdvdGigaherz/src/CDVD.h | 2 +- plugins/cdvdGigaherz/src/ReadThread.cpp | 18 +- plugins/cdvdGigaherz/src/TocStuff.cpp | 4 +- plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp | 2 +- plugins/cdvdGigaherz/src/Windows/PlainIso.cpp | 4 +- plugins/cdvdGigaherz/src/Windows/config.cpp | 16 +- plugins/cdvdGigaherz/src/Windows/resource.h | 2 +- plugins/dev9null/Config.cpp | 16 +- plugins/dev9null/DEV9.cpp | 74 +- plugins/onepad/Linux/gui.cpp | 50 +- plugins/onepad/Linux/ini.cpp | 22 +- plugins/onepad/Linux/linux.cpp | 76 +- plugins/onepad/Linux/linux.h | 2 +- plugins/onepad/analog.cpp | 40 +- plugins/onepad/analog.h | 6 +- plugins/onepad/bitwise.h | 10 +- plugins/onepad/controller.cpp | 8 +- plugins/onepad/controller.h | 2 +- plugins/onepad/joystick.cpp | 34 +- plugins/onepad/joystick.h | 36 +- plugins/onepad/onepad.cpp | 64 +- plugins/onepad/onepad.h | 2 +- .../spu2-x/src/3rdparty/liba52/bitstream.c | 2 +- plugins/spu2-x/src/3rdparty/liba52/imdct.c | 4 +- plugins/spu2-x/src/3rdparty/liba52/parse.c | 10 +- plugins/spu2-x/src/ADSR.cpp | 16 +- plugins/spu2-x/src/Config.h | 2 +- plugins/spu2-x/src/ConvertUTF.cpp | 26 +- plugins/spu2-x/src/ConvertUTF.h | 6 +- plugins/spu2-x/src/Debug.cpp | 4 +- plugins/spu2-x/src/Debug.h | 2 +- plugins/spu2-x/src/DecodeDPLII.cpp | 16 +- plugins/spu2-x/src/Decoder.cpp | 6 +- plugins/spu2-x/src/Dma.cpp | 18 +- plugins/spu2-x/src/Dma.h | 2 +- plugins/spu2-x/src/Global.h | 2 +- plugins/spu2-x/src/Linux/AboutBox.cpp | 6 +- plugins/spu2-x/src/Linux/Alsa.cpp | 2 +- plugins/spu2-x/src/Linux/Alsa.h | 10 +- plugins/spu2-x/src/Linux/CfgHelpers.cpp | 34 +- plugins/spu2-x/src/Linux/Config.cpp | 68 +- plugins/spu2-x/src/Linux/Config.h | 4 +- plugins/spu2-x/src/Linux/ConfigDebug.cpp | 78 +- plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp | 44 +- plugins/spu2-x/src/Linux/Dialogs.cpp | 8 +- plugins/spu2-x/src/Linux/Dialogs.h | 2 +- plugins/spu2-x/src/Lowpass.cpp | 14 +- plugins/spu2-x/src/Lowpass.h | 2 +- plugins/spu2-x/src/Mixer.cpp | 14 +- plugins/spu2-x/src/Mixer.h | 2 +- plugins/spu2-x/src/PS2E-spu2.cpp | 36 +- plugins/spu2-x/src/ReadInput.cpp | 8 +- plugins/spu2-x/src/RegLog.cpp | 10 +- plugins/spu2-x/src/RegTable.cpp | 6 +- plugins/spu2-x/src/Reverb.cpp | 18 +- plugins/spu2-x/src/SndOut.cpp | 14 +- plugins/spu2-x/src/SndOut.h | 2 +- plugins/spu2-x/src/SndOut_Portaudio.cpp | 40 +- plugins/spu2-x/src/Spu2replay.cpp | 2 +- plugins/spu2-x/src/Timestretcher.cpp | 8 +- plugins/spu2-x/src/Wavedump_wav.cpp | 6 +- plugins/spu2-x/src/Windows/AboutBox.cpp | 10 +- plugins/spu2-x/src/Windows/CfgHelpers.cpp | 6 +- plugins/spu2-x/src/Windows/Config.cpp | 42 +- plugins/spu2-x/src/Windows/ConfigDebug.cpp | 8 +- .../spu2-x/src/Windows/ConfigSoundtouch.cpp | 14 +- plugins/spu2-x/src/Windows/Dialogs.h | 2 +- plugins/spu2-x/src/Windows/Dsound51.cpp | 58 +- .../spu2-x/src/Windows/RealtimeDebugger.cpp | 10 +- plugins/spu2-x/src/Windows/SndOut_DSound.cpp | 80 +- plugins/spu2-x/src/Windows/SndOut_XAudio2.cpp | 24 +- plugins/spu2-x/src/Windows/SndOut_waveOut.cpp | 22 +- plugins/spu2-x/src/Windows/UIHelpers.cpp | 10 +- plugins/spu2-x/src/Windows/dsp.h | 2 +- plugins/spu2-x/src/Windows/resource.h | 2 +- plugins/spu2-x/src/defs.h | 44 +- plugins/spu2-x/src/regs.h | 12 +- plugins/spu2-x/src/spu2freeze.cpp | 4 +- plugins/spu2-x/src/spu2sys.cpp | 48 +- plugins/xpad/resource.h | 2 +- plugins/xpad/stdafx.h | 4 +- plugins/xpad/xpad.cpp | 66 +- plugins/xpad/xpad.h | 12 +- plugins/zerogs/dx/GS.h | 18 +- plugins/zerogs/dx/GSmain.cpp | 84 +- plugins/zerogs/dx/Mem.cpp | 44 +- plugins/zerogs/dx/Regs.cpp | 86 +- plugins/zerogs/dx/Regs.h | 2 +- plugins/zerogs/dx/Windows/Conf.cpp | 4 +- plugins/zerogs/dx/Windows/Win32.cpp | 6 +- plugins/zerogs/dx/Windows/aviUtil.h | 66 +- plugins/zerogs/dx/Windows/resource.h | 2 +- plugins/zerogs/dx/Windows/resrc1.h | 2 +- .../zerogs/dx/ZeroGSShaders/zerogsshaders.cpp | 66 +- plugins/zerogs/dx/common.h | 42 +- plugins/zerogs/dx/memcpy_amd.cpp | 10 +- plugins/zerogs/dx/targets.cpp | 132 +- plugins/zerogs/dx/targets.h | 10 +- plugins/zerogs/dx/x86.cpp | 14 +- plugins/zerogs/dx/x86.h | 6 +- plugins/zerogs/dx/zerogs.cpp | 276 ++-- plugins/zerogs/dx/zerogs.h | 16 +- plugins/zerogs/opengl/GLWinX11.cpp | 74 +- plugins/zerogs/opengl/GS.h | 18 +- plugins/zerogs/opengl/GSmain.cpp | 64 +- plugins/zerogs/opengl/GifTransfer.cpp | 54 +- plugins/zerogs/opengl/GifTransfer.h | 8 +- plugins/zerogs/opengl/Linux/Conf.cpp | 14 +- plugins/zerogs/opengl/Linux/Linux.cpp | 56 +- plugins/zerogs/opengl/Linux/Linux.h | 2 +- plugins/zerogs/opengl/Mem.cpp | 44 +- plugins/zerogs/opengl/Regs.cpp | 86 +- plugins/zerogs/opengl/Win32/Conf.cpp | 2 +- plugins/zerogs/opengl/Win32/Win32.cpp | 6 +- plugins/zerogs/opengl/Win32/aviUtil.h | 66 +- plugins/zerogs/opengl/Win32/jpeglib.h | 28 +- plugins/zerogs/opengl/Win32/resource.h | 2 +- plugins/zerogs/opengl/Win32/resrc1.h | 2 +- .../opengl/Win32/vsprops/svnrev_unknown.h | 4 +- .../opengl/ZeroGSShaders/zerogsshaders.cpp | 16 +- plugins/zerogs/opengl/ZeroGSShaders/zpipe.cpp | 8 +- plugins/zerogs/opengl/common.h | 42 +- plugins/zerogs/opengl/common/PS2Edefs.h | 8 +- plugins/zerogs/opengl/common/PS2Etypes.h | 4 +- plugins/zerogs/opengl/glprocs.c | 10 +- plugins/zerogs/opengl/glprocs.h | 22 +- plugins/zerogs/opengl/memcpy_amd.cpp | 10 +- plugins/zerogs/opengl/rasterfont.cpp | 196 +-- plugins/zerogs/opengl/rasterfont.h | 6 +- plugins/zerogs/opengl/targets.cpp | 204 +-- plugins/zerogs/opengl/targets.h | 32 +- plugins/zerogs/opengl/x86.cpp | 14 +- plugins/zerogs/opengl/x86.h | 6 +- plugins/zerogs/opengl/zerogs.cpp | 372 +++--- plugins/zerogs/opengl/zerogs.h | 100 +- plugins/zerogs/opengl/zerogsmath.h | 22 +- plugins/zerogs/opengl/zpipe.cpp | 8 +- plugins/zeropad/Linux/gui.cpp | 28 +- plugins/zeropad/Linux/linux.cpp | 84 +- plugins/zeropad/Linux/linux.h | 2 +- plugins/zeropad/Windows/gui.cpp | 6 +- plugins/zeropad/Windows/win.cpp | 14 +- plugins/zeropad/Windows/win.h | 2 +- plugins/zeropad/analog.cpp | 40 +- plugins/zeropad/analog.h | 6 +- plugins/zeropad/bitwise.h | 10 +- plugins/zeropad/joystick.cpp | 30 +- plugins/zeropad/joystick.h | 34 +- plugins/zeropad/keyboard.cpp | 36 +- plugins/zeropad/keyboard.h | 12 +- plugins/zeropad/zeropad.cpp | 38 +- plugins/zeropad/zeropad.h | 2 +- plugins/zerospu2/Linux/Linux.cpp | 60 +- plugins/zerospu2/Linux/Linux.h | 8 +- plugins/zerospu2/Targets/Alsa.cpp | 68 +- plugins/zerospu2/Targets/Alsa.h | 2 +- plugins/zerospu2/Targets/OSS.cpp | 34 +- plugins/zerospu2/Targets/OSS.h | 2 +- plugins/zerospu2/Targets/PortAudio.cpp | 18 +- plugins/zerospu2/Targets/PortAudio.h | 2 +- plugins/zerospu2/Targets/SoundTargets.cpp | 2 +- plugins/zerospu2/Targets/SoundTargets.h | 2 +- plugins/zerospu2/Targets/dsound51.cpp | 74 +- plugins/zerospu2/Targets/dsound51.h | 4 +- plugins/zerospu2/Windows/Win32.cpp | 48 +- plugins/zerospu2/Windows/resource.h | 2 +- plugins/zerospu2/reg.h | 38 +- plugins/zerospu2/zerodma.cpp | 30 +- plugins/zerospu2/zerospu2.cpp | 284 ++-- plugins/zerospu2/zerospu2.h | 28 +- plugins/zerospu2/zeroworker.cpp | 78 +- plugins/zzogl-pg/opengl/GLWin32.cpp | 26 +- plugins/zzogl-pg/opengl/GLWinX11.cpp | 84 +- plugins/zzogl-pg/opengl/GS.h | 138 +- plugins/zzogl-pg/opengl/GSmain.cpp | 114 +- plugins/zzogl-pg/opengl/GifTransfer.cpp | 128 +- plugins/zzogl-pg/opengl/GifTransfer.h | 32 +- plugins/zzogl-pg/opengl/Linux/Conf.cpp | 14 +- plugins/zzogl-pg/opengl/Linux/Linux.cpp | 126 +- plugins/zzogl-pg/opengl/Mem.cpp | 286 ++-- plugins/zzogl-pg/opengl/Mem.h | 138 +- plugins/zzogl-pg/opengl/Mem_Swizzle.cpp | 192 +-- plugins/zzogl-pg/opengl/Mem_Tables.cpp | 14 +- plugins/zzogl-pg/opengl/Mem_Transmit.h | 294 ++-- plugins/zzogl-pg/opengl/Regs.cpp | 106 +- plugins/zzogl-pg/opengl/Util.h | 10 +- plugins/zzogl-pg/opengl/Win32/Conf.cpp | 2 +- plugins/zzogl-pg/opengl/Win32/Win32.cpp | 6 +- plugins/zzogl-pg/opengl/Win32/aviUtil.h | 66 +- plugins/zzogl-pg/opengl/Win32/resource.h | 2 +- plugins/zzogl-pg/opengl/Win32/resrc1.h | 2 +- .../opengl/Win32/tsvnrev/svnrev_template.h | 4 +- .../opengl/Win32/tsvnrev/svnrev_unknown.h | 4 +- plugins/zzogl-pg/opengl/Win32/wglext.h | 6 +- plugins/zzogl-pg/opengl/ZZoglCRTC.cpp | 108 +- plugins/zzogl-pg/opengl/ZZoglCreate.cpp | 34 +- plugins/zzogl-pg/opengl/ZZoglFlush.cpp | 360 ++--- plugins/zzogl-pg/opengl/ZZoglSave.cpp | 12 +- plugins/zzogl-pg/opengl/ZZoglShaders.cpp | 46 +- plugins/zzogl-pg/opengl/ZZoglShoots.cpp | 76 +- plugins/zzogl-pg/opengl/ZZoglVB.cpp | 90 +- .../opengl/ZeroGSShaders/zerogsshaders.cpp | 16 +- .../zzogl-pg/opengl/ZeroGSShaders/zpipe.cpp | 8 +- plugins/zzogl-pg/opengl/common.h | 42 +- plugins/zzogl-pg/opengl/glprocs.c | 10 +- plugins/zzogl-pg/opengl/glprocs.h | 22 +- plugins/zzogl-pg/opengl/memcpy_amd.cpp | 10 +- plugins/zzogl-pg/opengl/rasterfont.cpp | 196 +-- plugins/zzogl-pg/opengl/rasterfont.h | 6 +- plugins/zzogl-pg/opengl/targets.cpp | 646 ++++----- plugins/zzogl-pg/opengl/targets.h | 44 +- plugins/zzogl-pg/opengl/x86.cpp | 36 +- plugins/zzogl-pg/opengl/x86.h | 6 +- plugins/zzogl-pg/opengl/zerogs.cpp | 134 +- plugins/zzogl-pg/opengl/zerogs.h | 148 +-- plugins/zzogl-pg/opengl/zerogsmath.h | 22 +- plugins/zzogl-pg/opengl/zpipe.cpp | 8 +- 1267 files changed, 17269 insertions(+), 17269 deletions(-) diff --git a/3rdparty/GL/glew.h b/3rdparty/GL/glew.h index 2014092e87..13723b4e45 100644 --- a/3rdparty/GL/glew.h +++ b/3rdparty/GL/glew.h @@ -4,24 +4,24 @@ ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without +** +** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: -** -** * Redistributions of source code must retain the above copyright notice, +** +** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. -** * The name of the author may be used to endorse or promote products +** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) @@ -55,7 +55,7 @@ /* ** Copyright (c) 2007 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -63,10 +63,10 @@ ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. diff --git a/3rdparty/GL/glxew.h b/3rdparty/GL/glxew.h index a29030da3c..625ee0fb3c 100644 --- a/3rdparty/GL/glxew.h +++ b/3rdparty/GL/glxew.h @@ -4,24 +4,24 @@ ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without +** +** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: -** -** * Redistributions of source code must retain the above copyright notice, +** +** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. -** * The name of the author may be used to endorse or promote products +** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) @@ -55,7 +55,7 @@ /* ** Copyright (c) 2007 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -63,10 +63,10 @@ ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -138,7 +138,7 @@ typedef struct __glXContextRec *GLXContext; typedef struct __GLXcontextRec *GLXContext; #endif -typedef unsigned int GLXVideoDeviceNV; +typedef unsigned int GLXVideoDeviceNV; extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase); extern Bool glXQueryVersion (Display *dpy, int *major, int *minor); @@ -260,21 +260,21 @@ typedef XID GLXPbuffer; typedef struct __GLXFBConfigRec *GLXFBConfig; typedef struct { - int event_type; - int draw_type; - unsigned long serial; - Bool send_event; - Display *display; - GLXDrawable drawable; - unsigned int buffer_mask; - unsigned int aux_buffer; - int x, y; - int width, height; - int count; + int event_type; + int draw_type; + unsigned long serial; + Bool send_event; + Display *display; + GLXDrawable drawable; + unsigned int buffer_mask; + unsigned int aux_buffer; + int x, y; + int width, height; + int count; } GLXPbufferClobberEvent; typedef union __GLXEvent { - GLXPbufferClobberEvent glxpbufferclobber; - long pad[24]; + GLXPbufferClobberEvent glxpbufferclobber; + long pad[24]; } GLXEvent; typedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); @@ -928,32 +928,32 @@ typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLX #define GLX_HYPERPIPE_ID_SGIX 0x8030 typedef struct { - char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; - int networkId; + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int networkId; } GLXHyperpipeNetworkSGIX; typedef struct { - char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; - int XOrigin; - int YOrigin; - int maxHeight; - int maxWidth; + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int XOrigin; + int YOrigin; + int maxHeight; + int maxWidth; } GLXPipeRectLimits; typedef struct { - char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; - int channel; - unsigned int participationType; - int timeSlice; + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int channel; + unsigned int participationType; + int timeSlice; } GLXHyperpipeConfigSGIX; typedef struct { - char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; - int srcXOrigin; - int srcYOrigin; - int srcWidth; - int srcHeight; - int destXOrigin; - int destYOrigin; - int destWidth; - int destHeight; + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int srcXOrigin; + int srcYOrigin; + int srcWidth; + int srcHeight; + int destXOrigin; + int destYOrigin; + int destWidth; + int destHeight; } GLXPipeRect; typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); diff --git a/3rdparty/GL/wglew.h b/3rdparty/GL/wglew.h index 2eaad3651a..7f80276130 100644 --- a/3rdparty/GL/wglew.h +++ b/3rdparty/GL/wglew.h @@ -4,24 +4,24 @@ ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without +** +** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: -** -** * Redistributions of source code must retain the above copyright notice, +** +** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. -** * The name of the author may be used to endorse or promote products +** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) @@ -31,7 +31,7 @@ /* ** Copyright (c) 2007 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -39,10 +39,10 @@ ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -781,11 +781,11 @@ typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWO DECLARE_HANDLE(HGPUNV); typedef struct _GPU_DEVICE { - DWORD cb; - CHAR DeviceName[32]; - CHAR DeviceString[128]; - DWORD Flags; - RECT rcVirtualScreen; + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD Flags; + RECT rcVirtualScreen; } GPU_DEVICE, *PGPU_DEVICE; typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); diff --git a/3rdparty/GL/wglext.h b/3rdparty/GL/wglext.h index 89cbdbd0fc..fc777cb0ee 100644 --- a/3rdparty/GL/wglext.h +++ b/3rdparty/GL/wglext.h @@ -7,7 +7,7 @@ extern "C" { /* ** Copyright (c) 2007-2010 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -15,10 +15,10 @@ extern "C" { ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. diff --git a/3rdparty/SoundTouch/3dnow_win.cpp b/3rdparty/SoundTouch/3dnow_win.cpp index 35b372947a..aaa1b3811c 100644 --- a/3rdparty/SoundTouch/3dnow_win.cpp +++ b/3rdparty/SoundTouch/3dnow_win.cpp @@ -1,32 +1,32 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// Win32 version of the AMD 3DNow! optimized routines for AMD K6-2/Athlon +/// 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 +/// 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 +/// 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 +/// 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++ +/// +/// 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 +/// 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/en-us/vstudio/aa718349.aspx /// -/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and +/// 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 @@ -73,7 +73,7 @@ using namespace soundtouch; #ifdef ALLOW_3DNOW -// 3DNow! routines available only with float sample type +// 3DNow! routines available only with float sample type ////////////////////////////////////////////////////////////////////////////// // @@ -111,10 +111,10 @@ double TDStretch3DNow::calcCrossCorrStereo(const float *pV1, const float *pV2) c } */ - _asm + _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 + // give more aggressive hints on pV1 as that changes more between different calls // while pV2 stays the same. prefetch [pV1] prefetch [pV2] @@ -153,7 +153,7 @@ double TDStretch3DNow::calcCrossCorrStereo(const float *pV1, const float *pV2) c dec ecx jnz loop1 - // add halfs of mm0 together and return the result. + // 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 @@ -206,7 +206,7 @@ void FIRFilter3DNow::setCoefficients(const float *coeffs, uint newLength, uint u fDivider = (float)resultDivider; - // rearrange the filter coefficients for mmx routines + // rearrange the filter coefficients for mmx routines for (i = 0; i < newLength; i ++) { filterCoeffsAlign[2 * i + 0] = @@ -239,26 +239,26 @@ uint FIRFilter3DNow::evaluateFilterStereo(float *dest, const float *src, uint nu suml2 = sumr2 = 0.0; ptr = src; filterCoeffsLocal = filterCoeffs; - for (i = 0; i < lengthLocal; i ++) + for (i = 0; i < lengthLocal; i ++) { // unroll loop for efficiency. - suml1 += ptr[0] * filterCoeffsLocal[0] + + suml1 += ptr[0] * filterCoeffsLocal[0] + ptr[2] * filterCoeffsLocal[2] + ptr[4] * filterCoeffsLocal[4] + ptr[6] * filterCoeffsLocal[6]; - sumr1 += ptr[1] * filterCoeffsLocal[1] + + sumr1 += ptr[1] * filterCoeffsLocal[1] + ptr[3] * filterCoeffsLocal[3] + ptr[5] * filterCoeffsLocal[5] + ptr[7] * filterCoeffsLocal[7]; - suml2 += ptr[8] * filterCoeffsLocal[0] + + suml2 += ptr[8] * filterCoeffsLocal[0] + ptr[10] * filterCoeffsLocal[2] + ptr[12] * filterCoeffsLocal[4] + ptr[14] * filterCoeffsLocal[6]; - sumr2 += ptr[9] * filterCoeffsLocal[1] + + sumr2 += ptr[9] * filterCoeffsLocal[1] + ptr[11] * filterCoeffsLocal[3] + ptr[13] * filterCoeffsLocal[5] + ptr[15] * filterCoeffsLocal[7]; diff --git a/3rdparty/SoundTouch/AAFilter.cpp b/3rdparty/SoundTouch/AAFilter.cpp index f099bced93..c73b2c60b8 100644 --- a/3rdparty/SoundTouch/AAFilter.cpp +++ b/3rdparty/SoundTouch/AAFilter.cpp @@ -1,9 +1,9 @@ //////////////////////////////////////////////////////////////////////////////// /// /// 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 +/// 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 @@ -112,21 +112,21 @@ void AAFilter::calculateCoeffs() work = new double[length]; coeffs = new SAMPLETYPE[length]; - fc2 = 2.0 * cutoffFreq; + fc2 = 2.0 * cutoffFreq; wc = PI * fc2; tempCoeff = TWOPI / (double)length; sum = 0; - for (i = 0; i < length; i ++) + for (i = 0; i < length; i ++) { cntTemp = (double)i - (double)(length / 2); temp = cntTemp * wc; - if (temp != 0) + if (temp != 0) { h = fc2 * sin(temp) / temp; // sinc function - } - else + } + else { h = 1.0; } @@ -135,7 +135,7 @@ void AAFilter::calculateCoeffs() temp = w * h; work[i] = temp; - // calc net sum of coefficients + // calc net sum of coefficients sum += temp; } @@ -151,7 +151,7 @@ void AAFilter::calculateCoeffs() // divided by 16384 scaleCoeff = 16384.0f / sum; - for (i = 0; i < length; i ++) + for (i = 0; i < length; i ++) { // scale & round to nearest integer temp = work[i] * scaleCoeff; @@ -169,8 +169,8 @@ void AAFilter::calculateCoeffs() } -// Applies the filter to the given sequence of samples. -// Note : The amount of outputted samples is by value of 'filter length' +// 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 { diff --git a/3rdparty/SoundTouch/AAFilter.h b/3rdparty/SoundTouch/AAFilter.h index d0997570d3..d92a3eac59 100644 --- a/3rdparty/SoundTouch/AAFilter.h +++ b/3rdparty/SoundTouch/AAFilter.h @@ -1,10 +1,10 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo -/// while maintaining the original pitch by using a time domain WSOLA-like method +/// 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 +/// Anti-alias filter is used to prevent folding of high frequencies when /// transposing the sample rate with interpolation. /// /// Author : Copyright (c) Olli Parviainen @@ -67,8 +67,8 @@ public: ~AAFilter(); - /// Sets new anti-alias filter cut-off edge frequency, scaled to sampling - /// frequency (nyquist frequency = 0.5). The filter will cut off the + /// 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); @@ -77,12 +77,12 @@ public: uint getLength() const; - /// Applies the filter to the given sequence of samples. - /// Note : The amount of outputted samples is by value of 'filter length' + /// 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 evaluate(SAMPLETYPE *dest, + const SAMPLETYPE *src, + uint numSamples, uint numChannels) const; }; diff --git a/3rdparty/SoundTouch/BPMDetect.h b/3rdparty/SoundTouch/BPMDetect.h index 6240bb770c..75289c6b9b 100644 --- a/3rdparty/SoundTouch/BPMDetect.h +++ b/3rdparty/SoundTouch/BPMDetect.h @@ -14,10 +14,10 @@ /// 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 +/// - 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 +/// - 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 @@ -76,7 +76,7 @@ class BPMDetect protected: /// Auto-correlation accumulator bins. float *xcorr; - + /// Amplitude envelope sliding average approximation level accumulator float envelopeAccu; @@ -104,12 +104,12 @@ protected: /// 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; - /// 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 + /// 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. ); @@ -139,9 +139,9 @@ public: /// 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. - /// + /// 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(const soundtouch::SAMPLETYPE *samples, ///< Pointer to input/working data buffer int numSamples ///< Number of samples in buffer diff --git a/3rdparty/SoundTouch/FIFOSampleBuffer.cpp b/3rdparty/SoundTouch/FIFOSampleBuffer.cpp index 98956ad488..a395315ac7 100644 --- a/3rdparty/SoundTouch/FIFOSampleBuffer.cpp +++ b/3rdparty/SoundTouch/FIFOSampleBuffer.cpp @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// A buffer class for temporarily storaging sound samples, operates as a +/// 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' +/// 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 +/// 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 @@ -63,7 +63,7 @@ FIFOSampleBuffer::FIFOSampleBuffer(int numChannels) samplesInBuffer = 0; bufferPos = 0; channels = (uint)numChannels; - ensureCapacity(32); // allocate initial capacity + ensureCapacity(32); // allocate initial capacity } @@ -89,11 +89,11 @@ void FIFOSampleBuffer::setChannels(int numChannels) // if output location pointer 'bufferPos' isn't zero, 'rewinds' the buffer and -// zeroes this pointer by copying samples from the 'bufferPos' pointer +// zeroes this pointer by copying samples from the 'bufferPos' pointer // location on to the beginning of the buffer. void FIFOSampleBuffer::rewind() { - if (buffer && bufferPos) + if (buffer && bufferPos) { memmove(buffer, ptrBegin(), sizeof(SAMPLETYPE) * channels * samplesInBuffer); bufferPos = 0; @@ -101,7 +101,7 @@ void FIFOSampleBuffer::rewind() } -// Adds 'numSamples' pcs of samples from the 'samples' memory position to +// Adds 'numSamples' pcs of samples from the 'samples' memory position to // the sample buffer. void FIFOSampleBuffer::putSamples(const SAMPLETYPE *samples, uint nSamples) { @@ -114,7 +114,7 @@ void FIFOSampleBuffer::putSamples(const SAMPLETYPE *samples, uint nSamples) // 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 +// when accessing the buffer directly with 'ptrEnd' function. Please be // careful though! void FIFOSampleBuffer::putSamples(uint nSamples) { @@ -126,31 +126,31 @@ void FIFOSampleBuffer::putSamples(uint nSamples) } -// 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! +// 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, +// 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 +// 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) +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. +// 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 +// outputted samples from the buffer by calling the // 'receiveSamples(numSamples)' function SAMPLETYPE *FIFOSampleBuffer::ptrBegin() { @@ -167,7 +167,7 @@ void FIFOSampleBuffer::ensureCapacity(uint capacityRequirement) { SAMPLETYPE *tempUnaligned, *temp; - if (capacityRequirement > getCapacity()) + if (capacityRequirement > getCapacity()) { // enlarge the buffer in 4kbyte steps (round up to next 4k boundary) sizeInBytes = (capacityRequirement * channels * sizeof(SAMPLETYPE) + 4095) & (uint)-4096; @@ -187,8 +187,8 @@ void FIFOSampleBuffer::ensureCapacity(uint capacityRequirement) buffer = temp; bufferUnaligned = tempUnaligned; bufferPos = 0; - } - else + } + else { // simply rewind the buffer (if necessary) rewind(); diff --git a/3rdparty/SoundTouch/FIFOSampleBuffer.h b/3rdparty/SoundTouch/FIFOSampleBuffer.h index 7565f7a408..ed31c8db63 100644 --- a/3rdparty/SoundTouch/FIFOSampleBuffer.h +++ b/3rdparty/SoundTouch/FIFOSampleBuffer.h @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// A buffer class for temporarily storaging sound samples, operates as a +/// 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' +/// 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 +/// 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 @@ -54,7 +54,7 @@ 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 +/// Notice that in case of stereo audio, one sample is considered to consist of /// both channel data. class FIFOSampleBuffer : public FIFOSamplePipe { @@ -75,12 +75,12 @@ private: /// Channels, 1=mono, 2=stereo. uint channels; - /// Current position pointer to the buffer. This pointer is increased when samples are + /// 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 + /// Rewind the buffer by moving data from position pointed by 'bufferPos' to real /// beginning of the buffer. void rewind(); @@ -89,7 +89,7 @@ private: /// Returns current capacity. uint getCapacity() const; - + public: /// Constructor @@ -100,27 +100,27 @@ public: /// destructor ~FIFOSampleBuffer(); - /// Returns a pointer to the beginning of the output samples. - /// This function is provided for accessing the output samples directly. + /// 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 + /// output samples from the buffer by calling the /// 'receiveSamples(numSamples)' function virtual SAMPLETYPE *ptrBegin(); - /// 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 + /// 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 + /// 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 + 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. ); @@ -130,17 +130,17 @@ public: uint numSamples ///< Number of samples to insert. ); - /// Adjusts the book-keeping to increase number of samples in the buffer without + /// 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 + /// 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 + /// 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. @@ -148,8 +148,8 @@ public: 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. + /// 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. diff --git a/3rdparty/SoundTouch/FIFOSamplePipe.h b/3rdparty/SoundTouch/FIFOSamplePipe.h index 155a1bfa18..31dc40f93d 100644 --- a/3rdparty/SoundTouch/FIFOSamplePipe.h +++ b/3rdparty/SoundTouch/FIFOSamplePipe.h @@ -5,7 +5,7 @@ /// 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 +/// '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 @@ -63,12 +63,12 @@ public: virtual ~FIFOSamplePipe() {} - /// Returns a pointer to the beginning of the output samples. - /// This function is provided for accessing the output samples directly. + /// 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 + /// output samples from the buffer by calling the /// 'receiveSamples(numSamples)' function virtual SAMPLETYPE *ptrBegin() = 0; @@ -89,8 +89,8 @@ public: 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 + /// 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. @@ -98,8 +98,8 @@ public: 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. + /// 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. @@ -118,12 +118,12 @@ public: -/// Base-class for sound processing routines working in FIFO principle. With this base +/// 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 +/// 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 +/// 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 @@ -141,7 +141,7 @@ protected: } - /// Constructor. Doesn't define output pipe; it has to be set be + /// Constructor. Doesn't define output pipe; it has to be set be /// 'setOutPipe' function. FIFOProcessor() { @@ -163,12 +163,12 @@ protected: } - /// Returns a pointer to the beginning of the output samples. - /// This function is provided for accessing the output samples directly. + /// 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 + /// output samples from the buffer by calling the /// 'receiveSamples(numSamples)' function virtual SAMPLETYPE *ptrBegin() { @@ -177,8 +177,8 @@ protected: 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 + /// 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. @@ -190,8 +190,8 @@ public: } - /// Adjusts book-keeping so that given number of samples are removed from beginning of the - /// sample buffer without copying them anywhere. + /// 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. diff --git a/3rdparty/SoundTouch/FIRFilter.cpp b/3rdparty/SoundTouch/FIRFilter.cpp index 331c87a60d..9f7351dce8 100644 --- a/3rdparty/SoundTouch/FIRFilter.cpp +++ b/3rdparty/SoundTouch/FIRFilter.cpp @@ -1,8 +1,8 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// General FIR digital filter routines with MMX optimization. +/// General FIR digital filter routines with MMX optimization. /// -/// Note : MMX optimized functions reside in a separate, platform-specific file, +/// 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 @@ -88,14 +88,14 @@ uint FIRFilter::evaluateFilterStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, ui end = 2 * (numSamples - length); - for (j = 0; j < end; j += 2) + for (j = 0; j < end; j += 2) { const SAMPLETYPE *ptr; suml = sumr = 0; ptr = src + j; - for (i = 0; i < length; i += 4) + 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] + @@ -143,15 +143,15 @@ uint FIRFilter::evaluateFilterMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint assert(length != 0); end = numSamples - length; - for (j = 0; j < end; j ++) + for (j = 0; j < end; j ++) { sum = 0; - for (i = 0; i < length; i += 4) + 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] + + 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 @@ -196,9 +196,9 @@ uint FIRFilter::getLength() const -// Applies the filter to the given sequence of samples. +// Applies the filter to the given sequence of samples. // -// Note : The amount of outputted samples is by value of 'filter_length' +// Note : The amount of outputted samples is by value of 'filter_length' // smaller than the amount of input samples. uint FIRFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples, uint numChannels) const { @@ -207,7 +207,7 @@ uint FIRFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSample assert(length > 0); assert(lengthDiv8 * 8 == length); if (numSamples < length) return 0; - if (numChannels == 2) + if (numChannels == 2) { return evaluateFilterStereo(dest, src, numSamples); } else { @@ -217,7 +217,7 @@ uint FIRFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSample -// Operator 'new' is overloaded so that it automatically creates a suitable instance +// 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) { diff --git a/3rdparty/SoundTouch/FIRFilter.h b/3rdparty/SoundTouch/FIRFilter.h index 34273c591b..2899c9bfd7 100644 --- a/3rdparty/SoundTouch/FIRFilter.h +++ b/3rdparty/SoundTouch/FIRFilter.h @@ -1,8 +1,8 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// General FIR digital filter routines with MMX optimization. +/// General FIR digital filter routines with MMX optimization. /// -/// Note : MMX optimized functions reside in a separate, platform-specific file, +/// 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 @@ -48,11 +48,11 @@ namespace soundtouch { -class FIRFilter +class FIRFilter { protected: // Number of FIR filter taps - uint length; + uint length; // Number of FIR filter taps divided by 8 uint lengthDiv8; @@ -65,37 +65,37 @@ protected: // Memory for filter coefficients SAMPLETYPE *filterCoeffs; - virtual uint evaluateFilterStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, + virtual uint evaluateFilterStereo(SAMPLETYPE *dest, + const SAMPLETYPE *src, uint numSamples) const; - virtual uint evaluateFilterMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, + 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 + /// Operator 'new' is overloaded so that it automatically creates a suitable instance /// depending on if we've a MMX-capable CPU available or not. static 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' + /// 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 evaluate(SAMPLETYPE *dest, + const SAMPLETYPE *src, + uint numSamples, uint numChannels) const; uint getLength() const; - virtual void setCoefficients(const SAMPLETYPE *coeffs, - uint newLength, + virtual void setCoefficients(const SAMPLETYPE *coeffs, + uint newLength, uint uResultDivFactor); }; diff --git a/3rdparty/SoundTouch/RateTransposer.cpp b/3rdparty/SoundTouch/RateTransposer.cpp index b9a8dda360..7d992f8ce2 100644 --- a/3rdparty/SoundTouch/RateTransposer.cpp +++ b/3rdparty/SoundTouch/RateTransposer.cpp @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// -/// -/// Sample rate transposer. Changes sample rate by using linear interpolation +/// +/// 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) /// @@ -61,18 +61,18 @@ protected: virtual void resetRegisters(); - virtual uint transposeStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, + virtual uint transposeStereo(SAMPLETYPE *dest, + const SAMPLETYPE *src, uint numSamples); - virtual uint transposeMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, + 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 + /// Sets new target rate. Normal rate = 1.0, smaller values represent slower /// rate, larger faster rates. virtual void setRate(float newRate); @@ -89,11 +89,11 @@ protected: virtual void resetRegisters(); - virtual uint transposeStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, + virtual uint transposeStereo(SAMPLETYPE *dest, + const SAMPLETYPE *src, uint numSamples); - virtual uint transposeMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, + virtual uint transposeMono(SAMPLETYPE *dest, + const SAMPLETYPE *src, uint numSamples); public: @@ -104,7 +104,7 @@ public: -// Operator 'new' is overloaded so that it automatically creates a suitable instance +// 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) { @@ -165,7 +165,7 @@ AAFilter *RateTransposer::getAAFilter() -// Sets new target iRate. Normal iRate = 1.0, smaller values represent slower +// Sets new target iRate. Normal iRate = 1.0, smaller values represent slower // iRate, larger faster iRates. void RateTransposer::setRate(float newRate) { @@ -174,11 +174,11 @@ void RateTransposer::setRate(float newRate) fRate = newRate; // design a new anti-alias filter - if (newRate > 1.0f) + if (newRate > 1.0f) { fCutoff = 0.5f / newRate; - } - else + } + else { fCutoff = 0.5f * newRate; } @@ -220,7 +220,7 @@ void RateTransposer::upsample(const SAMPLETYPE *src, uint nSamples) // 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' + // First check that there's enough room in 'storeBuffer' // (+16 is to reserve some slack in the destination buffer) sizeTemp = (uint)((float)nSamples / fRate + 16.0f); @@ -231,7 +231,7 @@ void RateTransposer::upsample(const SAMPLETYPE *src, uint nSamples) // Apply the anti-alias filter to samples in "store output", output the // result to "dest" num = storeBuffer.numSamples(); - count = pAAFilter->evaluate(outputBuffer.ptrEnd(num), + count = pAAFilter->evaluate(outputBuffer.ptrEnd(num), storeBuffer.ptrBegin(), num, (uint)numChannels); outputBuffer.putSamples(count); @@ -253,13 +253,13 @@ void RateTransposer::downsample(const SAMPLETYPE *src, uint nSamples) // Add the new samples to the end of the storeBuffer storeBuffer.putSamples(src, nSamples); - // Anti-alias filter the samples to prevent folding and output the filtered + // 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), + count = pAAFilter->evaluate(tempBuffer.ptrEnd(sizeTemp), storeBuffer.ptrBegin(), sizeTemp, (uint)numChannels); if (count == 0) return; @@ -274,7 +274,7 @@ void RateTransposer::downsample(const SAMPLETYPE *src, uint nSamples) } -// Transposes sample rate by applying anti-alias filter to prevent folding. +// 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. @@ -288,7 +288,7 @@ void RateTransposer::processSamples(const SAMPLETYPE *src, uint nSamples) // If anti-alias filter is turned off, simply transpose without applying // the filter - if (bUseAAFilter == FALSE) + if (bUseAAFilter == FALSE) { sizeReq = (uint)((float)nSamples / fRate + 1.0f); count = transpose(outputBuffer.ptrEnd(sizeReq), src, nSamples); @@ -297,26 +297,26 @@ void RateTransposer::processSamples(const SAMPLETYPE *src, uint nSamples) } // Transpose with anti-alias filter - if (fRate < 1.0f) + if (fRate < 1.0f) { upsample(src, nSamples); - } - else + } + else { downsample(src, nSamples); } } -// Transposes the sample rate of the given samples using linear interpolation. +// 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 nSamples) { - if (numChannels == 2) + if (numChannels == 2) { return transposeStereo(dest, src, nSamples); - } - else + } + else { return transposeMono(dest, src, nSamples); } @@ -363,7 +363,7 @@ int RateTransposer::isEmpty() const ////////////////////////////////////////////////////////////////////////////// // // RateTransposerInteger - integer arithmetic implementation -// +// /// fixed-point interpolation routine precision #define SCALE 65536 @@ -371,7 +371,7 @@ int RateTransposer::isEmpty() const // Constructor RateTransposerInteger::RateTransposerInteger() : RateTransposer() { - // Notice: use local function calling syntax for sake of clarity, + // Notice: use local function calling syntax for sake of clarity, // to indicate the fact that C++ constructor can't call virtual functions. RateTransposerInteger::resetRegisters(); RateTransposerInteger::setRate(1.0f); @@ -386,14 +386,14 @@ RateTransposerInteger::~RateTransposerInteger() void RateTransposerInteger::resetRegisters() { iSlopeCount = 0; - sPrevSampleL = + 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 +// 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 nSamples) { @@ -402,11 +402,11 @@ uint RateTransposerInteger::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *sr if (nSamples == 0) return 0; // no samples, no work - used = 0; + used = 0; i = 0; // Process the last sample saved from the previous call first... - while (iSlopeCount <= SCALE) + while (iSlopeCount <= SCALE) { vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); temp = vol1 * sPrevSampleL + iSlopeCount * src[0]; @@ -419,7 +419,7 @@ uint RateTransposerInteger::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *sr while (1) { - while (iSlopeCount > SCALE) + while (iSlopeCount > SCALE) { iSlopeCount -= SCALE; used ++; @@ -440,8 +440,8 @@ end: } -// Transposes the sample rate of the given samples using linear interpolation. -// 'Stereo' version of the routine. Returns the number of samples returned in +// 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 nSamples) { @@ -450,11 +450,11 @@ uint RateTransposerInteger::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE * if (nSamples == 0) return 0; // no samples, no work - used = 0; + used = 0; i = 0; // Process the last sample saved from the sPrevSampleLious call first... - while (iSlopeCount <= SCALE) + while (iSlopeCount <= SCALE) { vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); temp = vol1 * sPrevSampleL + iSlopeCount * src[0]; @@ -469,7 +469,7 @@ uint RateTransposerInteger::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE * while (1) { - while (iSlopeCount > SCALE) + while (iSlopeCount > SCALE) { iSlopeCount -= SCALE; used ++; @@ -494,7 +494,7 @@ end: } -// Sets new target iRate. Normal iRate = 1.0, smaller values represent slower +// Sets new target iRate. Normal iRate = 1.0, smaller values represent slower // iRate, larger faster iRates. void RateTransposerInteger::setRate(float newRate) { @@ -506,13 +506,13 @@ void RateTransposerInteger::setRate(float newRate) ////////////////////////////////////////////////////////////////////////////// // // RateTransposerFloat - floating point arithmetic implementation -// +// ////////////////////////////////////////////////////////////////////////////// // Constructor RateTransposerFloat::RateTransposerFloat() : RateTransposer() { - // Notice: use local function calling syntax for sake of clarity, + // Notice: use local function calling syntax for sake of clarity, // to indicate the fact that C++ constructor can't call virtual functions. RateTransposerFloat::resetRegisters(); RateTransposerFloat::setRate(1.0f); @@ -527,24 +527,24 @@ RateTransposerFloat::~RateTransposerFloat() void RateTransposerFloat::resetRegisters() { fSlopeCount = 0; - sPrevSampleL = + 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 +// 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 nSamples) { unsigned int i, used; - used = 0; + used = 0; i = 0; // Process the last sample saved from the previous call first... - while (fSlopeCount <= 1.0f) + while (fSlopeCount <= 1.0f) { dest[i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]); i++; @@ -556,7 +556,7 @@ uint RateTransposerFloat::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, { while (1) { - while (fSlopeCount > 1.0f) + while (fSlopeCount > 1.0f) { fSlopeCount -= 1.0f; used ++; @@ -575,8 +575,8 @@ end: } -// Transposes the sample rate of the given samples using linear interpolation. -// 'Mono' version of the routine. Returns the number of samples returned in +// 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 nSamples) { @@ -584,11 +584,11 @@ uint RateTransposerFloat::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *sr if (nSamples == 0) return 0; // no samples, no work - used = 0; + used = 0; i = 0; // Process the last sample saved from the sPrevSampleLious call first... - while (fSlopeCount <= 1.0f) + 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]); @@ -602,7 +602,7 @@ uint RateTransposerFloat::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *sr { while (1) { - while (fSlopeCount > 1.0f) + while (fSlopeCount > 1.0f) { fSlopeCount -= 1.0f; used ++; @@ -610,9 +610,9 @@ uint RateTransposerFloat::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *sr } srcPos = 2 * used; - dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos] + dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos] + fSlopeCount * src[srcPos + 2]); - dest[2 * i + 1] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos + 1] + dest[2 * i + 1] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos + 1] + fSlopeCount * src[srcPos + 3]); i++; diff --git a/3rdparty/SoundTouch/RateTransposer.h b/3rdparty/SoundTouch/RateTransposer.h index 48f7bed5c2..6ab0586484 100644 --- a/3rdparty/SoundTouch/RateTransposer.h +++ b/3rdparty/SoundTouch/RateTransposer.h @@ -1,10 +1,10 @@ //////////////////////////////////////////////////////////////////////////////// -/// -/// Sample rate transposer. Changes sample rate by using linear interpolation +/// +/// 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 +/// Use either of the derived classes of 'RateTransposerInteger' or /// 'RateTransposerFloat' for corresponding integer/floating point tranposing /// algorithm implementation. /// @@ -57,9 +57,9 @@ 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 +/// 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 { @@ -85,26 +85,26 @@ protected: virtual void resetRegisters() = 0; - virtual uint transposeStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, + virtual uint transposeStereo(SAMPLETYPE *dest, + const SAMPLETYPE *src, uint numSamples) = 0; - virtual uint transposeMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, + virtual uint transposeMono(SAMPLETYPE *dest, + const SAMPLETYPE *src, uint numSamples) = 0; - inline uint transpose(SAMPLETYPE *dest, - const SAMPLETYPE *src, + inline uint transpose(SAMPLETYPE *dest, + const SAMPLETYPE *src, uint numSamples); - void downsample(const SAMPLETYPE *src, + void downsample(const SAMPLETYPE *src, uint numSamples); - void upsample(const SAMPLETYPE *src, + void upsample(const SAMPLETYPE *src, uint numSamples); - /// Transposes sample rate by applying anti-alias filter to prevent folding. + /// 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, + void processSamples(const SAMPLETYPE *src, uint numSamples); @@ -112,12 +112,12 @@ public: RateTransposer(); virtual ~RateTransposer(); - /// Operator 'new' is overloaded so that it automatically creates a suitable instance + /// Operator 'new' is overloaded so that it automatically creates a suitable instance /// depending on if we're to use integer or floating point arithmetics. static 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 + /// 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(); @@ -136,7 +136,7 @@ public: /// Returns nonzero if anti-alias filter is enabled. BOOL isAAFilterEnabled() const; - /// Sets new target rate. Normal rate = 1.0, smaller values represent slower + /// Sets new target rate. Normal rate = 1.0, smaller values represent slower /// rate, larger faster rates. virtual void setRate(float newRate); diff --git a/3rdparty/SoundTouch/STTypes.h b/3rdparty/SoundTouch/STTypes.h index 723671a2a2..1fcd9e2da9 100644 --- a/3rdparty/SoundTouch/STTypes.h +++ b/3rdparty/SoundTouch/STTypes.h @@ -61,45 +61,45 @@ typedef unsigned long ulong; namespace soundtouch { -/// Activate these undef's to overrule the possible sampletype +/// 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 + /// 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 + /// - 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 + /// 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 #if (WIN32 || __i386__ || __x86_64__) - /// Define this to allow X86-specific assembler/intrinsic optimizations. + /// Define this to allow X86-specific assembler/intrinsic optimizations. /// Notice that library contains also usual C++ versions of each of these - /// these routines, so if you're having difficulties getting the optimized - /// routines compiled for whatever reason, you may disable these optimizations + /// these routines, so if you're having difficulties getting the optimized + /// routines compiled for whatever reason, you may disable these optimizations /// to make the library compile. #define ALLOW_X86_OPTIMIZATIONS 1 #endif - // If defined, allows the SIMD-optimized routines to take minor shortcuts - // for improved performance. Undefine to require faithfully similar SIMD + // 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. #define ALLOW_NONEXACT_SIMD_OPTIMIZATION 1 @@ -140,9 +140,9 @@ namespace soundtouch }; -// When this #define is active, eliminates a clicking sound when the "rate" or "pitch" -// parameter setting crosses from value <1 to >=1 or vice versa during processing. -// Default is off as such crossover is untypical case and involves a slight sound +// When this #define is active, eliminates a clicking sound when the "rate" or "pitch" +// parameter setting crosses from value <1 to >=1 or vice versa during processing. +// Default is off as such crossover is untypical case and involves a slight sound // quality compromise. //#define PREVENT_CLICK_AT_RATE_CROSSOVER 1 diff --git a/3rdparty/SoundTouch/SoundTouch.cpp b/3rdparty/SoundTouch/SoundTouch.cpp index afd341c7cf..8abfc23b27 100644 --- a/3rdparty/SoundTouch/SoundTouch.cpp +++ b/3rdparty/SoundTouch/SoundTouch.cpp @@ -1,27 +1,27 @@ ////////////////////////////////////////////////////////////////////////////// /// -/// SoundTouch - main class for tempo/pitch/rate adjusting routines. +/// 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 +/// - 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 +/// - 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 +/// 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 +/// +/// - 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 +/// +/// - 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 +/// 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. @@ -30,8 +30,8 @@ /// 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) 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. /// @@ -82,7 +82,7 @@ #include "cpu_detect.h" using namespace soundtouch; - + /// test if two floating point numbers are equal #define TEST_FLOAT_EQUAL(a, b) (fabs(a - b) < 1e-10) @@ -91,7 +91,7 @@ using namespace soundtouch; extern "C" void soundtouch_ac_test() { printf("SoundTouch Version: %s\n",SOUNDTOUCH_VERSION); -} +} SoundTouch::SoundTouch() @@ -105,8 +105,8 @@ SoundTouch::SoundTouch() rate = tempo = 0; - virtualPitch = - virtualRate = + virtualPitch = + virtualRate = virtualTempo = 1.0; calcEffectiveRateAndTempo(); @@ -144,7 +144,7 @@ uint SoundTouch::getVersionId() // Sets the number of channels, 1 = mono, 2 = stereo void SoundTouch::setChannels(uint numChannels) { - if (numChannels != 1 && numChannels != 2) + if (numChannels != 1 && numChannels != 2) { throw std::runtime_error("Illegal number of channels"); } @@ -244,9 +244,9 @@ void SoundTouch::calcEffectiveRateAndTempo() if (!TEST_FLOAT_EQUAL(tempo, oldTempo)) pTDStretch->setTempo(tempo); #ifndef PREVENT_CLICK_AT_RATE_CROSSOVER - if (rate <= 1.0f) + if (rate <= 1.0f) { - if (output != pTDStretch) + if (output != pTDStretch) { FIFOSamplePipe *tempoOut; @@ -263,7 +263,7 @@ void SoundTouch::calcEffectiveRateAndTempo() else #endif { - if (output != pRateTransposer) + if (output != pRateTransposer) { FIFOSamplePipe *transOut; @@ -276,7 +276,7 @@ void SoundTouch::calcEffectiveRateAndTempo() output = pRateTransposer; } - } + } } @@ -293,42 +293,42 @@ void SoundTouch::setSampleRate(uint srate) // the input of the object. void SoundTouch::putSamples(const SAMPLETYPE *samples, uint nSamples) { - if (bSrateSet == FALSE) + if (bSrateSet == FALSE) { throw std::runtime_error("SoundTouch : Sample rate not defined"); - } - else if (channels == 0) + } + 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) + if (rate == 1.0f) { - // The rate value is same as the original, simply evaluate the tempo changer. + // The rate value is same as the original, simply evaluate the tempo changer. assert(output == pTDStretch); - if (pRateTransposer->isEmpty() == 0) + 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, nSamples); - } + } */ #ifndef PREVENT_CLICK_AT_RATE_CROSSOVER - else if (rate <= 1.0f) + else if (rate <= 1.0f) { // transpose the rate down, output the transposed sound to tempo changer buffer assert(output == pTDStretch); pRateTransposer->putSamples(samples, nSamples); pTDStretch->moveSamples(*pRateTransposer); - } - else + } + else #endif { - // evaluate the tempo changer, then transpose the rate up, + // evaluate the tempo changer, then transpose the rate up, assert(output == pRateTransposer); pTDStretch->putSamples(samples, nSamples); pRateTransposer->moveSamples(*pTDStretch); @@ -353,10 +353,10 @@ void SoundTouch::flush() 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 + // 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 ++) + for (i = 0; i < 128; i ++) { putSamples(buff, 64); if (numSamples() != nOut) break; // new samples have appeared in the output! @@ -379,7 +379,7 @@ BOOL SoundTouch::setSetting(int settingId, int value) // read current tdstretch routine parameters pTDStretch->getParameters(&sampleRate, &sequenceMs, &seekWindowMs, &overlapMs); - switch (settingId) + switch (settingId) { case SETTING_USE_AA_FILTER : // enables / disabless anti-alias filter @@ -425,7 +425,7 @@ int SoundTouch::getSetting(int settingId) const { int temp; - switch (settingId) + switch (settingId) { case SETTING_USE_AA_FILTER : return (uint)pRateTransposer->isAAFilterEnabled(); diff --git a/3rdparty/SoundTouch/SoundTouch.h b/3rdparty/SoundTouch/SoundTouch.h index 70c18d028c..9d82886aa9 100644 --- a/3rdparty/SoundTouch/SoundTouch.h +++ b/3rdparty/SoundTouch/SoundTouch.h @@ -1,27 +1,27 @@ ////////////////////////////////////////////////////////////////////////////// /// -/// SoundTouch - main class for tempo/pitch/rate adjusting routines. +/// 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 +/// - 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 +/// - 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 +/// 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 +/// +/// - 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 +/// +/// - 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 +/// 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. @@ -30,8 +30,8 @@ /// 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) 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. /// @@ -98,20 +98,20 @@ namespace soundtouch /// 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. +/// 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. +/// 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. +/// 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 @@ -137,7 +137,7 @@ private: /// Flag: Has sample rate been set? BOOL bSrateSet; - /// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtualTempo' and + /// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtualTempo' and /// 'virtualPitch' parameters. void calcEffectiveRateAndTempo(); @@ -181,7 +181,7 @@ public: /// represent lower pitches, larger values higher pitch. void setPitch(float newPitch); - /// Sets pitch change in octaves compared to the original pitch + /// Sets pitch change in octaves compared to the original pitch /// (-1.00 .. +1.00) void setPitchOctaves(float newPitch); @@ -221,7 +221,7 @@ public: /// 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(int settingId, ///< Setting ID number. see SETTING_... defines. int value ///< New setting value. @@ -242,7 +242,7 @@ public: /// 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 + /// - 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. diff --git a/3rdparty/SoundTouch/TDStretch.cpp b/3rdparty/SoundTouch/TDStretch.cpp index 2643fab5d8..e37a0f53b8 100644 --- a/3rdparty/SoundTouch/TDStretch.cpp +++ b/3rdparty/SoundTouch/TDStretch.cpp @@ -1,10 +1,10 @@ //////////////////////////////////////////////////////////////////////////////// -/// -/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo -/// while maintaining the original pitch by using a time domain WSOLA-like +/// +/// 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 +/// 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 @@ -122,11 +122,11 @@ TDStretch::~TDStretch() // // '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 +// 'seekwindowMS' = seeking window length for scanning the best overlapping // position (default = 28 ms) // 'overlapMS' = overlapping length (default = 12 ms) -void TDStretch::setParameters(int aSampleRate, int aSequenceMS, +void TDStretch::setParameters(int aSampleRate, int aSequenceMS, int aSeekWindowMS, int aOverlapMS) { // accept only positive parameter values - if zero or negative, use old values instead @@ -137,19 +137,19 @@ void TDStretch::setParameters(int aSampleRate, int aSequenceMS, { this->sequenceMs = aSequenceMS; bAutoSeqSetting = FALSE; - } + } else if (aSequenceMS == 0) { // if zero, use automatic setting bAutoSeqSetting = TRUE; } - if (aSeekWindowMS > 0) + if (aSeekWindowMS > 0) { this->seekWindowMs = aSeekWindowMS; bAutoSeekSetting = FALSE; - } - else if (aSeekWindowMS == 0) + } + else if (aSeekWindowMS == 0) { // if zero, use automatic setting bAutoSeekSetting = TRUE; @@ -198,7 +198,7 @@ void TDStretch::overlapMono(SAMPLETYPE *pOutput, const SAMPLETYPE *pInput) const { int i, itemp; - for (i = 0; i < overlapLength ; i ++) + for (i = 0; i < overlapLength ; i ++) { itemp = overlapLength - i; pOutput[i] = (pInput[i] * i + pMidBuffer[i] * itemp ) / overlapLength; // >> overlapDividerBits; @@ -247,26 +247,26 @@ BOOL TDStretch::isQuickSeekEnabled() const // Seeks for the optimal overlap-mixing position. int TDStretch::seekBestOverlapPosition(const SAMPLETYPE *refPos) { - if (channels == 2) + if (channels == 2) { // stereo sound - if (bQuickSeek) + if (bQuickSeek) { return seekBestOverlapPositionStereoQuick(refPos); - } - else + } + else { return seekBestOverlapPositionStereo(refPos); } - } - else + } + else { // mono sound - if (bQuickSeek) + if (bQuickSeek) { return seekBestOverlapPositionMonoQuick(refPos); - } - else + } + else { return seekBestOverlapPositionMono(refPos); } @@ -280,7 +280,7 @@ int TDStretch::seekBestOverlapPosition(const SAMPLETYPE *refPos) // of 'ovlPos'. inline void TDStretch::overlap(SAMPLETYPE *pOutput, const SAMPLETYPE *pInput, uint ovlPos) const { - if (channels == 2) + if (channels == 2) { // stereo sound overlapStereo(pOutput, pInput + 2 * ovlPos); @@ -299,7 +299,7 @@ inline void TDStretch::overlap(SAMPLETYPE *pOutput, const SAMPLETYPE *pInput, ui // 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 -int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos) +int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos) { int bestOffs; double bestCorr, corr; @@ -313,7 +313,7 @@ int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos) // Scans for the best correlation value by testing each possible position // over the permitted range. - for (i = 0; i < seekLength; i ++) + for (i = 0; i < seekLength; i ++) { // Calculates correlation value for the mixing position corresponding // to 'i' @@ -323,7 +323,7 @@ int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos) corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp)); // Checks for the highest correlation value - if (corr > bestCorr) + if (corr > bestCorr) { bestCorr = corr; bestOffs = i; @@ -342,7 +342,7 @@ int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos) // 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 -int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos) +int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos) { int j; int bestOffs; @@ -360,13 +360,13 @@ int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos) // 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 + // 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 ++) + for (scanCount = 0;scanCount < 4; scanCount ++) { j = 0; - while (_scanOffsets[scanCount][j]) + while (_scanOffsets[scanCount][j]) { tempOffset = corrOffset + _scanOffsets[scanCount][j]; if (tempOffset >= seekLength) break; @@ -379,7 +379,7 @@ int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos) corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp)); // Checks for the highest correlation value - if (corr > bestCorr) + if (corr > bestCorr) { bestCorr = corr; bestOffs = tempOffset; @@ -402,7 +402,7 @@ int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos) // 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 -int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos) +int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos) { int bestOffs; double bestCorr, corr; @@ -417,7 +417,7 @@ int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos) // Scans for the best correlation value by testing each possible position // over the permitted range. - for (tempOffset = 0; tempOffset < seekLength; tempOffset ++) + for (tempOffset = 0; tempOffset < seekLength; tempOffset ++) { compare = refPos + tempOffset; @@ -429,7 +429,7 @@ int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos) corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp)); // Checks for the highest correlation value - if (corr > bestCorr) + if (corr > bestCorr) { bestCorr = corr; bestOffs = tempOffset; @@ -448,7 +448,7 @@ int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos) // 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 -int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos) +int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos) { int j; int bestOffs; @@ -466,13 +466,13 @@ int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos) // 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 + // 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 ++) + for (scanCount = 0;scanCount < 4; scanCount ++) { j = 0; - while (_scanOffsets[scanCount][j]) + while (_scanOffsets[scanCount][j]) { tempOffset = corrOffset + _scanOffsets[scanCount][j]; if (tempOffset >= seekLength) break; @@ -485,7 +485,7 @@ int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos) corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp)); // Checks for the highest correlation value - if (corr > bestCorr) + if (corr > bestCorr) { bestCorr = corr; bestOffs = tempOffset; @@ -501,7 +501,7 @@ int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos) } -/// clear cross correlation routine state if necessary +/// clear cross correlation routine state if necessary void TDStretch::clearCrossCorrState() { // default implementation is empty. @@ -531,7 +531,7 @@ void TDStretch::calcSeqParameters() #define CHECK_LIMITS(x, mi, ma) (((x) < (mi)) ? (mi) : (((x) > (ma)) ? (ma) : (x))) double seq, seek; - + if (bAutoSeqSetting) { seq = AUTOSEQ_C + AUTOSEQ_K * tempo; @@ -548,7 +548,7 @@ void TDStretch::calcSeqParameters() // Update seek window lengths seekWindowLength = (sampleRate * sequenceMs) / 1000; - if (seekWindowLength < 2 * overlapLength) + if (seekWindowLength < 2 * overlapLength) { seekWindowLength = 2 * overlapLength; } @@ -557,7 +557,7 @@ void TDStretch::calcSeqParameters() -// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower +// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower // tempo, larger faster tempo. void TDStretch::setTempo(float newTempo) { @@ -568,11 +568,11 @@ void TDStretch::setTempo(float newTempo) // Calculate new sequence duration calcSeqParameters(); - // Calculate ideal skip length (according to tempo value) + // Calculate ideal skip length (according to tempo value) nominalSkip = tempo * (seekWindowLength - overlapLength); intskip = (int)(nominalSkip + 0.5f); - // Calculate how many samples are needed in the 'inputBuffer' to + // Calculate how many samples are needed in the 'inputBuffer' to // process another batch of samples //sampleReq = max(intskip + overlapLength, seekWindowLength) + seekLength / 2; sampleReq = max(intskip + overlapLength, seekWindowLength) + seekLength; @@ -600,18 +600,18 @@ void TDStretch::processNominalTempo() { assert(tempo == 1.0f); - if (bMidBufferDirty) + if (bMidBufferDirty) { // If there are samples in pMidBuffer waiting for overlapping, - // do a single sliding overlapping with them in order to prevent a + // do a single sliding overlapping with them in order to prevent a // clicking distortion in the output sound - if (inputBuffer.numSamples() < overlapLength) + 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 + // 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); @@ -636,7 +636,7 @@ void TDStretch::processSamples() /* Removed this small optimization - can introduce a click to sound when tempo setting crosses the nominal value - if (tempo == 1.0f) + if (tempo == 1.0f) { // tempo not changed from the original, so bypass the processing processNominalTempo(); @@ -646,14 +646,14 @@ void TDStretch::processSamples() // Process samples as long as there are enough samples in 'inputBuffer' // to form a processing frame. -// while ((int)inputBuffer.numSamples() >= sampleReq - (outDebt / 4)) - while ((int)inputBuffer.numSamples() >= sampleReq) +// while ((int)inputBuffer.numSamples() >= sampleReq - (outDebt / 4)) + while ((int)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 + // 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') @@ -666,7 +666,7 @@ void TDStretch::processSamples() // compensate cumulated output length diff vs. ideal output // temp -= outDebt / 4; - // update ideal vs. true output difference + // update ideal vs. true output difference // outDebt += temp; // length of sequence @@ -681,11 +681,11 @@ void TDStretch::processSamples() outputBuffer.putSamples(inputBuffer.ptrBegin() + channels * (offset + overlapLength), (uint)temp); - // Copies the end of the current sequence from 'inputBuffer' to - // 'midBuffer' for being mixed with the beginning of the next + // 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 + temp + overlapLength * 2) <= (int)inputBuffer.numSamples()); - memcpy(pMidBuffer, inputBuffer.ptrBegin() + channels * (offset + temp + overlapLength), + memcpy(pMidBuffer, inputBuffer.ptrBegin() + channels * (offset + temp + overlapLength), channels * sizeof(SAMPLETYPE) * overlapLength); // Remove the processed samples from the input buffer. Update @@ -735,7 +735,7 @@ void TDStretch::acceptNewOverlapLength(int newOverlapLength) } -// Operator 'new' is overloaded so that it automatically creates a suitable instance +// 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) { @@ -804,7 +804,7 @@ void TDStretch::precalcCorrReferenceStereo() int i, cnt2; int temp, temp2; - for (i=0 ; i < (int)overlapLength ;i ++) + for (i=0 ; i < (int)overlapLength ;i ++) { temp = i * (overlapLength - i); cnt2 = i * 2; @@ -825,7 +825,7 @@ void TDStretch::precalcCorrReferenceMono() long temp; long temp2; - for (i=0 ; i < (int)overlapLength ;i ++) + for (i=0 ; i < (int)overlapLength ;i ++) { temp = i * (overlapLength - i); temp2 = (pMidBuffer[i] * temp) / slopingDivider; @@ -834,7 +834,7 @@ void TDStretch::precalcCorrReferenceMono() } -// Overlaps samples in 'midBuffer' with the samples in 'input'. The 'Stereo' +// Overlaps samples in 'midBuffer' with the samples in 'input'. The 'Stereo' // version of the routine. void TDStretch::overlapStereo(short *poutput, const short *input) const { @@ -842,7 +842,7 @@ void TDStretch::overlapStereo(short *poutput, const short *input) const short temp; int cnt2; - for (i = 0; i < overlapLength ; i ++) + for (i = 0; i < overlapLength ; i ++) { temp = (short)(overlapLength - i); cnt2 = 2 * i; @@ -868,8 +868,8 @@ void TDStretch::calculateOverlapLength(int aoverlapMs) assert(aoverlapMs >= 0); // calculate overlap length so that it's power of 2 - thus it's easy to do - // integer division by right-shifting. Term "-1" at end is to account for - // the extra most significatnt bit left unused in result by signed multiplication + // integer division by right-shifting. Term "-1" at end is to account for + // the extra most significatnt bit left unused in result by signed multiplication overlapDividerBits = _getClosest2Power((sampleRate * aoverlapMs) / 1000.0) - 1; if (overlapDividerBits > 9) overlapDividerBits = 9; if (overlapDividerBits < 3) overlapDividerBits = 3; @@ -877,8 +877,8 @@ void TDStretch::calculateOverlapLength(int aoverlapMs) acceptNewOverlapLength(newOvl); - // calculate sloping divider so that crosscorrelation operation won't - // overflow 32-bit register. Max. sum of the crosscorrelation sum without + // calculate sloping divider so that crosscorrelation operation won't + // overflow 32-bit register. Max. sum of the crosscorrelation sum without // divider would be 2^30*(N^3-N)/3, where N = overlap length slopingDivider = (newOvl * newOvl - 1) / 3; } @@ -891,13 +891,13 @@ long TDStretch::calcCrossCorrMono(const short *mixingPos, const short *compare) int i; corr = norm = 0; - for (i = 1; i < overlapLength; i ++) + for (i = 1; i < overlapLength; i ++) { corr += (mixingPos[i] * compare[i]) >> overlapDividerBits; norm += (mixingPos[i] * mixingPos[i]) >> overlapDividerBits; } - // Normalize result by dividing by sqrt(norm) - this step is easiest + // Normalize result by dividing by sqrt(norm) - this step is easiest // done using floating point operation if (norm == 0) norm = 1; // to avoid div by zero return (long)((double)corr * SHRT_MAX / sqrt((double)norm)); @@ -911,14 +911,14 @@ long TDStretch::calcCrossCorrStereo(const short *mixingPos, const short *compare int i; corr = norm = 0; - for (i = 2; i < 2 * overlapLength; i += 2) + for (i = 2; i < 2 * overlapLength; i += 2) { corr += (mixingPos[i] * compare[i] + mixingPos[i + 1] * compare[i + 1]) >> overlapDividerBits; norm += (mixingPos[i] * mixingPos[i] + mixingPos[i + 1] * mixingPos[i + 1]) >> overlapDividerBits; } - // Normalize result by dividing by sqrt(norm) - this step is easiest + // Normalize result by dividing by sqrt(norm) - this step is easiest // done using floating point operation if (norm == 0) norm = 1; // to avoid div by zero return (long)((double)corr * SHRT_MAX / sqrt((double)norm)); @@ -941,7 +941,7 @@ void TDStretch::precalcCorrReferenceStereo() int i, cnt2; float temp; - for (i=0 ; i < (int)overlapLength ;i ++) + for (i=0 ; i < (int)overlapLength ;i ++) { temp = (float)i * (float)(overlapLength - i); cnt2 = i * 2; @@ -958,7 +958,7 @@ void TDStretch::precalcCorrReferenceMono() int i; float temp; - for (i=0 ; i < (int)overlapLength ;i ++) + for (i=0 ; i < (int)overlapLength ;i ++) { temp = (float)i * (float)(overlapLength - i); pRefMidBuffer[i] = (float)(pMidBuffer[i] * temp); @@ -977,7 +977,7 @@ void TDStretch::overlapStereo(float *pOutput, const float *pInput) const fScale = 1.0f / (float)overlapLength; - for (i = 0; i < (int)overlapLength ; i ++) + for (i = 0; i < (int)overlapLength ; i ++) { fTemp = (float)(overlapLength - i) * fScale; fi = (float)i * fScale; @@ -1012,7 +1012,7 @@ double TDStretch::calcCrossCorrMono(const float *mixingPos, const float *compare int i; corr = norm = 0; - for (i = 1; i < overlapLength; i ++) + for (i = 1; i < overlapLength; i ++) { corr += mixingPos[i] * compare[i]; norm += mixingPos[i] * mixingPos[i]; @@ -1030,11 +1030,11 @@ double TDStretch::calcCrossCorrStereo(const float *mixingPos, const float *compa int i; corr = norm = 0; - for (i = 2; i < 2 * overlapLength; i += 2) + for (i = 2; i < 2 * overlapLength; i += 2) { corr += mixingPos[i] * compare[i] + mixingPos[i + 1] * compare[i + 1]; - norm += mixingPos[i] * mixingPos[i] + + norm += mixingPos[i] * mixingPos[i] + mixingPos[i + 1] * mixingPos[i + 1]; } diff --git a/3rdparty/SoundTouch/TDStretch.h b/3rdparty/SoundTouch/TDStretch.h index 8a87892022..1962d818a1 100644 --- a/3rdparty/SoundTouch/TDStretch.h +++ b/3rdparty/SoundTouch/TDStretch.h @@ -1,10 +1,10 @@ //////////////////////////////////////////////////////////////////////////////// -/// -/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo -/// while maintaining the original pitch by using a time domain WSOLA-like method +/// +/// 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/SSE optimized functions reside in separate, platform-specific files +/// Note : MMX/SSE optimized functions reside in separate, platform-specific files /// 'mmx_optimized.cpp' and 'sse_optimized.cpp' /// /// Author : Copyright (c) Olli Parviainen @@ -53,14 +53,14 @@ namespace soundtouch { /// Default values for sound processing parameters: -/// Notice that the default parameters are tuned for contemporary popular music +/// Notice that the default parameters are tuned for contemporary popular music /// processing. For speech processing applications these parameters suit better: /// #define DEFAULT_SEQUENCE_MS 40 /// #define DEFAULT_SEEKWINDOW_MS 15 /// #define DEFAULT_OVERLAP_MS 8 /// -/// Default length of a single processing sequence, in milliseconds. This determines to how +/// 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 @@ -75,15 +75,15 @@ namespace soundtouch /// according to tempo setting (recommended) #define USE_AUTO_SEQUENCE_LEN 0 -/// Seeking window default 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. +/// Seeking window default 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. /// /// The bigger this window setting is, the higher the possibility to find a better mixing /// position will become, but at the same time large values may cause a "drifting" artifact /// because consequent sequences will be taken at more uneven intervals. /// -/// If there's a disturbing artifact that sounds as if a constant frequency was drifting +/// If there's a disturbing artifact that sounds as if a constant frequency was drifting /// around, try reducing this setting. /// /// Increasing this value increases computational burden & vice versa. @@ -94,11 +94,11 @@ namespace soundtouch /// according to tempo setting (recommended) #define USE_AUTO_SEEKWINDOW_LEN 0 -/// 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. +/// 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. /// -/// This shouldn't be that critical parameter. If you reduce the DEFAULT_SEQUENCE_MS setting +/// This shouldn't be that critical parameter. If you reduce the DEFAULT_SEQUENCE_MS setting /// by a large amount, you might wish to try a smaller value on this. /// /// Increasing this value increases computational burden & vice versa. @@ -167,27 +167,27 @@ protected: /// 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 + /// 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. static void *operator new(size_t s); - /// Use this function instead of "new" operator to create a new instance of this class. + /// 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 + /// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower /// tempo, larger faster tempo. void setTempo(float newTempo); @@ -200,7 +200,7 @@ public: /// Sets the number of channels, 1 = mono, 2 = stereo void setChannels(int numChannels); - /// Enables/disables the quick position seeking algorithm. Zero to disable, + /// Enables/disables the quick position seeking algorithm. Zero to disable, /// nonzero to enable void enableQuickSeek(BOOL enable); @@ -212,7 +212,7 @@ public: // /// 'sampleRate' = sample rate of the sound /// 'sequenceMS' = one processing sequence length in milliseconds - /// 'seekwindowMS' = seeking window length for scanning the best overlapping + /// 'seekwindowMS' = seeking window length for scanning the best overlapping /// position /// 'overlapMS' = overlapping length void setParameters(int sampleRate, ///< Samplerate of sound being processed (Hz) diff --git a/3rdparty/SoundTouch/WavFile.cpp b/3rdparty/SoundTouch/WavFile.cpp index e58f97d8aa..948930215b 100644 --- a/3rdparty/SoundTouch/WavFile.cpp +++ b/3rdparty/SoundTouch/WavFile.cpp @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// Classes for easy reading & writing of WAV sound files. +/// 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 +/// 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... @@ -64,9 +64,9 @@ static const char dataStr[] = "data"; ////////////////////////////////////////////////////////////////////////////// // -// Helper functions for swapping byte order to correctly read/write WAV files +// 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. +// 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. @@ -78,23 +78,23 @@ static const char dataStr[] = "data"; #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 = ((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 = ((wData >> 8) & 0x00FF) | ((wData << 8) & 0xFF00); } @@ -116,7 +116,7 @@ static const char dataStr[] = "data"; static inline void _swap32(unsigned int &dwData) { // do nothing - } + } // dummy helper-function static inline void _swap16(unsigned short &wData) @@ -142,7 +142,7 @@ WavInFile::WavInFile(const char *fileName) { // Try to open the file for reading fptr = fopen(fileName, "rb"); - if (fptr == NULL) + if (fptr == NULL) { // didn't succeed string msg = "Error : Unable to open file \""; @@ -159,7 +159,7 @@ WavInFile::WavInFile(FILE *file) { // Try to open the file for reading fptr = file; - if (!file) + if (!file) { // didn't succeed string msg = "Error : Unable to access input stream for reading"; @@ -180,9 +180,9 @@ void WavInFile::init() // Read the file headers hdrsOk = readWavHeaders(); - if (hdrsOk != 0) + if (hdrsOk != 0) { - // Something didn't match in the wav file headers + // Something didn't match in the wav file headers string msg = "Input file is corrupt or not a WAV file"; throw runtime_error(msg); } @@ -242,7 +242,7 @@ int WavInFile::read(char *buffer, int maxElems) numBytes = maxElems; afterDataRead = dataRead + numBytes; - if (afterDataRead > header.data.data_len) + if (afterDataRead > header.data.data_len) { // Don't read more samples than are marked available in header numBytes = (int)header.data.data_len - (int)dataRead; @@ -286,7 +286,7 @@ int WavInFile::read(short *buffer, int maxElems) numBytes = maxElems * 2; afterDataRead = dataRead + numBytes; - if (afterDataRead > header.data.data_len) + if (afterDataRead > header.data.data_len) { // Don't read more samples than are marked available in header numBytes = (int)header.data.data_len - (int)dataRead; @@ -349,7 +349,7 @@ static int isAlphaStr(const char *str) char c; c = str[0]; - while (c) + while (c) { if (isAlpha(c) == 0) return 0; str ++; @@ -394,7 +394,7 @@ int WavInFile::readHeaderBlock() { int nLen, nDump; - // 'fmt ' block + // 'fmt ' block memcpy(header.format.fmt, fmtStr, 4); // read length of the format field @@ -541,7 +541,7 @@ WavOutFile::WavOutFile(const char *fileName, int sampleRate, int bits, int chann { bytesWritten = 0; fptr = fopen(fileName, "wb"); - if (fptr == NULL) + if (fptr == NULL) { string msg = "Error : Unable to open file \""; msg += fileName; @@ -559,7 +559,7 @@ WavOutFile::WavOutFile(FILE *file, int sampleRate, int bits, int channels) { bytesWritten = 0; fptr = file; - if (fptr == NULL) + if (fptr == NULL) { string msg = "Error : Unable to access output file stream."; throw runtime_error(msg); @@ -668,7 +668,7 @@ void WavOutFile::write(const char *buffer, int numElems) assert(sizeof(char) == 1); res = fwrite(buffer, 1, numElems, fptr); - if (res != numElems) + if (res != numElems) { throw runtime_error("Error while writing to a wav file."); } @@ -712,7 +712,7 @@ void WavOutFile::write(const short *buffer, int numElems) delete[] pTemp; - if (res != numElems) + if (res != numElems) { throw runtime_error("Error while writing to a wav file."); } diff --git a/3rdparty/SoundTouch/WavFile.h b/3rdparty/SoundTouch/WavFile.h index a7ee48c27b..5ce62b1b82 100644 --- a/3rdparty/SoundTouch/WavFile.h +++ b/3rdparty/SoundTouch/WavFile.h @@ -4,10 +4,10 @@ /// /// 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 +/// +/// 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. +/// 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 @@ -51,11 +51,11 @@ #ifndef uint typedef unsigned int uint; -#endif +#endif /// WAV audio file 'riff' section header -typedef struct +typedef struct { char riff_char[4]; int package_len; @@ -63,7 +63,7 @@ typedef struct } WavRiff; /// WAV audio file 'format' section header -typedef struct +typedef struct { char fmt[4]; int format_len; @@ -76,7 +76,7 @@ typedef struct } WavFormat; /// WAV audio file 'data' section header -typedef struct +typedef struct { char data_field[4]; uint data_len; @@ -84,7 +84,7 @@ typedef struct /// WAV audio file header -typedef struct +typedef struct { WavRiff riff; WavFormat format; @@ -142,7 +142,7 @@ public: /// 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 + /// Get sample data size in bytes. Ahem, this should return same information as /// 'getBytesPerSample'... uint getDataSizeInBytes() const; @@ -151,7 +151,7 @@ public: /// 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; @@ -159,14 +159,14 @@ public: 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 + /// 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 + /// 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. @@ -174,7 +174,7 @@ public: int maxElems ///< Size of 'buffer' array (number of array elements). ); - /// Reads audio samples from the WAV file to floating point format, converting + /// 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. /// @@ -215,7 +215,7 @@ private: void writeHeader(); public: - /// Constructor: Creates a new WAV file. Throws a 'runtime_error' exception + /// 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) @@ -228,7 +228,7 @@ public: /// Destructor: Finalizes & closes the WAV file. ~WavOutFile(); - /// Write data to WAV file. This function works only with 8bit samples. + /// 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. diff --git a/3rdparty/SoundTouch/cpu_detect.h b/3rdparty/SoundTouch/cpu_detect.h index 7859ffb55d..33c5026ce0 100644 --- a/3rdparty/SoundTouch/cpu_detect.h +++ b/3rdparty/SoundTouch/cpu_detect.h @@ -2,8 +2,8 @@ /// /// 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 +/// 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 diff --git a/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp b/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp index 9cbe3829c0..806de7f288 100644 --- a/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp +++ b/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp @@ -2,7 +2,7 @@ /// /// Generic version of the x86 CPU extension detection routine. /// -/// This file is for GNU & other non-Windows compilers, see 'cpu_detect_x86_win.cpp' +/// This file is for GNU & other non-Windows compilers, see 'cpu_detect_x86_win.cpp' /// for the Microsoft compiler version. /// /// Author : Copyright (c) Olli Parviainen @@ -129,7 +129,7 @@ uint detectCPUextensions(void) : "=r" (res) : /* no inputs */ : "%edx", "%eax", "%ecx", "%esi" ); - + return res & ~_dwDisabledISA; #endif } diff --git a/3rdparty/SoundTouch/cpu_detect_x86_win.cpp b/3rdparty/SoundTouch/cpu_detect_x86_win.cpp index 9e51032728..883a3accc0 100644 --- a/3rdparty/SoundTouch/cpu_detect_x86_win.cpp +++ b/3rdparty/SoundTouch/cpu_detect_x86_win.cpp @@ -2,8 +2,8 @@ /// /// 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 +/// 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 @@ -71,7 +71,7 @@ uint detectCPUextensions(void) if (_dwDisabledISA == 0xffffffff) return 0; - _asm + _asm { ; check if 'cpuid' instructions is available by toggling eflags bit 21 ; @@ -92,7 +92,7 @@ uint detectCPUextensions(void) 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 + ; cpuid instruction available, test for presence of mmx instructions mov eax, 1 cpuid test edx, 0x00800000 diff --git a/3rdparty/SoundTouch/mmx_optimized.cpp b/3rdparty/SoundTouch/mmx_optimized.cpp index 0e21bf89ab..477119529a 100644 --- a/3rdparty/SoundTouch/mmx_optimized.cpp +++ b/3rdparty/SoundTouch/mmx_optimized.cpp @@ -1,15 +1,15 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// 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 +/// 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++ +/// 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/en-us/vstudio/aa718349.aspx @@ -79,14 +79,14 @@ long TDStretchMMX::calcCrossCorrStereo(const short *pV1, const short *pV2) const __m64 accu, normaccu; long corr, norm; int i; - + pVec1 = (__m64*)pV1; pVec2 = (__m64*)pV2; shifter = _m_from_int(overlapDividerBits); normaccu = accu = _mm_setzero_si64(); - // Process 4 parallel sets of 2 * stereo samples each during each + // Process 4 parallel sets of 2 * stereo samples each during each // round to improve CPU-level parallellization. for (i = 0; i < overlapLength / 8; i ++) { @@ -127,7 +127,7 @@ long TDStretchMMX::calcCrossCorrStereo(const short *pV1, const short *pV2) const // Clear MMS state _m_empty(); - // Normalize result by dividing by sqrt(norm) - this step is easiest + // Normalize result by dividing by sqrt(norm) - this step is easiest // done using floating point operation if (norm == 0) norm = 1; // to avoid div by zero return (long)((double)corr * USHRT_MAX / sqrt((double)norm)); @@ -161,7 +161,7 @@ void TDStretchMMX::overlapStereo(short *output, const short *input) const // 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); @@ -174,7 +174,7 @@ void TDStretchMMX::overlapStereo(short *output, const short *input) const 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 @@ -244,8 +244,8 @@ void FIRFilterMMX::setCoefficients(const short *coeffs, uint newLength, uint uRe filterCoeffsUnalign = new short[2 * newLength + 8]; filterCoeffsAlign = (short *)(((ulong)filterCoeffsUnalign + 15) & -16); - // rearrange the filter coefficients for mmx routines - for (i = 0;i < length; i += 4) + // 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]; diff --git a/3rdparty/SoundTouch/sse_optimized.cpp b/3rdparty/SoundTouch/sse_optimized.cpp index 18ac6327d5..7edd1cb79e 100644 --- a/3rdparty/SoundTouch/sse_optimized.cpp +++ b/3rdparty/SoundTouch/sse_optimized.cpp @@ -1,20 +1,20 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// 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 +/// 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 +/// 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/en-us/vstudio/aa718349.aspx /// -/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and +/// 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 @@ -58,7 +58,7 @@ using namespace soundtouch; #ifdef ALLOW_SSE -// SSE routines available only with float sample type +// SSE routines available only with float sample type ////////////////////////////////////////////////////////////////////////////// // @@ -78,8 +78,8 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con const __m128 *pVec2; __m128 vSum, vNorm; - // 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 + // 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). @@ -88,7 +88,7 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con // for choosing if this little cheating is allowed. #ifdef ALLOW_NONEXACT_SIMD_OPTIMIZATION - // Little cheating allowed, return valid correlation only for + // Little cheating allowed, return valid correlation only for // aligned locations, meaning every second round for stereo sound. #define _MM_LOAD _mm_load_ps @@ -99,7 +99,7 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con // No cheating allowed, use unaligned load & take the resulting // performance hit. #define _MM_LOAD _mm_loadu_ps -#endif +#endif // ensure overlapLength is divisible by 8 assert((overlapLength % 8) == 0); @@ -111,7 +111,7 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con vSum = vNorm = _mm_setzero_ps(); // Unroll the loop by factor of 4 * 4 operations - for (i = 0; i < overlapLength / 8; i ++) + for (i = 0; i < overlapLength / 8; i ++) { __m128 vTemp; // vSum += pV1[0..3] * pV2[0..3] @@ -152,7 +152,7 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con // Calculates the cross-correlation value between 'pV1' and 'pV2' vectors corr = norm = 0.0; - for (i = 0; i < overlapLength / 8; i ++) + for (i = 0; i < overlapLength / 8; i ++) { corr += pV1[0] * pV2[0] + pV1[1] * pV2[1] + @@ -186,9 +186,9 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con uint overlapLengthLocal = overlapLength; float corr; - _asm + _asm { - // Very important note: data in 'pV2' _must_ be aligned to + // 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 @@ -234,7 +234,7 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con dec ecx jnz loop1 - // add the four floats of xmm0 together and return the result. + // 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 @@ -289,7 +289,7 @@ void FIRFilterSSE::setCoefficients(const float *coeffs, uint newLength, uint uRe fDivider = (float)resultDivider; - // rearrange the filter coefficients for mmx routines + // rearrange the filter coefficients for mmx routines for (i = 0; i < newLength; i ++) { filterCoeffsAlign[2 * i + 0] = @@ -324,13 +324,13 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n uint i; pSrc = (const float*)source; // source audio data - pFil = (const __m128*)filterCoeffsAlign; // filter coefficients. NOTE: Assumes coefficients + pFil = (const __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 ++) + for (i = 0; i < length / 8; i ++) { - // Unroll loop for efficiency & calculate filter for 2*2 stereo samples + // 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 @@ -365,14 +365,14 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n } // Ideas for further improvement: - // 1. If it could be guaranteed that 'source' were always aligned to 16-byte + // 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 + // 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 + /* original routine in C-language. please notice the C-version has differently organized coefficients though. double suml1, suml2; double sumr1, sumr2; @@ -387,26 +387,26 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n suml2 = sumr2 = 0.0; ptr = src; pFil = filterCoeffs; - for (i = 0; i < lengthLocal; i ++) + for (i = 0; i < lengthLocal; i ++) { // unroll loop for efficiency. - suml1 += ptr[0] * pFil[0] + + suml1 += ptr[0] * pFil[0] + ptr[2] * pFil[2] + ptr[4] * pFil[4] + ptr[6] * pFil[6]; - sumr1 += ptr[1] * pFil[1] + + sumr1 += ptr[1] * pFil[1] + ptr[3] * pFil[3] + ptr[5] * pFil[5] + ptr[7] * pFil[7]; - suml2 += ptr[8] * pFil[0] + + suml2 += ptr[8] * pFil[0] + ptr[10] * pFil[2] + ptr[12] * pFil[4] + ptr[14] * pFil[6]; - sumr2 += ptr[9] * pFil[1] + + sumr2 += ptr[9] * pFil[1] + ptr[11] * pFil[3] + ptr[13] * pFil[5] + ptr[15] * pFil[7]; @@ -428,7 +428,7 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n /* Similar routine in assembly, again obsoleted due to maintainability _asm { - // Very important note: data in 'src' _must_ be aligned to + // Very important note: data in 'src' _must_ be aligned to // 16-byte boundary! mov edx, count mov ebx, dword ptr src diff --git a/3rdparty/bzip2/blocksort.c b/3rdparty/bzip2/blocksort.c index 8535c93c8d..c624b9820c 100644 --- a/3rdparty/bzip2/blocksort.c +++ b/3rdparty/bzip2/blocksort.c @@ -11,7 +11,7 @@ bzip2/libbzip2 version 1.0.4 of 20 December 2006 Copyright (C) 1996-2006 Julian Seward - Please read the WARNING, DISCLAIMER and PATENTS sections in the + Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained @@ -27,11 +27,11 @@ /*---------------------------------------------*/ /*---------------------------------------------*/ -static +static __inline__ -void fallbackSimpleSort ( UInt32* fmap, - UInt32* eclass, - Int32 lo, +void fallbackSimpleSort ( UInt32* fmap, + UInt32* eclass, + Int32 lo, Int32 hi ) { Int32 i, j, tmp; @@ -90,9 +90,9 @@ void fallbackSimpleSort ( UInt32* fmap, static -void fallbackQSort3 ( UInt32* fmap, +void fallbackQSort3 ( UInt32* fmap, UInt32* eclass, - Int32 loSt, + Int32 loSt, Int32 hiSt ) { Int32 unLo, unHi, ltLo, gtHi, n, m; @@ -117,9 +117,9 @@ void fallbackQSort3 ( UInt32* fmap, } /* Random partitioning. Median of 3 sometimes fails to - avoid bad cases. Median of 9 seems to help but + avoid bad cases. Median of 9 seems to help but looks rather expensive. This too seems to work but - is cheaper. Guidance for the magic constants + is cheaper. Guidance for the magic constants 7621 and 32768 is taken from Sedgewick's algorithms book, chapter 35. */ @@ -136,10 +136,10 @@ void fallbackQSort3 ( UInt32* fmap, while (1) { if (unLo > unHi) break; n = (Int32)eclass[fmap[unLo]] - (Int32)med; - if (n == 0) { - fswap(fmap[unLo], fmap[ltLo]); - ltLo++; unLo++; - continue; + if (n == 0) { + fswap(fmap[unLo], fmap[ltLo]); + ltLo++; unLo++; + continue; }; if (n > 0) break; unLo++; @@ -147,10 +147,10 @@ void fallbackQSort3 ( UInt32* fmap, while (1) { if (unLo > unHi) break; n = (Int32)eclass[fmap[unHi]] - (Int32)med; - if (n == 0) { - fswap(fmap[unHi], fmap[gtHi]); - gtHi--; unHi--; - continue; + if (n == 0) { + fswap(fmap[unHi], fmap[gtHi]); + gtHi--; unHi--; + continue; }; if (n < 0) break; unHi--; @@ -209,8 +209,8 @@ void fallbackQSort3 ( UInt32* fmap, #define UNALIGNED_BH(zz) ((zz) & 0x01f) static -void fallbackSort ( UInt32* fmap, - UInt32* eclass, +void fallbackSort ( UInt32* fmap, + UInt32* eclass, UInt32* bhtab, Int32 nblock, Int32 verb ) @@ -251,7 +251,7 @@ void fallbackSort ( UInt32* fmap, --*/ /*-- set sentinel bits for block-end detection --*/ - for (i = 0; i < 32; i++) { + for (i = 0; i < 32; i++) { SET_BH(nblock + 2*i); CLEAR_BH(nblock + 2*i + 1); } @@ -260,7 +260,7 @@ void fallbackSort ( UInt32* fmap, H = 1; while (1) { - if (verb >= 4) + if (verb >= 4) VPrintf1 ( " depth %6d has ", H ); j = 0; @@ -305,14 +305,14 @@ void fallbackSort ( UInt32* fmap, } } - if (verb >= 4) + if (verb >= 4) VPrintf1 ( "%6d unresolved strings\n", nNotDone ); H *= 2; if (H > nblock || nNotDone == 0) break; } - /*-- + /*-- Reconstruct the original block in eclass8 [0 .. nblock-1], since the previous phase destroyed it. @@ -344,9 +344,9 @@ void fallbackSort ( UInt32* fmap, /*---------------------------------------------*/ static __inline__ -Bool mainGtU ( UInt32 i1, +Bool mainGtU ( UInt32 i1, UInt32 i2, - UChar* block, + UChar* block, UInt16* quadrant, UInt32 nblock, Int32* budget ) @@ -486,8 +486,8 @@ void mainSimpleSort ( UInt32* ptr, UChar* block, UInt16* quadrant, Int32 nblock, - Int32 lo, - Int32 hi, + Int32 lo, + Int32 hi, Int32 d, Int32* budget ) { @@ -511,8 +511,8 @@ void mainSimpleSort ( UInt32* ptr, if (i > hi) break; v = ptr[i]; j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; @@ -525,8 +525,8 @@ void mainSimpleSort ( UInt32* ptr, if (i > hi) break; v = ptr[i]; j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; @@ -539,8 +539,8 @@ void mainSimpleSort ( UInt32* ptr, if (i > hi) break; v = ptr[i]; j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; @@ -578,13 +578,13 @@ void mainSimpleSort ( UInt32* ptr, } \ } -static +static __inline__ UChar mmed3 ( UChar a, UChar b, UChar c ) { UChar t; if (a > b) { t = a; a = b; b = t; }; - if (b > c) { + if (b > c) { b = c; if (a > b) b = a; } @@ -622,8 +622,8 @@ void mainQSort3 ( UInt32* ptr, UChar* block, UInt16* quadrant, Int32 nblock, - Int32 loSt, - Int32 hiSt, + Int32 loSt, + Int32 hiSt, Int32 dSt, Int32* budget ) { @@ -646,14 +646,14 @@ void mainQSort3 ( UInt32* ptr, AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 ); mpop ( lo, hi, d ); - if (hi - lo < MAIN_QSORT_SMALL_THRESH || + if (hi - lo < MAIN_QSORT_SMALL_THRESH || d > MAIN_QSORT_DEPTH_THRESH) { mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget ); if (*budget < 0) return; continue; } - med = (Int32) + med = (Int32) mmed3 ( block[ptr[ lo ]+d], block[ptr[ hi ]+d], block[ptr[ (lo+hi)>>1 ]+d] ); @@ -665,9 +665,9 @@ void mainQSort3 ( UInt32* ptr, while (True) { if (unLo > unHi) break; n = ((Int32)block[ptr[unLo]+d]) - med; - if (n == 0) { - mswap(ptr[unLo], ptr[ltLo]); - ltLo++; unLo++; continue; + if (n == 0) { + mswap(ptr[unLo], ptr[ltLo]); + ltLo++; unLo++; continue; }; if (n > 0) break; unLo++; @@ -675,9 +675,9 @@ void mainQSort3 ( UInt32* ptr, while (True) { if (unLo > unHi) break; n = ((Int32)block[ptr[unHi]+d]) - med; - if (n == 0) { - mswap(ptr[unHi], ptr[gtHi]); - gtHi--; unHi--; continue; + if (n == 0) { + mswap(ptr[unHi], ptr[gtHi]); + gtHi--; unHi--; continue; }; if (n < 0) break; unHi--; @@ -748,9 +748,9 @@ void mainQSort3 ( UInt32* ptr, #define CLEARMASK (~(SETMASK)) static -void mainSort ( UInt32* ptr, +void mainSort ( UInt32* ptr, UChar* block, - UInt16* quadrant, + UInt16* quadrant, UInt32* ftab, Int32 nblock, Int32 verb, @@ -878,7 +878,7 @@ void mainSort ( UInt32* ptr, /*-- Step 1: Complete the big bucket [ss] by quicksorting - any unsorted small buckets [ss, j], for j != ss. + any unsorted small buckets [ss, j], for j != ss. Hopefully previous pointer-scanning phases have already completed many of the small buckets [ss, j], so we don't have to sort them at all. @@ -894,10 +894,10 @@ void mainSort ( UInt32* ptr, VPrintf4 ( " qsort [0x%x, 0x%x] " "done %d this %d\n", ss, j, numQSorted, hi - lo + 1 ); - mainQSort3 ( - ptr, block, quadrant, nblock, - lo, hi, BZ_N_RADIX, budget - ); + mainQSort3 ( + ptr, block, quadrant, nblock, + lo, hi, BZ_N_RADIX, budget + ); numQSorted += (hi - lo + 1); if (*budget < 0) return; } @@ -929,16 +929,16 @@ void mainSort ( UInt32* ptr, for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) { k = ptr[j]-1; if (k < 0) k += nblock; c1 = block[k]; - if (!bigDone[c1]) + if (!bigDone[c1]) ptr[ copyEnd[c1]-- ] = k; } } AssertH ( (copyStart[ss]-1 == copyEnd[ss]) - || + || /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1. - Necessity for this case is demonstrated by compressing - a sequence of approximately 48.5 million of character + Necessity for this case is demonstrated by compressing + a sequence of approximately 48.5 million of character 251; 1.0.0/1.0.1 will then die here. */ (copyStart[ss] == 0 && copyEnd[ss] == nblock-1), 1007 ) @@ -955,7 +955,7 @@ void mainSort ( UInt32* ptr, updating for the last bucket is pointless. The quadrant array provides a way to incrementally - cache sort orderings, as they appear, so as to + cache sort orderings, as they appear, so as to make subsequent comparisons in fullGtU() complete faster. For repetitive blocks this makes a big difference (but not big enough to be able to avoid @@ -965,9 +965,9 @@ void mainSort ( UInt32* ptr, for 0 <= i < nblock and 0 <= j <= nblock - if block[i] != block[j], + if block[i] != block[j], - then the relative values of quadrant[i] and + then the relative values of quadrant[i] and quadrant[j] are meaningless. else { @@ -1030,7 +1030,7 @@ void mainSort ( UInt32* ptr, */ void BZ2_blockSort ( EState* s ) { - UInt32* ptr = s->ptr; + UInt32* ptr = s->ptr; UChar* block = s->block; UInt32* ftab = s->ftab; Int32 nblock = s->nblock; @@ -1054,8 +1054,8 @@ void BZ2_blockSort ( EState* s ) quadrant = (UInt16*)(&(block[i])); /* (wfact-1) / 3 puts the default-factor-30 - transition point at very roughly the same place as - with v0.1 and v0.9.0. + transition point at very roughly the same place as + with v0.1 and v0.9.0. Not that it particularly matters any more, since the resulting compressed stream is now the same regardless of whether or not we use the main sort or fallback sort. @@ -1066,14 +1066,14 @@ void BZ2_blockSort ( EState* s ) budget = budgetInit; mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget ); - if (verb >= 3) + if (verb >= 3) VPrintf3 ( " %d work, %d block, ratio %5.2f\n", budgetInit - budget, - nblock, + nblock, (float)(budgetInit - budget) / - (float)(nblock==0 ? 1 : nblock) ); + (float)(nblock==0 ? 1 : nblock) ); if (budget < 0) { - if (verb >= 2) + if (verb >= 2) VPrintf0 ( " too repetitive; using fallback" " sorting algorithm\n" ); fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); diff --git a/3rdparty/bzip2/bzlib.c b/3rdparty/bzip2/bzlib.c index 3afc812f75..f57b3ccabc 100644 --- a/3rdparty/bzip2/bzlib.c +++ b/3rdparty/bzip2/bzlib.c @@ -11,7 +11,7 @@ bzip2/libbzip2 version 1.0.4 of 20 December 2006 Copyright (C) 1996-2006 Julian Seward - Please read the WARNING, DISCLAIMER and PATENTS sections in the + Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained @@ -40,7 +40,7 @@ #ifndef BZ_NO_STDIO void BZ2_bz__AssertH__fail ( int errcode ) { - fprintf(stderr, + fprintf(stderr, "\n\nbzip2/libbzip2: internal error number %d.\n" "This is a bug in bzip2/libbzip2, %s.\n" "Please report it to me at: jseward@bzip.org. If this happened\n" @@ -145,8 +145,8 @@ Bool isempty_RL ( EState* s ) /*---------------------------------------------------*/ -int BZ_API(BZ2_bzCompressInit) - ( bz_stream* strm, +int BZ_API(BZ2_bzCompressInit) + ( bz_stream* strm, int blockSize100k, int verbosity, int workFactor ) @@ -156,7 +156,7 @@ int BZ_API(BZ2_bzCompressInit) if (!bz_config_ok()) return BZ_CONFIG_ERROR; - if (strm == NULL || + if (strm == NULL || blockSize100k < 1 || blockSize100k > 9 || workFactor < 0 || workFactor > 250) return BZ_PARAM_ERROR; @@ -299,7 +299,7 @@ Bool copy_input_until_stop ( EState* s ) /*-- no input? --*/ if (s->strm->avail_in == 0) break; progress_in = True; - ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); + ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); s->strm->next_in++; s->strm->avail_in--; s->strm->total_in_lo32++; @@ -317,7 +317,7 @@ Bool copy_input_until_stop ( EState* s ) /*-- flush/finish end? --*/ if (s->avail_in_expect == 0) break; progress_in = True; - ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); + ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); s->strm->next_in++; s->strm->avail_in--; s->strm->total_in_lo32++; @@ -363,18 +363,18 @@ Bool handle_compress ( bz_stream* strm ) Bool progress_in = False; Bool progress_out = False; EState* s = strm->state; - + while (True) { if (s->state == BZ_S_OUTPUT) { progress_out |= copy_output_until_stop ( s ); if (s->state_out_pos < s->numZ) break; - if (s->mode == BZ_M_FINISHING && + if (s->mode == BZ_M_FINISHING && s->avail_in_expect == 0 && isempty_RL(s)) break; prepare_new_block ( s ); s->state = BZ_S_INPUT; - if (s->mode == BZ_M_FLUSHING && + if (s->mode == BZ_M_FLUSHING && s->avail_in_expect == 0 && isempty_RL(s)) break; } @@ -423,7 +423,7 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) if (action == BZ_RUN) { progress = handle_compress ( strm ); return progress ? BZ_RUN_OK : BZ_PARAM_ERROR; - } + } else if (action == BZ_FLUSH) { s->avail_in_expect = strm->avail_in; @@ -436,12 +436,12 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) s->mode = BZ_M_FINISHING; goto preswitch; } - else + else return BZ_PARAM_ERROR; case BZ_M_FLUSHING: if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect != s->strm->avail_in) + if (s->avail_in_expect != s->strm->avail_in) return BZ_SEQUENCE_ERROR; progress = handle_compress ( strm ); if (s->avail_in_expect > 0 || !isempty_RL(s) || @@ -451,7 +451,7 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) case BZ_M_FINISHING: if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect != s->strm->avail_in) + if (s->avail_in_expect != s->strm->avail_in) return BZ_SEQUENCE_ERROR; progress = handle_compress ( strm ); if (!progress) return BZ_SEQUENCE_ERROR; @@ -478,7 +478,7 @@ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) if (s->ftab != NULL) BZFREE(s->ftab); BZFREE(strm->state); - strm->state = NULL; + strm->state = NULL; return BZ_OK; } @@ -489,8 +489,8 @@ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) /*---------------------------------------------------*/ /*---------------------------------------------------*/ -int BZ_API(BZ2_bzDecompressInit) - ( bz_stream* strm, +int BZ_API(BZ2_bzDecompressInit) + ( bz_stream* strm, int verbosity, int small ) { @@ -555,34 +555,34 @@ Bool unRLE_obuf_to_output_FAST ( DState* s ) /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; - + /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; - + s->state_out_len = 1; s->state_out_ch = s->k0; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 2; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 3; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; - BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; + BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; s->nblock_used++; } @@ -619,7 +619,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s ) } s_state_out_len_eq_one: { - if (cs_avail_out == 0) { + if (cs_avail_out == 0) { c_state_out_len = 1; goto return_notr; }; *( (UChar*)(cs_next_out) ) = c_state_out_ch; @@ -627,7 +627,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s ) cs_next_out++; cs_avail_out--; } - } + } /* Only caused by corrupt data stream? */ if (c_nblock_used > s_save_nblockPP) return True; @@ -635,25 +635,25 @@ Bool unRLE_obuf_to_output_FAST ( DState* s ) /* can a new run be started? */ if (c_nblock_used == s_save_nblockPP) { c_state_out_len = 0; goto return_notr; - }; + }; c_state_out_ch = c_k0; BZ_GET_FAST_C(k1); c_nblock_used++; - if (k1 != c_k0) { - c_k0 = k1; goto s_state_out_len_eq_one; + if (k1 != c_k0) { + c_k0 = k1; goto s_state_out_len_eq_one; }; - if (c_nblock_used == s_save_nblockPP) + if (c_nblock_used == s_save_nblockPP) goto s_state_out_len_eq_one; - + c_state_out_len = 2; BZ_GET_FAST_C(k1); c_nblock_used++; if (c_nblock_used == s_save_nblockPP) continue; if (k1 != c_k0) { c_k0 = k1; continue; }; - + c_state_out_len = 3; BZ_GET_FAST_C(k1); c_nblock_used++; if (c_nblock_used == s_save_nblockPP) continue; if (k1 != c_k0) { c_k0 = k1; continue; }; - + BZ_GET_FAST_C(k1); c_nblock_used++; c_state_out_len = ((Int32)k1) + 4; BZ_GET_FAST_C(c_k0); c_nblock_used++; @@ -721,37 +721,37 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s ) s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } - + /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; - + s->state_out_len = 1; s->state_out_ch = s->k0; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 2; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 3; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; - BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; + BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; s->nblock_used++; } @@ -770,30 +770,30 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s ) s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } - + /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; - + s->state_out_len = 1; s->state_out_ch = s->k0; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 2; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 3; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + BZ_GET_SMALL(k1); s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; BZ_GET_SMALL(s->k0); s->nblock_used++; @@ -822,14 +822,14 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) if (corrupt) return BZ_DATA_ERROR; if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) { BZ_FINALISE_CRC ( s->calculatedBlockCRC ); - if (s->verbosity >= 3) - VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, + if (s->verbosity >= 3) + VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, s->calculatedBlockCRC ); if (s->verbosity >= 2) VPrintf0 ( "]" ); if (s->calculatedBlockCRC != s->storedBlockCRC) return BZ_DATA_ERROR; - s->calculatedCombinedCRC - = (s->calculatedCombinedCRC << 1) | + s->calculatedCombinedCRC + = (s->calculatedCombinedCRC << 1) | (s->calculatedCombinedCRC >> 31); s->calculatedCombinedCRC ^= s->calculatedBlockCRC; s->state = BZ_X_BLKHDR_1; @@ -841,7 +841,7 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) Int32 r = BZ2_decompress ( s ); if (r == BZ_STREAM_END) { if (s->verbosity >= 3) - VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", + VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", s->storedCombinedCRC, s->calculatedCombinedCRC ); if (s->calculatedCombinedCRC != s->storedCombinedCRC) return BZ_DATA_ERROR; @@ -888,7 +888,7 @@ int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ) if (bzf != NULL) bzf->lastErr = eee; \ } -typedef +typedef struct { FILE* handle; Char buf[BZ_MAX_UNUSED]; @@ -912,10 +912,10 @@ static Bool myfeof ( FILE* f ) /*---------------------------------------------------*/ -BZFILE* BZ_API(BZ2_bzWriteOpen) - ( int* bzerror, - FILE* f, - int blockSize100k, +BZFILE* BZ_API(BZ2_bzWriteOpen) + ( int* bzerror, + FILE* f, + int blockSize100k, int verbosity, int workFactor ) { @@ -947,23 +947,23 @@ BZFILE* BZ_API(BZ2_bzWriteOpen) bzf->strm.opaque = NULL; if (workFactor == 0) workFactor = 30; - ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, + ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, verbosity, workFactor ); if (ret != BZ_OK) { BZ_SETERR(ret); free(bzf); return NULL; }; bzf->strm.avail_in = 0; bzf->initialisedOk = True; - return bzf; + return bzf; } /*---------------------------------------------------*/ void BZ_API(BZ2_bzWrite) - ( int* bzerror, - BZFILE* b, - void* buf, + ( int* bzerror, + BZFILE* b, + void* buf, int len ) { Int32 n, n2, ret; @@ -992,7 +992,7 @@ void BZ_API(BZ2_bzWrite) if (bzf->strm.avail_out < BZ_MAX_UNUSED) { n = BZ_MAX_UNUSED - bzf->strm.avail_out; - n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), + n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), n, bzf->handle ); if (n != n2 || ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; @@ -1006,20 +1006,20 @@ void BZ_API(BZ2_bzWrite) /*---------------------------------------------------*/ void BZ_API(BZ2_bzWriteClose) - ( int* bzerror, - BZFILE* b, + ( int* bzerror, + BZFILE* b, int abandon, unsigned int* nbytes_in, unsigned int* nbytes_out ) { - BZ2_bzWriteClose64 ( bzerror, b, abandon, + BZ2_bzWriteClose64 ( bzerror, b, abandon, nbytes_in, NULL, nbytes_out, NULL ); } void BZ_API(BZ2_bzWriteClose64) - ( int* bzerror, - BZFILE* b, + ( int* bzerror, + BZFILE* b, int abandon, unsigned int* nbytes_in_lo32, unsigned int* nbytes_in_hi32, @@ -1051,7 +1051,7 @@ void BZ_API(BZ2_bzWriteClose64) if (bzf->strm.avail_out < BZ_MAX_UNUSED) { n = BZ_MAX_UNUSED - bzf->strm.avail_out; - n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), + n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), n, bzf->handle ); if (n != n2 || ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; @@ -1083,9 +1083,9 @@ void BZ_API(BZ2_bzWriteClose64) /*---------------------------------------------------*/ -BZFILE* BZ_API(BZ2_bzReadOpen) - ( int* bzerror, - FILE* f, +BZFILE* BZ_API(BZ2_bzReadOpen) + ( int* bzerror, + FILE* f, int verbosity, int small, void* unused, @@ -1096,7 +1096,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen) BZ_SETERR(BZ_OK); - if (f == NULL || + if (f == NULL || (small != 0 && small != 1) || (verbosity < 0 || verbosity > 4) || (unused == NULL && nUnused != 0) || @@ -1107,7 +1107,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen) { BZ_SETERR(BZ_IO_ERROR); return NULL; }; bzf = malloc ( sizeof(bzFile) ); - if (bzf == NULL) + if (bzf == NULL) { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; BZ_SETERR(BZ_OK); @@ -1119,7 +1119,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen) bzf->strm.bzalloc = NULL; bzf->strm.bzfree = NULL; bzf->strm.opaque = NULL; - + while (nUnused > 0) { bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++; unused = ((void*)( 1 + ((UChar*)(unused)) )); @@ -1134,7 +1134,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen) bzf->strm.next_in = bzf->buf; bzf->initialisedOk = True; - return bzf; + return bzf; } @@ -1157,10 +1157,10 @@ void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b ) /*---------------------------------------------------*/ -int BZ_API(BZ2_bzRead) - ( int* bzerror, - BZFILE* b, - void* buf, +int BZ_API(BZ2_bzRead) + ( int* bzerror, + BZFILE* b, + void* buf, int len ) { Int32 n, ret; @@ -1182,11 +1182,11 @@ int BZ_API(BZ2_bzRead) while (True) { - if (ferror(bzf->handle)) + if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return 0; }; if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) { - n = fread ( bzf->buf, sizeof(UChar), + n = fread ( bzf->buf, sizeof(UChar), BZ_MAX_UNUSED, bzf->handle ); if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return 0; }; @@ -1200,7 +1200,7 @@ int BZ_API(BZ2_bzRead) if (ret != BZ_OK && ret != BZ_STREAM_END) { BZ_SETERR(ret); return 0; }; - if (ret == BZ_OK && myfeof(bzf->handle) && + if (ret == BZ_OK && myfeof(bzf->handle) && bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0) { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; }; @@ -1209,7 +1209,7 @@ int BZ_API(BZ2_bzRead) return len - bzf->strm.avail_out; }; if (bzf->strm.avail_out == 0) { BZ_SETERR(BZ_OK); return len; }; - + } return 0; /*not reached*/ @@ -1217,10 +1217,10 @@ int BZ_API(BZ2_bzRead) /*---------------------------------------------------*/ -void BZ_API(BZ2_bzReadGetUnused) - ( int* bzerror, - BZFILE* b, - void** unused, +void BZ_API(BZ2_bzReadGetUnused) + ( int* bzerror, + BZFILE* b, + void** unused, int* nUnused ) { bzFile* bzf = (bzFile*)b; @@ -1243,30 +1243,30 @@ void BZ_API(BZ2_bzReadGetUnused) /*---------------------------------------------------*/ /*---------------------------------------------------*/ -int BZ_API(BZ2_bzBuffToBuffCompress) - ( char* dest, +int BZ_API(BZ2_bzBuffToBuffCompress) + ( char* dest, unsigned int* destLen, - char* source, + char* source, unsigned int sourceLen, - int blockSize100k, - int verbosity, + int blockSize100k, + int verbosity, int workFactor ) { bz_stream strm; int ret; - if (dest == NULL || destLen == NULL || + if (dest == NULL || destLen == NULL || source == NULL || blockSize100k < 1 || blockSize100k > 9 || verbosity < 0 || verbosity > 4 || - workFactor < 0 || workFactor > 250) + workFactor < 0 || workFactor > 250) return BZ_PARAM_ERROR; if (workFactor == 0) workFactor = 30; strm.bzalloc = NULL; strm.bzfree = NULL; strm.opaque = NULL; - ret = BZ2_bzCompressInit ( &strm, blockSize100k, + ret = BZ2_bzCompressInit ( &strm, blockSize100k, verbosity, workFactor ); if (ret != BZ_OK) return ret; @@ -1280,7 +1280,7 @@ int BZ_API(BZ2_bzBuffToBuffCompress) if (ret != BZ_STREAM_END) goto errhandler; /* normal termination */ - *destLen -= strm.avail_out; + *destLen -= strm.avail_out; BZ2_bzCompressEnd ( &strm ); return BZ_OK; @@ -1295,10 +1295,10 @@ int BZ_API(BZ2_bzBuffToBuffCompress) /*---------------------------------------------------*/ -int BZ_API(BZ2_bzBuffToBuffDecompress) - ( char* dest, +int BZ_API(BZ2_bzBuffToBuffDecompress) + ( char* dest, unsigned int* destLen, - char* source, + char* source, unsigned int sourceLen, int small, int verbosity ) @@ -1306,10 +1306,10 @@ int BZ_API(BZ2_bzBuffToBuffDecompress) bz_stream strm; int ret; - if (dest == NULL || destLen == NULL || + if (dest == NULL || destLen == NULL || source == NULL || (small != 0 && small != 1) || - verbosity < 0 || verbosity > 4) + verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; strm.bzalloc = NULL; @@ -1339,11 +1339,11 @@ int BZ_API(BZ2_bzBuffToBuffDecompress) } else { BZ2_bzDecompressEnd ( &strm ); return BZ_OUTBUFF_FULL; - }; + }; errhandler: BZ2_bzDecompressEnd ( &strm ); - return ret; + return ret; } @@ -1395,7 +1395,7 @@ BZFILE * bzopen_or_bzdopen int verbosity = 0; int workFactor = 30; int smallMode = 0; - int nUnused = 0; + int nUnused = 0; if (mode == NULL) return NULL; while (*mode) { @@ -1435,7 +1435,7 @@ BZFILE * bzopen_or_bzdopen if (writing) { /* Guard against total chaos and anarchy -- JRS */ if (blockSize100k < 1) blockSize100k = 1; - if (blockSize100k > 9) blockSize100k = 9; + if (blockSize100k > 9) blockSize100k = 9; bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k, verbosity,workFactor); } else { @@ -1514,7 +1514,7 @@ void BZ_API(BZ2_bzclose) (BZFILE* b) { int bzerr; FILE *fp; - + if (b==NULL) {return;} fp = ((bzFile *)b)->handle; if(((bzFile*)b)->writing){ @@ -1533,7 +1533,7 @@ void BZ_API(BZ2_bzclose) (BZFILE* b) /*---------------------------------------------------*/ /*-- - return last error code + return last error code --*/ static const char *bzerrorstrings[] = { "OK" diff --git a/3rdparty/bzip2/bzlib.h b/3rdparty/bzip2/bzlib.h index fdb0dbe7b0..4a48b52e10 100644 --- a/3rdparty/bzip2/bzlib.h +++ b/3rdparty/bzip2/bzlib.h @@ -11,7 +11,7 @@ bzip2/libbzip2 version 1.0.4 of 20 December 2006 Copyright (C) 1996-2006 Julian Seward - Please read the WARNING, DISCLAIMER and PATENTS sections in the + Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained @@ -45,7 +45,7 @@ extern "C" { #define BZ_OUTBUFF_FULL (-8) #define BZ_CONFIG_ERROR (-9) -typedef +typedef struct { char *next_in; unsigned int avail_in; @@ -62,7 +62,7 @@ typedef void *(*bzalloc)(void *,int,int); void (*bzfree)(void *,void *); void *opaque; - } + } bz_stream; @@ -97,34 +97,34 @@ typedef /*-- Core (low-level) library functions --*/ -BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( - bz_stream* strm, - int blockSize100k, - int verbosity, - int workFactor +BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( + bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor ); -BZ_EXTERN int BZ_API(BZ2_bzCompress) ( - bz_stream* strm, - int action +BZ_EXTERN int BZ_API(BZ2_bzCompress) ( + bz_stream* strm, + int action ); -BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( - bz_stream* strm +BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( + bz_stream* strm ); -BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( - bz_stream *strm, - int verbosity, +BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( + bz_stream *strm, + int verbosity, int small ); -BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( - bz_stream* strm +BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( + bz_stream* strm ); -BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( - bz_stream *strm +BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( + bz_stream *strm ); @@ -136,64 +136,64 @@ BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( typedef void BZFILE; -BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( - int* bzerror, - FILE* f, - int verbosity, +BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( + int* bzerror, + FILE* f, + int verbosity, int small, - void* unused, - int nUnused + void* unused, + int nUnused ); -BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( - int* bzerror, - BZFILE* b +BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( + int* bzerror, + BZFILE* b ); -BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( - int* bzerror, - BZFILE* b, - void** unused, - int* nUnused +BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( + int* bzerror, + BZFILE* b, + void** unused, + int* nUnused ); -BZ_EXTERN int BZ_API(BZ2_bzRead) ( - int* bzerror, - BZFILE* b, - void* buf, - int len +BZ_EXTERN int BZ_API(BZ2_bzRead) ( + int* bzerror, + BZFILE* b, + void* buf, + int len ); -BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( - int* bzerror, - FILE* f, - int blockSize100k, - int verbosity, - int workFactor +BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( + int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor ); -BZ_EXTERN void BZ_API(BZ2_bzWrite) ( - int* bzerror, - BZFILE* b, - void* buf, - int len +BZ_EXTERN void BZ_API(BZ2_bzWrite) ( + int* bzerror, + BZFILE* b, + void* buf, + int len ); -BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in, - unsigned int* nbytes_out +BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out ); -BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in_lo32, - unsigned int* nbytes_in_hi32, - unsigned int* nbytes_out_lo32, +BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, unsigned int* nbytes_out_hi32 ); #endif @@ -201,23 +201,23 @@ BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( /*-- Utility functions --*/ -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( - char* dest, +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( + char* dest, unsigned int* destLen, - char* source, + char* source, unsigned int sourceLen, - int blockSize100k, - int verbosity, - int workFactor + int blockSize100k, + int verbosity, + int workFactor ); -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( - char* dest, +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( + char* dest, unsigned int* destLen, - char* source, + char* source, unsigned int sourceLen, - int small, - int verbosity + int small, + int verbosity ); @@ -244,17 +244,17 @@ BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( int fd, const char *mode ); - + BZ_EXTERN int BZ_API(BZ2_bzread) ( - BZFILE* b, - void* buf, - int len + BZFILE* b, + void* buf, + int len ); BZ_EXTERN int BZ_API(BZ2_bzwrite) ( - BZFILE* b, - void* buf, - int len + BZFILE* b, + void* buf, + int len ); BZ_EXTERN int BZ_API(BZ2_bzflush) ( @@ -266,7 +266,7 @@ BZ_EXTERN void BZ_API(BZ2_bzclose) ( ); BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( - BZFILE *b, + BZFILE *b, int *errnum ); #endif diff --git a/3rdparty/bzip2/bzlib_private.h b/3rdparty/bzip2/bzlib_private.h index d0a05546ef..80865f06c7 100644 --- a/3rdparty/bzip2/bzlib_private.h +++ b/3rdparty/bzip2/bzlib_private.h @@ -11,7 +11,7 @@ bzip2/libbzip2 version 1.0.4 of 20 December 2006 Copyright (C) 1996-2006 Julian Seward - Please read the WARNING, DISCLAIMER and PATENTS sections in the + Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained @@ -51,7 +51,7 @@ typedef unsigned short UInt16; #ifndef __GNUC__ #define __inline__ /* */ -#endif +#endif #ifndef BZ_NO_STDIO @@ -109,7 +109,7 @@ extern void bz_internal_error ( int errcode ); #define BZ_HDR_Z 0x5a /* 'Z' */ #define BZ_HDR_h 0x68 /* 'h' */ #define BZ_HDR_0 0x30 /* '0' */ - + /*-- Constants for the back end. --*/ #define BZ_MAX_ALPHA_SIZE 258 @@ -269,19 +269,19 @@ typedef /*-- externs for compression. --*/ -extern void +extern void BZ2_blockSort ( EState* ); -extern void +extern void BZ2_compressBlock ( EState*, Bool ); -extern void +extern void BZ2_bsInitWrite ( EState* ); -extern void +extern void BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 ); -extern void +extern void BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 ); @@ -425,7 +425,7 @@ typedef Int32 save_N; Int32 save_curr; Int32 save_zt; - Int32 save_zn; + Int32 save_zn; Int32 save_zvec; Int32 save_zj; Int32 save_gSel; @@ -475,13 +475,13 @@ typedef /*-- externs for decompression. --*/ -extern Int32 +extern Int32 BZ2_indexIntoF ( Int32, Int32* ); -extern Int32 +extern Int32 BZ2_decompress ( DState* ); -extern void +extern void BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*, Int32, Int32, Int32 ); diff --git a/3rdparty/bzip2/compress.c b/3rdparty/bzip2/compress.c index d98d5c0bd8..26b671634c 100644 --- a/3rdparty/bzip2/compress.c +++ b/3rdparty/bzip2/compress.c @@ -11,7 +11,7 @@ bzip2/libbzip2 version 1.0.4 of 20 December 2006 Copyright (C) 1996-2006 Julian Seward - Please read the WARNING, DISCLAIMER and PATENTS sections in the + Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained @@ -22,7 +22,7 @@ /* CHANGES 0.9.0 -- original version. 0.9.0a/b -- no changes in this file. - 0.9.0c -- changed setting of nGroups in sendMTFValues() + 0.9.0c -- changed setting of nGroups in sendMTFValues() so as to do a bit better on small files */ @@ -125,11 +125,11 @@ void generateMTFValues ( EState* s ) Int32 wr; Int32 EOB; - /* + /* After sorting (eg, here), s->arr1 [ 0 .. s->nblock-1 ] holds sorted order, and - ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] + ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] holds the original block data. The first thing to do is generate the MTF values, @@ -144,7 +144,7 @@ void generateMTFValues ( EState* s ) (UChar*) (&((UChar*)s->arr2)[s->nblock]) These storage aliases are set up in bzCompressInit(), - except for the last one, which is arranged in + except for the last one, which is arranged in compressBlock(). */ UInt32* ptr = s->ptr; @@ -167,7 +167,7 @@ void generateMTFValues ( EState* s ) ll_i = s->unseqToSeq[block[j]]; AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" ); - if (yy[0] == ll_i) { + if (yy[0] == ll_i) { zPend++; } else { @@ -175,11 +175,11 @@ void generateMTFValues ( EState* s ) zPend--; while (True) { if (zPend & 1) { - mtfv[wr] = BZ_RUNB; wr++; - s->mtfFreq[BZ_RUNB]++; + mtfv[wr] = BZ_RUNB; wr++; + s->mtfFreq[BZ_RUNB]++; } else { - mtfv[wr] = BZ_RUNA; wr++; - s->mtfFreq[BZ_RUNA]++; + mtfv[wr] = BZ_RUNA; wr++; + s->mtfFreq[BZ_RUNA]++; } if (zPend < 2) break; zPend = (zPend - 2) / 2; @@ -213,11 +213,11 @@ void generateMTFValues ( EState* s ) zPend--; while (True) { if (zPend & 1) { - mtfv[wr] = BZ_RUNB; wr++; - s->mtfFreq[BZ_RUNB]++; + mtfv[wr] = BZ_RUNB; wr++; + s->mtfFreq[BZ_RUNB]++; } else { - mtfv[wr] = BZ_RUNA; wr++; - s->mtfFreq[BZ_RUNA]++; + mtfv[wr] = BZ_RUNA; wr++; + s->mtfFreq[BZ_RUNA]++; } if (zPend < 2) break; zPend = (zPend - 2) / 2; @@ -260,7 +260,7 @@ void sendMTFValues ( EState* s ) if (s->verbosity >= 3) VPrintf3( " %d in block, %d after MTF & 1-2 coding, " - "%d+2 syms in use\n", + "%d+2 syms in use\n", s->nblock, s->nMTF, s->nInUse ); alphaSize = s->nInUse+2; @@ -277,7 +277,7 @@ void sendMTFValues ( EState* s ) nGroups = 6; /*--- Generate an initial set of coding tables ---*/ - { + { Int32 nPart, remF, tFreq, aFreq; nPart = nGroups; @@ -292,8 +292,8 @@ void sendMTFValues ( EState* s ) aFreq += s->mtfFreq[ge]; } - if (ge > gs - && nPart != nGroups && nPart != 1 + if (ge > gs + && nPart != nGroups && nPart != 1 && ((nGroups-nPart) % 2 == 1)) { aFreq -= s->mtfFreq[ge]; ge--; @@ -302,21 +302,21 @@ void sendMTFValues ( EState* s ) if (s->verbosity >= 3) VPrintf5( " initial group %d, [%d .. %d], " "has %d syms (%4.1f%%)\n", - nPart, gs, ge, aFreq, + nPart, gs, ge, aFreq, (100.0 * (float)aFreq) / (float)(s->nMTF) ); - + for (v = 0; v < alphaSize; v++) - if (v >= gs && v <= ge) + if (v >= gs && v <= ge) s->len[nPart-1][v] = BZ_LESSER_ICOST; else s->len[nPart-1][v] = BZ_GREATER_ICOST; - + nPart--; gs = ge+1; remF -= aFreq; } } - /*--- + /*--- Iterate up to BZ_N_ITERS times to improve the tables. ---*/ for (iter = 0; iter < BZ_N_ITERS; iter++) { @@ -329,7 +329,7 @@ void sendMTFValues ( EState* s ) /*--- Set up an auxiliary length table which is used to fast-track - the common case (nGroups == 6). + the common case (nGroups == 6). ---*/ if (nGroups == 6) { for (v = 0; v < alphaSize; v++) { @@ -346,10 +346,10 @@ void sendMTFValues ( EState* s ) /*--- Set group start & end marks. --*/ if (gs >= s->nMTF) break; - ge = gs + BZ_G_SIZE - 1; + ge = gs + BZ_G_SIZE - 1; if (ge >= s->nMTF) ge = s->nMTF-1; - /*-- + /*-- Calculate the cost of this group as coded by each of the coding tables. --*/ @@ -386,13 +386,13 @@ void sendMTFValues ( EState* s ) } else { /*--- slow version which correctly handles all situations ---*/ - for (i = gs; i <= ge; i++) { + for (i = gs; i <= ge; i++) { UInt16 icv = mtfv[i]; for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; } } - - /*-- + + /*-- Find the coding table which is best for this group, and record its identity in the selector table. --*/ @@ -404,7 +404,7 @@ void sendMTFValues ( EState* s ) s->selector[nSelectors] = bt; nSelectors++; - /*-- + /*-- Increment the symbol frequencies for the selected table. --*/ if (nGroups == 6 && 50 == ge-gs+1) { @@ -434,7 +434,7 @@ void sendMTFValues ( EState* s ) gs = ge+1; } if (s->verbosity >= 3) { - VPrintf2 ( " pass %d: size is %d, grp uses are ", + VPrintf2 ( " pass %d: size is %d, grp uses are ", iter+1, totc/8 ); for (t = 0; t < nGroups; t++) VPrintf1 ( "%d ", fave[t] ); @@ -444,10 +444,10 @@ void sendMTFValues ( EState* s ) /*-- Recompute the tables based on the accumulated frequencies. --*/ - /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See + /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See comment in huffman.c for details. */ for (t = 0; t < nGroups; t++) - BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), + BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), alphaSize, 17 /*20*/ ); } @@ -487,19 +487,19 @@ void sendMTFValues ( EState* s ) } AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); AssertH ( !(minLen < 1), 3005 ); - BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), + BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), minLen, maxLen, alphaSize ); } /*--- Transmit the mapping table. ---*/ - { + { Bool inUse16[16]; for (i = 0; i < 16; i++) { inUse16[i] = False; for (j = 0; j < 16; j++) if (s->inUse[i * 16 + j]) inUse16[i] = True; } - + nBytes = s->numZ; for (i = 0; i < 16; i++) if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0); @@ -510,7 +510,7 @@ void sendMTFValues ( EState* s ) if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0); } - if (s->verbosity >= 3) + if (s->verbosity >= 3) VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes ); } @@ -518,7 +518,7 @@ void sendMTFValues ( EState* s ) nBytes = s->numZ; bsW ( s, 3, nGroups ); bsW ( s, 15, nSelectors ); - for (i = 0; i < nSelectors; i++) { + for (i = 0; i < nSelectors; i++) { for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1); bsW(s,1,0); } @@ -547,14 +547,14 @@ void sendMTFValues ( EState* s ) gs = 0; while (True) { if (gs >= s->nMTF) break; - ge = gs + BZ_G_SIZE - 1; + ge = gs + BZ_G_SIZE - 1; if (ge >= s->nMTF) ge = s->nMTF-1; AssertH ( s->selector[selCtr] < nGroups, 3006 ); if (nGroups == 6 && 50 == ge-gs+1) { /*--- fast track the common case ---*/ UInt16 mtfv_i; - UChar* s_len_sel_selCtr + UChar* s_len_sel_selCtr = &(s->len[s->selector[selCtr]][0]); Int32* s_code_sel_selCtr = &(s->code[s->selector[selCtr]][0]); @@ -581,7 +581,7 @@ void sendMTFValues ( EState* s ) } else { /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) { - bsW ( s, + bsW ( s, s->len [s->selector[selCtr]] [mtfv[i]], s->code [s->selector[selCtr]] [mtfv[i]] ); } @@ -636,8 +636,8 @@ void BZ2_compressBlock ( EState* s, Bool is_last_block ) /*-- Now the block's CRC, so it is in a known place. --*/ bsPutUInt32 ( s, s->blockCRC ); - /*-- - Now a single bit indicating (non-)randomisation. + /*-- + Now a single bit indicating (non-)randomisation. As of version 0.9.5, we use a better sorting algorithm which makes randomisation unnecessary. So always set the randomised bit to 'no'. Of course, the decoder diff --git a/3rdparty/bzip2/crctable.c b/3rdparty/bzip2/crctable.c index bc7e2ae39d..edcd1031a3 100644 --- a/3rdparty/bzip2/crctable.c +++ b/3rdparty/bzip2/crctable.c @@ -11,7 +11,7 @@ bzip2/libbzip2 version 1.0.4 of 20 December 2006 Copyright (C) 1996-2006 Julian Seward - Please read the WARNING, DISCLAIMER and PATENTS sections in the + Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained diff --git a/3rdparty/bzip2/decompress.c b/3rdparty/bzip2/decompress.c index 124cc8ddc7..129d28bf6d 100644 --- a/3rdparty/bzip2/decompress.c +++ b/3rdparty/bzip2/decompress.c @@ -11,7 +11,7 @@ bzip2/libbzip2 version 1.0.4 of 20 December 2006 Copyright (C) 1996-2006 Julian Seward - Please read the WARNING, DISCLAIMER and PATENTS sections in the + Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained @@ -127,7 +127,7 @@ Int32 BZ2_decompress ( DState* s ) Int32 N; Int32 curr; Int32 zt; - Int32 zn; + Int32 zn; Int32 zvec; Int32 zj; Int32 gSel; @@ -181,7 +181,7 @@ Int32 BZ2_decompress ( DState* s ) N = s->save_N; curr = s->save_curr; zt = s->save_zt; - zn = s->save_zn; + zn = s->save_zn; zvec = s->save_zvec; zj = s->save_zj; gSel = s->save_gSel; @@ -204,14 +204,14 @@ Int32 BZ2_decompress ( DState* s ) if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) - if (s->blockSize100k < (BZ_HDR_0 + 1) || + if (s->blockSize100k < (BZ_HDR_0 + 1) || s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC); s->blockSize100k -= BZ_HDR_0; if (s->smallDecompress) { s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); - s->ll4 = BZALLOC( - ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) + s->ll4 = BZALLOC( + ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) ); if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); } else { @@ -237,7 +237,7 @@ Int32 BZ2_decompress ( DState* s ) s->currBlockNo++; if (s->verbosity >= 2) VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); - + s->storedBlockCRC = 0; GET_UCHAR(BZ_X_BCRC_1, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); @@ -260,14 +260,14 @@ Int32 BZ2_decompress ( DState* s ) if (s->origPtr < 0) RETURN(BZ_DATA_ERROR); - if (s->origPtr > 10 + 100000*s->blockSize100k) + if (s->origPtr > 10 + 100000*s->blockSize100k) RETURN(BZ_DATA_ERROR); /*--- Receive the mapping table ---*/ for (i = 0; i < 16; i++) { GET_BIT(BZ_X_MAPPING_1, uc); - if (uc == 1) - s->inUse16[i] = True; else + if (uc == 1) + s->inUse16[i] = True; else s->inUse16[i] = False; } @@ -303,7 +303,7 @@ Int32 BZ2_decompress ( DState* s ) { UChar pos[BZ_N_GROUPS], tmp, v; for (v = 0; v < nGroups; v++) pos[v] = v; - + for (i = 0; i < nSelectors; i++) { v = s->selectorMtf[i]; tmp = pos[v]; @@ -336,10 +336,10 @@ Int32 BZ2_decompress ( DState* s ) if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; if (s->len[t][i] < minLen) minLen = s->len[t][i]; } - BZ2_hbCreateDecodeTables ( - &(s->limit[t][0]), - &(s->base[t][0]), - &(s->perm[t][0]), + BZ2_hbCreateDecodeTables ( + &(s->limit[t][0]), + &(s->base[t][0]), + &(s->perm[t][0]), &(s->len[t][0]), minLen, maxLen, alphaSize ); @@ -431,23 +431,23 @@ Int32 BZ2_decompress ( DState* s ) s->mtfa[(z)-3] = s->mtfa[(z)-4]; nn -= 4; } - while (nn > 0) { - s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; + while (nn > 0) { + s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; }; s->mtfa[pp] = uc; - } else { + } else { /* general case */ lno = nn / MTFL_SIZE; off = nn % MTFL_SIZE; pp = s->mtfbase[lno] + off; uc = s->mtfa[pp]; - while (pp > s->mtfbase[lno]) { - s->mtfa[pp] = s->mtfa[pp-1]; pp--; + while (pp > s->mtfbase[lno]) { + s->mtfa[pp] = s->mtfa[pp-1]; pp--; }; s->mtfbase[lno]++; while (lno > 0) { s->mtfbase[lno]--; - s->mtfa[s->mtfbase[lno]] + s->mtfa[s->mtfbase[lno]] = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; lno--; } @@ -529,7 +529,7 @@ Int32 BZ2_decompress ( DState* s ) if (s->blockRandomised) { BZ_RAND_INIT_MASK; BZ_GET_SMALL(s->k0); s->nblock_used++; - BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; + BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; } else { BZ_GET_SMALL(s->k0); s->nblock_used++; } @@ -548,7 +548,7 @@ Int32 BZ2_decompress ( DState* s ) if (s->blockRandomised) { BZ_RAND_INIT_MASK; BZ_GET_FAST(s->k0); s->nblock_used++; - BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; + BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; } else { BZ_GET_FAST(s->k0); s->nblock_used++; } @@ -617,7 +617,7 @@ Int32 BZ2_decompress ( DState* s ) s->save_gBase = gBase; s->save_gPerm = gPerm; - return retVal; + return retVal; } diff --git a/3rdparty/bzip2/huffman.c b/3rdparty/bzip2/huffman.c index be4dc024dc..d271c8b36f 100644 --- a/3rdparty/bzip2/huffman.c +++ b/3rdparty/bzip2/huffman.c @@ -11,7 +11,7 @@ bzip2/libbzip2 version 1.0.4 of 20 December 2006 Copyright (C) 1996-2006 Julian Seward - Please read the WARNING, DISCLAIMER and PATENTS sections in the + Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained @@ -60,7 +60,7 @@ /*---------------------------------------------------*/ -void BZ2_hbMakeCodeLengths ( UChar *len, +void BZ2_hbMakeCodeLengths ( UChar *len, Int32 *freq, Int32 alphaSize, Int32 maxLen ) @@ -74,7 +74,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len, Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ]; Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ]; - Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; + Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; for (i = 0; i < alphaSize; i++) weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; @@ -96,7 +96,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len, } AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 ); - + while (nHeap > 1) { n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); @@ -119,7 +119,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len, len[i-1] = j; if (j > maxLen) tooLong = True; } - + if (! tooLong) break; /* 17 Oct 04: keep-going condition for the following loop used diff --git a/3rdparty/bzip2/randtable.c b/3rdparty/bzip2/randtable.c index d186335e0e..4b04adc973 100644 --- a/3rdparty/bzip2/randtable.c +++ b/3rdparty/bzip2/randtable.c @@ -11,7 +11,7 @@ bzip2/libbzip2 version 1.0.4 of 20 December 2006 Copyright (C) 1996-2006 Julian Seward - Please read the WARNING, DISCLAIMER and PATENTS sections in the + Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained @@ -23,58 +23,58 @@ /*---------------------------------------------*/ -Int32 BZ2_rNums[512] = { - 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, - 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, - 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, - 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, - 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, - 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, - 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, - 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, - 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, - 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, - 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, - 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, - 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, - 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, - 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, - 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, - 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, - 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, - 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, - 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, - 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, - 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, - 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, - 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, - 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, - 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, - 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, - 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, - 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, - 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, - 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, - 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, - 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, - 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, - 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, - 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, - 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, - 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, - 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, - 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, - 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, - 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, - 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, - 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, - 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, - 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, - 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, - 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, - 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, - 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, - 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, +Int32 BZ2_rNums[512] = { + 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, + 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, + 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, + 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, + 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, + 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, + 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, + 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, + 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, + 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, + 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, + 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, + 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, + 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, + 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, + 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, + 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, + 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, + 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, + 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, + 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, + 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, + 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, + 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, + 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, + 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, + 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, + 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, + 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, + 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, + 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, + 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, + 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, + 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, + 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, + 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, + 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, + 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, + 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, + 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, + 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, + 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, + 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, + 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, + 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, + 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, + 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, + 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, + 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, + 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, + 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 936, 638 }; diff --git a/3rdparty/glew/glew.c b/3rdparty/glew/glew.c index 24c6a726c3..fd0a05b587 100644 --- a/3rdparty/glew/glew.c +++ b/3rdparty/glew/glew.c @@ -4,24 +4,24 @@ ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without +** +** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: -** -** * Redistributions of source code must retain the above copyright notice, +** +** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. -** * The name of the author may be used to endorse or promote products +** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) @@ -6122,14 +6122,14 @@ static GLboolean _glewInit_GL_WIN_swap_hint (GLEW_CONTEXT_ARG_DEF_INIT) /* ------------------------------------------------------------------------- */ -/* +/* * Search for name in the extensions string. Use of strstr() * is not sufficient because extension names can be prefixes of * other extension names. Could use strtok() but the constant * string returned by glGetString might be in read-only memory. */ GLboolean glewGetExtension (const char* name) -{ +{ GLubyte* p; GLubyte* end; GLuint len = _glewStrLen((const GLubyte*)name); @@ -7977,7 +7977,7 @@ static PFNWGLGETEXTENSIONSSTRINGARBPROC _wglewGetExtensionsStringARB = NULL; static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL; GLboolean wglewGetExtension (const char* name) -{ +{ GLubyte* p; GLubyte* end; GLuint len = _glewStrLen((const GLubyte*)name); @@ -8838,7 +8838,7 @@ static GLboolean _glewInit_GLX_SUN_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) /* ------------------------------------------------------------------------ */ GLboolean glxewGetExtension (const char* name) -{ +{ GLubyte* p; GLubyte* end; GLuint len = _glewStrLen((const GLubyte*)name); diff --git a/3rdparty/libjpeg/jcapimin.c b/3rdparty/libjpeg/jcapimin.c index 563ab42716..61103c122c 100644 --- a/3rdparty/libjpeg/jcapimin.c +++ b/3rdparty/libjpeg/jcapimin.c @@ -36,7 +36,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) if (version != JPEG_LIB_VERSION) ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); if (structsize != SIZEOF(struct jpeg_compress_struct)) - ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, + ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, (int) SIZEOF(struct jpeg_compress_struct), (int) structsize); /* For debugging purposes, we zero the whole master structure. diff --git a/3rdparty/libjpeg/jcarith.c b/3rdparty/libjpeg/jcarith.c index 945a817578..cc22ee3d4c 100644 --- a/3rdparty/libjpeg/jcarith.c +++ b/3rdparty/libjpeg/jcarith.c @@ -215,7 +215,7 @@ finish_pass (j_compress_ptr cinfo) */ LOCAL(void) -arith_encode (j_compress_ptr cinfo, unsigned char *st, int val) +arith_encode (j_compress_ptr cinfo, unsigned char *st, int val) { extern const INT32 jaritab[]; register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy; diff --git a/3rdparty/libjpeg/jchuff.c b/3rdparty/libjpeg/jchuff.c index 0fd578e346..0e6f68e049 100644 --- a/3rdparty/libjpeg/jchuff.c +++ b/3rdparty/libjpeg/jchuff.c @@ -197,7 +197,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(c_derived_tbl)); dtbl = *pdtbl; - + /* Figure C.1: make table of Huffman code length for each symbol */ p = 0; @@ -210,7 +210,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, } huffsize[p] = 0; lastp = p; - + /* Figure C.2: generate the codes themselves */ /* We also validate that the counts represent a legal Huffman code tree. */ @@ -230,7 +230,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, code <<= 1; si++; } - + /* Figure C.3: generate encoding tables */ /* These are code and size indexed by symbol value */ @@ -327,16 +327,16 @@ emit_bits_s (working_state * state, unsigned int code, int size) ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); put_buffer &= (((INT32) 1)<cur.put_buffer; /* and merge with old buffer contents */ - + while (put_bits >= 8) { int c = (int) ((put_buffer >> 16) & 0xFF); - + emit_byte_s(state, c, return FALSE); if (c == 0xFF) { /* need to stuff a zero byte? */ emit_byte_s(state, 0, return FALSE); @@ -369,7 +369,7 @@ emit_bits_e (huff_entropy_ptr entropy, unsigned int code, int size) return; /* do nothing if we're only getting stats */ put_buffer &= (((INT32) 1)< MAX_COEF_BITS+1) ERREXIT(cinfo, JERR_BAD_DCT_COEF); - + /* Count/emit the Huffman-coded symbol for the number of bits */ emit_symbol(entropy, compptr->dc_tbl_no, nbits); - + /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ if (nbits) /* emit_bits rejects calls with size 0 */ @@ -645,9 +645,9 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) block = MCU_data[0]; /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */ - + r = 0; /* r = run length of zeros */ - + for (k = cinfo->Ss; k <= Se; k++) { if ((temp = (*block)[jpeg_natural_order[k]]) == 0) { r++; @@ -820,7 +820,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) } /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */ - + r = 0; /* r = run length of zeros */ BR = 0; /* BR = count of buffered bits added now */ BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */ @@ -1113,13 +1113,13 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, register int temp; register int nbits; register int k, r; - + /* Encode the DC coefficient difference per section F.1.2.1 */ - + temp = block[0] - last_dc_val; if (temp < 0) temp = -temp; - + /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0; while (temp) { @@ -1134,11 +1134,11 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, /* Count the Huffman symbol for the number of bits */ dc_counts[nbits]++; - + /* Encode the AC coefficients per section F.1.2.2 */ - + r = 0; /* r = run length of zeros */ - + for (k = 1; k < DCTSIZE2; k++) { if ((temp = block[jpeg_natural_order[k]]) == 0) { r++; @@ -1148,11 +1148,11 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, ac_counts[0xF0]++; r -= 16; } - + /* Find the number of bits needed for the magnitude of the coefficient */ if (temp < 0) temp = -temp; - + /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 1; /* there must be at least one 1 bit */ while ((temp >>= 1)) @@ -1160,10 +1160,10 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, /* Check for out-of-range coefficient values */ if (nbits > MAX_COEF_BITS) ERREXIT(cinfo, JERR_BAD_DCT_COEF); - + /* Count Huffman symbol for run length / number of bits */ ac_counts[(r << 4) + nbits]++; - + r = 0; } } @@ -1255,7 +1255,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) MEMZERO(codesize, SIZEOF(codesize)); for (i = 0; i < 257; i++) others[i] = -1; /* init links to empty */ - + freq[256] = 1; /* make sure 256 has a nonzero count */ /* Including the pseudo-symbol 256 in the Huffman procedure guarantees * that no real symbol is given code-value of all ones, because 256 @@ -1290,7 +1290,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) /* Done if we've merged everything into one frequency */ if (c2 < 0) break; - + /* Else merge the two counts/trees */ freq[c1] += freq[c2]; freq[c2] = 0; @@ -1301,9 +1301,9 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) c1 = others[c1]; codesize[c1]++; } - + others[c1] = c2; /* chain c2 onto c1's tree branch */ - + /* Increment the codesize of everything in c2's tree branch */ codesize[c2]++; while (others[c2] >= 0) { @@ -1334,13 +1334,13 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) * shortest nonzero BITS entry is converted into a prefix for two code words * one bit longer. */ - + for (i = MAX_CLEN; i > 16; i--) { while (bits[i] > 0) { j = i - 2; /* find length of new prefix to be used */ while (bits[j] == 0) j--; - + bits[i] -= 2; /* remove two symbols */ bits[i-1]++; /* one goes in this length */ bits[j+1] += 2; /* two new symbols in this length */ @@ -1352,10 +1352,10 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) while (bits[i] == 0) /* find largest codelength still in use */ i--; bits[i]--; - + /* Return final symbol counts (only for lengths 0..16) */ MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits)); - + /* Return a list of the symbols sorted by code length */ /* It's not real clear to me why we don't need to consider the codelength * changes made above, but the JPEG spec seems to think this works. diff --git a/3rdparty/libjpeg/jcmarker.c b/3rdparty/libjpeg/jcmarker.c index 54d109a622..05d44e30fa 100644 --- a/3rdparty/libjpeg/jcmarker.c +++ b/3rdparty/libjpeg/jcmarker.c @@ -18,24 +18,24 @@ typedef enum { /* JPEG marker codes */ M_SOF1 = 0xc1, M_SOF2 = 0xc2, M_SOF3 = 0xc3, - + M_SOF5 = 0xc5, M_SOF6 = 0xc6, M_SOF7 = 0xc7, - + M_JPG = 0xc8, M_SOF9 = 0xc9, M_SOF10 = 0xca, M_SOF11 = 0xcb, - + M_SOF13 = 0xcd, M_SOF14 = 0xce, M_SOF15 = 0xcf, - + M_DHT = 0xc4, - + M_DAC = 0xcc, - + M_RST0 = 0xd0, M_RST1 = 0xd1, M_RST2 = 0xd2, @@ -44,7 +44,7 @@ typedef enum { /* JPEG marker codes */ M_RST5 = 0xd5, M_RST6 = 0xd6, M_RST7 = 0xd7, - + M_SOI = 0xd8, M_EOI = 0xd9, M_SOS = 0xda, @@ -53,7 +53,7 @@ typedef enum { /* JPEG marker codes */ M_DRI = 0xdd, M_DHP = 0xde, M_EXP = 0xdf, - + M_APP0 = 0xe0, M_APP1 = 0xe1, M_APP2 = 0xe2, @@ -70,13 +70,13 @@ typedef enum { /* JPEG marker codes */ M_APP13 = 0xed, M_APP14 = 0xee, M_APP15 = 0xef, - + M_JPG0 = 0xf0, M_JPG13 = 0xfd, M_COM = 0xfe, - + M_TEM = 0x01, - + M_ERROR = 0x100 } JPEG_MARKER; @@ -186,7 +186,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) { JHUFF_TBL * htbl; int length, i; - + if (is_ac) { htbl = cinfo->ac_huff_tbl_ptrs[index]; index += 0x10; /* output index has AC bit set */ @@ -196,23 +196,23 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) if (htbl == NULL) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index); - + if (! htbl->sent_table) { emit_marker(cinfo, M_DHT); - + length = 0; for (i = 1; i <= 16; i++) length += htbl->bits[i]; - + emit_2bytes(cinfo, length + 2 + 1 + 16); emit_byte(cinfo, index); - + for (i = 1; i <= 16; i++) emit_byte(cinfo, htbl->bits[i]); - + for (i = 0; i < length; i++) emit_byte(cinfo, htbl->huffval[i]); - + htbl->sent_table = TRUE; } } @@ -229,24 +229,24 @@ emit_dac (j_compress_ptr cinfo) char ac_in_use[NUM_ARITH_TBLS]; int length, i; jpeg_component_info *compptr; - + for (i = 0; i < NUM_ARITH_TBLS; i++) dc_in_use[i] = ac_in_use[i] = 0; - + for (i = 0; i < cinfo->comps_in_scan; i++) { compptr = cinfo->cur_comp_info[i]; dc_in_use[compptr->dc_tbl_no] = 1; ac_in_use[compptr->ac_tbl_no] = 1; } - + length = 0; for (i = 0; i < NUM_ARITH_TBLS; i++) length += dc_in_use[i] + ac_in_use[i]; - + emit_marker(cinfo, M_DAC); - + emit_2bytes(cinfo, length*2 + 2); - + for (i = 0; i < NUM_ARITH_TBLS; i++) { if (dc_in_use[i]) { emit_byte(cinfo, i); @@ -266,7 +266,7 @@ emit_dri (j_compress_ptr cinfo) /* Emit a DRI marker */ { emit_marker(cinfo, M_DRI); - + emit_2bytes(cinfo, 4); /* fixed length */ emit_2bytes(cinfo, (int) cinfo->restart_interval); @@ -279,9 +279,9 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) { int ci; jpeg_component_info *compptr; - + emit_marker(cinfo, code); - + emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ /* Make sure image isn't bigger than SOF field can handle */ @@ -310,13 +310,13 @@ emit_sos (j_compress_ptr cinfo) { int i, td, ta; jpeg_component_info *compptr; - + emit_marker(cinfo, M_SOS); - + emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */ - + emit_byte(cinfo, cinfo->comps_in_scan); - + for (i = 0; i < cinfo->comps_in_scan; i++) { compptr = cinfo->cur_comp_info[i]; emit_byte(cinfo, compptr->component_id); @@ -360,9 +360,9 @@ emit_jfif_app0 (j_compress_ptr cinfo) * Thumbnail X size (1 byte) * Thumbnail Y size (1 byte) */ - + emit_marker(cinfo, M_APP0); - + emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */ emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */ @@ -399,9 +399,9 @@ emit_adobe_app14 (j_compress_ptr cinfo) * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with * whether the encoder performed a transformation, which is pretty useless. */ - + emit_marker(cinfo, M_APP14); - + emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */ emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */ @@ -496,7 +496,7 @@ write_frame_header (j_compress_ptr cinfo) int ci, prec; boolean is_baseline; jpeg_component_info *compptr; - + /* Emit DQT for each quantization table. * Note that emit_dqt() suppresses any duplicate tables. */ diff --git a/3rdparty/libjpeg/jcmaster.c b/3rdparty/libjpeg/jcmaster.c index db3e61a295..67c565f327 100644 --- a/3rdparty/libjpeg/jcmaster.c +++ b/3rdparty/libjpeg/jcmaster.c @@ -8,7 +8,7 @@ * * This file contains master control logic for the JPEG compressor. * These routines are concerned with parameter validation, initial setup, - * and inter-pass control (determining the number of passes and the work + * and inter-pass control (determining the number of passes and the work * to be done in each pass). */ @@ -333,7 +333,7 @@ validate_script (j_compress_ptr cinfo) #ifdef C_PROGRESSIVE_SUPPORTED cinfo->progressive_mode = TRUE; last_bitpos_ptr = & last_bitpos[0][0]; - for (ci = 0; ci < cinfo->num_components; ci++) + for (ci = 0; ci < cinfo->num_components; ci++) for (coefi = 0; coefi < DCTSIZE2; coefi++) *last_bitpos_ptr++ = -1; #else @@ -341,7 +341,7 @@ validate_script (j_compress_ptr cinfo) #endif } else { cinfo->progressive_mode = FALSE; - for (ci = 0; ci < cinfo->num_components; ci++) + for (ci = 0; ci < cinfo->num_components; ci++) component_sent[ci] = FALSE; } @@ -491,16 +491,16 @@ per_scan_setup (j_compress_ptr cinfo) { int ci, mcublks, tmp; jpeg_component_info *compptr; - + if (cinfo->comps_in_scan == 1) { - + /* Noninterleaved (single-component) scan */ compptr = cinfo->cur_comp_info[0]; - + /* Overall image size in MCUs */ cinfo->MCUs_per_row = compptr->width_in_blocks; cinfo->MCU_rows_in_scan = compptr->height_in_blocks; - + /* For noninterleaved scan, always one block per MCU */ compptr->MCU_width = 1; compptr->MCU_height = 1; @@ -513,18 +513,18 @@ per_scan_setup (j_compress_ptr cinfo) tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); if (tmp == 0) tmp = compptr->v_samp_factor; compptr->last_row_height = tmp; - + /* Prepare array describing MCU composition */ cinfo->blocks_in_MCU = 1; cinfo->MCU_membership[0] = 0; - + } else { - + /* Interleaved (multi-component) scan */ if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, MAX_COMPS_IN_SCAN); - + /* Overall image size in MCUs */ cinfo->MCUs_per_row = (JDIMENSION) jdiv_round_up((long) cinfo->jpeg_width, @@ -532,9 +532,9 @@ per_scan_setup (j_compress_ptr cinfo) cinfo->MCU_rows_in_scan = (JDIMENSION) jdiv_round_up((long) cinfo->jpeg_height, (long) (cinfo->max_v_samp_factor*DCTSIZE)); - + cinfo->blocks_in_MCU = 0; - + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* Sampling factors give # of blocks of component in each MCU */ @@ -557,7 +557,7 @@ per_scan_setup (j_compress_ptr cinfo) cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; } } - + } /* Convert restart specified in rows to actual MCU count. */ diff --git a/3rdparty/libjpeg/jcparam.c b/3rdparty/libjpeg/jcparam.c index c5e85dda55..e974fec994 100644 --- a/3rdparty/libjpeg/jcparam.c +++ b/3rdparty/libjpeg/jcparam.c @@ -204,12 +204,12 @@ std_huff_tables (j_compress_ptr cinfo) { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; static const UINT8 val_dc_luminance[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; - + static const UINT8 bits_dc_chrominance[17] = { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; static const UINT8 val_dc_chrominance[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; - + static const UINT8 bits_ac_luminance[17] = { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; static const UINT8 val_ac_luminance[] = @@ -234,7 +234,7 @@ std_huff_tables (j_compress_ptr cinfo) 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa }; - + static const UINT8 bits_ac_chrominance[17] = { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; static const UINT8 val_ac_chrominance[] = @@ -259,7 +259,7 @@ std_huff_tables (j_compress_ptr cinfo) 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa }; - + add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0], bits_dc_luminance, val_dc_luminance); add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0], diff --git a/3rdparty/libjpeg/jdapimin.c b/3rdparty/libjpeg/jdapimin.c index a55498f7c9..2ade61329d 100644 --- a/3rdparty/libjpeg/jdapimin.c +++ b/3rdparty/libjpeg/jdapimin.c @@ -37,7 +37,7 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) if (version != JPEG_LIB_VERSION) ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); if (structsize != SIZEOF(struct jpeg_decompress_struct)) - ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, + ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize); /* For debugging purposes, we zero the whole master structure. @@ -122,7 +122,7 @@ default_decompress_parms (j_decompress_ptr cinfo) cinfo->jpeg_color_space = JCS_GRAYSCALE; cinfo->out_color_space = JCS_GRAYSCALE; break; - + case 3: if (cinfo->saw_JFIF_marker) { cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */ @@ -157,7 +157,7 @@ default_decompress_parms (j_decompress_ptr cinfo) /* Always guess RGB is proper output colorspace. */ cinfo->out_color_space = JCS_RGB; break; - + case 4: if (cinfo->saw_Adobe_marker) { switch (cinfo->Adobe_transform) { @@ -178,7 +178,7 @@ default_decompress_parms (j_decompress_ptr cinfo) } cinfo->out_color_space = JCS_CMYK; break; - + default: cinfo->jpeg_color_space = JCS_UNKNOWN; cinfo->out_color_space = JCS_UNKNOWN; diff --git a/3rdparty/libjpeg/jdarith.c b/3rdparty/libjpeg/jdarith.c index 702950fc76..605f47069e 100644 --- a/3rdparty/libjpeg/jdarith.c +++ b/3rdparty/libjpeg/jdarith.c @@ -755,7 +755,7 @@ jinit_arith_decoder (j_decompress_ptr cinfo) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->num_components*DCTSIZE2*SIZEOF(int)); coef_bit_ptr = & cinfo->coef_bits[0][0]; - for (ci = 0; ci < cinfo->num_components; ci++) + for (ci = 0; ci < cinfo->num_components; ci++) for (i = 0; i < DCTSIZE2; i++) *coef_bit_ptr++ = -1; } diff --git a/3rdparty/libjpeg/jdct.h b/3rdparty/libjpeg/jdct.h index 360dec80c9..832c2cfee3 100644 --- a/3rdparty/libjpeg/jdct.h +++ b/3rdparty/libjpeg/jdct.h @@ -8,7 +8,7 @@ * This include file contains common declarations for the forward and * inverse DCT modules. These declarations are private to the DCT managers * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms. - * The individual DCT algorithms are kept in separate files to ease + * The individual DCT algorithms are kept in separate files to ease * machine-dependent tuning (e.g., assembly coding). */ diff --git a/3rdparty/libjpeg/jdhuff.c b/3rdparty/libjpeg/jdhuff.c index a5d679ec1e..79af0fa301 100644 --- a/3rdparty/libjpeg/jdhuff.c +++ b/3rdparty/libjpeg/jdhuff.c @@ -304,7 +304,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, SIZEOF(d_derived_tbl)); dtbl = *pdtbl; dtbl->pub = htbl; /* fill in back link */ - + /* Figure C.1: make table of Huffman code length for each symbol */ p = 0; @@ -317,10 +317,10 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, } huffsize[p] = 0; numsymbols = p; - + /* Figure C.2: generate the codes themselves */ /* We also validate that the counts represent a legal Huffman code tree. */ - + code = 0; si = huffsize[0]; p = 0; @@ -625,7 +625,7 @@ process_restart (j_decompress_ptr cinfo) /* * Huffman MCU decoding. * Each of these routines decodes and returns one MCU's worth of - * Huffman-compressed coefficients. + * Huffman-compressed coefficients. * The coefficients are reordered from zigzag order into natural array order, * but are not dequantized. * @@ -647,7 +647,7 @@ process_restart (j_decompress_ptr cinfo) METHODDEF(boolean) decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ +{ huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; int Al = cinfo->Al; register int s, r; @@ -718,7 +718,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) METHODDEF(boolean) decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ +{ huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; int Se = cinfo->Se; int Al = cinfo->Al; @@ -803,7 +803,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) METHODDEF(boolean) decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ +{ huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ int blkn; @@ -852,7 +852,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) METHODDEF(boolean) decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ +{ huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; int Se = cinfo->Se; int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ diff --git a/3rdparty/libjpeg/jdinput.c b/3rdparty/libjpeg/jdinput.c index 08a9b374ba..319419dc31 100644 --- a/3rdparty/libjpeg/jdinput.c +++ b/3rdparty/libjpeg/jdinput.c @@ -127,16 +127,16 @@ per_scan_setup (j_decompress_ptr cinfo) { int ci, mcublks, tmp; jpeg_component_info *compptr; - + if (cinfo->comps_in_scan == 1) { - + /* Noninterleaved (single-component) scan */ compptr = cinfo->cur_comp_info[0]; - + /* Overall image size in MCUs */ cinfo->MCUs_per_row = compptr->width_in_blocks; cinfo->MCU_rows_in_scan = compptr->height_in_blocks; - + /* For noninterleaved scan, always one block per MCU */ compptr->MCU_width = 1; compptr->MCU_height = 1; @@ -149,18 +149,18 @@ per_scan_setup (j_decompress_ptr cinfo) tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); if (tmp == 0) tmp = compptr->v_samp_factor; compptr->last_row_height = tmp; - + /* Prepare array describing MCU composition */ cinfo->blocks_in_MCU = 1; cinfo->MCU_membership[0] = 0; - + } else { - + /* Interleaved (multi-component) scan */ if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, MAX_COMPS_IN_SCAN); - + /* Overall image size in MCUs */ cinfo->MCUs_per_row = (JDIMENSION) jdiv_round_up((long) cinfo->image_width, @@ -168,9 +168,9 @@ per_scan_setup (j_decompress_ptr cinfo) cinfo->MCU_rows_in_scan = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, (long) (cinfo->max_v_samp_factor*DCTSIZE)); - + cinfo->blocks_in_MCU = 0; - + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* Sampling factors give # of blocks of component in each MCU */ @@ -193,7 +193,7 @@ per_scan_setup (j_decompress_ptr cinfo) cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; } } - + } } diff --git a/3rdparty/libjpeg/jdmarker.c b/3rdparty/libjpeg/jdmarker.c index f4cca8cc83..d11b1e6e5e 100644 --- a/3rdparty/libjpeg/jdmarker.c +++ b/3rdparty/libjpeg/jdmarker.c @@ -22,24 +22,24 @@ typedef enum { /* JPEG marker codes */ M_SOF1 = 0xc1, M_SOF2 = 0xc2, M_SOF3 = 0xc3, - + M_SOF5 = 0xc5, M_SOF6 = 0xc6, M_SOF7 = 0xc7, - + M_JPG = 0xc8, M_SOF9 = 0xc9, M_SOF10 = 0xca, M_SOF11 = 0xcb, - + M_SOF13 = 0xcd, M_SOF14 = 0xce, M_SOF15 = 0xcf, - + M_DHT = 0xc4, - + M_DAC = 0xcc, - + M_RST0 = 0xd0, M_RST1 = 0xd1, M_RST2 = 0xd2, @@ -48,7 +48,7 @@ typedef enum { /* JPEG marker codes */ M_RST5 = 0xd5, M_RST6 = 0xd6, M_RST7 = 0xd7, - + M_SOI = 0xd8, M_EOI = 0xd9, M_SOS = 0xda, @@ -57,7 +57,7 @@ typedef enum { /* JPEG marker codes */ M_DRI = 0xdd, M_DHP = 0xde, M_EXP = 0xdf, - + M_APP0 = 0xe0, M_APP1 = 0xe1, M_APP2 = 0xe2, @@ -74,13 +74,13 @@ typedef enum { /* JPEG marker codes */ M_APP13 = 0xed, M_APP14 = 0xee, M_APP15 = 0xef, - + M_JPG0 = 0xf0, M_JPG13 = 0xfd, M_COM = 0xfe, - + M_TEM = 0x01, - + M_ERROR = 0x100 } JPEG_MARKER; @@ -198,7 +198,7 @@ get_soi (j_decompress_ptr cinfo) /* Process an SOI marker */ { int i; - + TRACEMS(cinfo, 1, JTRC_SOI); if (cinfo->marker->saw_SOI) @@ -275,7 +275,7 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->num_components * SIZEOF(jpeg_component_info)); - + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { compptr->component_index = ci; @@ -325,7 +325,7 @@ get_sos (j_decompress_ptr cinfo) for (i = 0; i < n; i++) { INPUT_BYTE(cinfo, cc, return FALSE); INPUT_BYTE(cinfo, c, return FALSE); - + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { if (cc == compptr->component_id) @@ -339,7 +339,7 @@ get_sos (j_decompress_ptr cinfo) cinfo->cur_comp_info[i] = compptr; compptr->dc_tbl_no = (c >> 4) & 15; compptr->ac_tbl_no = (c ) & 15; - + TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, compptr->dc_tbl_no, compptr->ac_tbl_no); } @@ -379,7 +379,7 @@ get_dac (j_decompress_ptr cinfo) INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; - + while (length > 0) { INPUT_BYTE(cinfo, index, return FALSE); INPUT_BYTE(cinfo, val, return FALSE); @@ -428,12 +428,12 @@ get_dht (j_decompress_ptr cinfo) INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; - + while (length > 16) { INPUT_BYTE(cinfo, index, return FALSE); TRACEMS1(cinfo, 1, JTRC_DHT, index); - + bits[0] = 0; count = 0; for (i = 1; i <= 16; i++) { @@ -473,7 +473,7 @@ get_dht (j_decompress_ptr cinfo) if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); - + MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval)); } @@ -508,7 +508,7 @@ get_dqt (j_decompress_ptr cinfo) if (n >= NUM_QUANT_TBLS) ERREXIT1(cinfo, JERR_DQT_INDEX, n); - + if (cinfo->quant_tbl_ptrs[n] == NULL) cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo); quant_ptr = cinfo->quant_tbl_ptrs[n]; @@ -553,7 +553,7 @@ get_dri (j_decompress_ptr cinfo) INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return FALSE); - + if (length != 4) ERREXIT(cinfo, JERR_BAD_LENGTH); @@ -850,7 +850,7 @@ skip_variable (j_decompress_ptr cinfo) INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; - + TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length); INPUT_SYNC(cinfo); /* do before skip_input_data */ @@ -1013,32 +1013,32 @@ read_markers (j_decompress_ptr cinfo) return JPEG_SUSPENDED; cinfo->unread_marker = 0; /* processed the marker */ return JPEG_REACHED_SOS; - + case M_EOI: TRACEMS(cinfo, 1, JTRC_EOI); cinfo->unread_marker = 0; /* processed the marker */ return JPEG_REACHED_EOI; - + case M_DAC: if (! get_dac(cinfo)) return JPEG_SUSPENDED; break; - + case M_DHT: if (! get_dht(cinfo)) return JPEG_SUSPENDED; break; - + case M_DQT: if (! get_dqt(cinfo)) return JPEG_SUSPENDED; break; - + case M_DRI: if (! get_dri(cinfo)) return JPEG_SUSPENDED; break; - + case M_APP0: case M_APP1: case M_APP2: @@ -1059,7 +1059,7 @@ read_markers (j_decompress_ptr cinfo) cinfo->unread_marker - (int) M_APP0]) (cinfo)) return JPEG_SUSPENDED; break; - + case M_COM: if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo)) return JPEG_SUSPENDED; @@ -1193,10 +1193,10 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) { int marker = cinfo->unread_marker; int action = 1; - + /* Always put up a warning. */ WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired); - + /* Outer loop handles repeated decision after scanning forward. */ for (;;) { if (marker < (int) M_SOF0) diff --git a/3rdparty/libjpeg/jdmaster.c b/3rdparty/libjpeg/jdmaster.c index 04f8312cfd..c37eb55409 100644 --- a/3rdparty/libjpeg/jdmaster.c +++ b/3rdparty/libjpeg/jdmaster.c @@ -330,7 +330,7 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) * For most steps we can mathematically guarantee that the initial value * of x is within MAXJSAMPLE+1 of the legal range, so a table running from * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial - * limiting step (just after the IDCT), a wildly out-of-range value is + * limiting step (just after the IDCT), a wildly out-of-range value is * possible if the input data is corrupt. To avoid any chance of indexing * off the end of memory and getting a bad-pointer trap, we perform the * post-IDCT limiting thus: diff --git a/3rdparty/libjpeg/jdsample.c b/3rdparty/libjpeg/jdsample.c index 7bc8885b02..1be3f72558 100644 --- a/3rdparty/libjpeg/jdsample.c +++ b/3rdparty/libjpeg/jdsample.c @@ -119,7 +119,7 @@ sep_upsample (j_decompress_ptr cinfo, /* Not more than the distance to the end of the image. Need this test * in case the image height is not a multiple of max_v_samp_factor: */ - if (num_rows > upsample->rows_to_go) + if (num_rows > upsample->rows_to_go) num_rows = upsample->rows_to_go; /* And not more than what the client can accept: */ out_rows_avail -= *out_row_ctr; diff --git a/3rdparty/libjpeg/jidctflt.c b/3rdparty/libjpeg/jidctflt.c index 0188ce3dfc..9a49eb3a73 100644 --- a/3rdparty/libjpeg/jidctflt.c +++ b/3rdparty/libjpeg/jidctflt.c @@ -95,14 +95,14 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ - + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - + wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; @@ -111,13 +111,13 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; - + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } - + /* Even part */ tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); @@ -135,7 +135,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; - + /* Odd part */ tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); @@ -172,7 +172,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, quantptr++; wsptr++; } - + /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3. */ @@ -184,7 +184,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, * the simplification applies less often (typically 5% to 10% of the time). * And testing floats for zero is relatively expensive, so we don't bother. */ - + /* Even part */ tmp10 = wsptr[0] + wsptr[4]; @@ -234,7 +234,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, & RANGE_MASK]; outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3) & RANGE_MASK]; - + wsptr += DCTSIZE; /* advance pointer to next row */ } } diff --git a/3rdparty/libjpeg/jidctfst.c b/3rdparty/libjpeg/jidctfst.c index dba4216fb9..af3f7733d0 100644 --- a/3rdparty/libjpeg/jidctfst.c +++ b/3rdparty/libjpeg/jidctfst.c @@ -196,7 +196,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ - + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && @@ -212,13 +212,13 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; - + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } - + /* Even part */ tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); @@ -236,7 +236,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; - + /* Odd part */ tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); @@ -273,7 +273,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, quantptr++; wsptr++; } - + /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ @@ -288,14 +288,14 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, * test takes more time than it's worth. In that case this section * may be commented out. */ - + #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) & RANGE_MASK]; - + outptr[0] = dcval; outptr[1] = dcval; outptr[2] = dcval; @@ -309,7 +309,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, continue; } #endif - + /* Even part */ tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); diff --git a/3rdparty/libjpeg/jidctint.c b/3rdparty/libjpeg/jidctint.c index dcdf7ce454..07096b1081 100644 --- a/3rdparty/libjpeg/jidctint.c +++ b/3rdparty/libjpeg/jidctint.c @@ -225,7 +225,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ - + z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); @@ -256,7 +256,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - + z2 = tmp0 + tmp2; z3 = tmp1 + tmp3; @@ -288,7 +288,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*5] = (int) RIGHT_SHIFT(tmp12 - tmp1, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*3] = (int) RIGHT_SHIFT(tmp13 + tmp0, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*4] = (int) RIGHT_SHIFT(tmp13 - tmp0, CONST_BITS-PASS1_BITS); - + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; @@ -332,7 +332,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ - + z2 = (INT32) wsptr[2]; z3 = (INT32) wsptr[6]; @@ -346,7 +346,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp0 = (z2 + z3) << CONST_BITS; tmp1 = (z2 - z3) << CONST_BITS; - + tmp10 = tmp0 + tmp2; tmp13 = tmp0 - tmp2; tmp11 = tmp1 + tmp3; @@ -835,7 +835,7 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); - + tmp10 = (tmp0 + tmp2) << PASS1_BITS; tmp12 = (tmp0 - tmp2) << PASS1_BITS; @@ -2851,14 +2851,14 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ - + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; - + wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; @@ -2867,23 +2867,23 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; - + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } - + /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ - + z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - + z1 = MULTIPLY(z2 + z3, FIX_0_541196100); tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); - + z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); z2 <<= CONST_BITS; @@ -2893,21 +2893,21 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp0 = z2 + z3; tmp1 = z2 - z3; - + tmp10 = tmp0 + tmp2; tmp13 = tmp0 - tmp2; tmp11 = tmp1 + tmp3; tmp12 = tmp1 - tmp3; - + /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ - + tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - + z2 = tmp0 + tmp2; z3 = tmp1 + tmp3; @@ -2928,9 +2928,9 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp1 += z1 + z3; tmp2 += z1 + z2; - + /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - + wsptr[DCTSIZE*0] = (int) RIGHT_SHIFT(tmp10 + tmp3, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*7] = (int) RIGHT_SHIFT(tmp10 - tmp3, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*1] = (int) RIGHT_SHIFT(tmp11 + tmp2, CONST_BITS-PASS1_BITS); @@ -2939,7 +2939,7 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*5] = (int) RIGHT_SHIFT(tmp12 - tmp1, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*3] = (int) RIGHT_SHIFT(tmp13 + tmp0, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*4] = (int) RIGHT_SHIFT(tmp13 - tmp0, CONST_BITS-PASS1_BITS); - + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; @@ -3688,18 +3688,18 @@ jpeg_idct_8x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, z2 = (INT32) wsptr[2]; z3 = (INT32) wsptr[6]; - + z1 = MULTIPLY(z2 + z3, FIX_0_541196100); tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); - + /* Add fudge factor here for final descale. */ z2 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); z3 = (INT32) wsptr[4]; - + tmp0 = (z2 + z3) << CONST_BITS; tmp1 = (z2 - z3) << CONST_BITS; - + tmp10 = tmp0 + tmp2; tmp13 = tmp0 - tmp2; tmp11 = tmp1 + tmp3; @@ -3819,7 +3819,7 @@ jpeg_idct_6x3 (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[6*2] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); wsptr[6*1] = (int) RIGHT_SHIFT(tmp2, CONST_BITS-PASS1_BITS); } - + /* Pass 2: process 3 rows from work array, store into output array. * 6-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/12). */ @@ -4134,7 +4134,7 @@ jpeg_idct_8x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[8*7] = (int) RIGHT_SHIFT(tmp27 + tmp13, CONST_BITS-PASS1_BITS); wsptr[8*8] = (int) RIGHT_SHIFT(tmp27 - tmp13, CONST_BITS-PASS1_BITS); } - + /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ @@ -4142,38 +4142,38 @@ jpeg_idct_8x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr = workspace; for (ctr = 0; ctr < 16; ctr++) { outptr = output_buf[ctr] + output_col; - + /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ - + z2 = (INT32) wsptr[2]; z3 = (INT32) wsptr[6]; - + z1 = MULTIPLY(z2 + z3, FIX_0_541196100); tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); - + /* Add fudge factor here for final descale. */ z2 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); z3 = (INT32) wsptr[4]; - + tmp0 = (z2 + z3) << CONST_BITS; tmp1 = (z2 - z3) << CONST_BITS; - + tmp10 = tmp0 + tmp2; tmp13 = tmp0 - tmp2; tmp11 = tmp1 + tmp3; tmp12 = tmp1 - tmp3; - + /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ - + tmp0 = (INT32) wsptr[7]; tmp1 = (INT32) wsptr[5]; tmp2 = (INT32) wsptr[3]; tmp3 = (INT32) wsptr[1]; - + z2 = tmp0 + tmp2; z3 = tmp1 + tmp3; @@ -4194,9 +4194,9 @@ jpeg_idct_8x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp1 += z1 + z3; tmp2 += z1 + z2; - + /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - + outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp3, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; @@ -4221,7 +4221,7 @@ jpeg_idct_8x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp13 - tmp0, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; - + wsptr += DCTSIZE; /* advance pointer to next row */ } } @@ -4794,11 +4794,11 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - + z1 = MULTIPLY(z2 + z3, FIX_0_541196100); tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); - + z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); z2 <<= CONST_BITS; @@ -4808,7 +4808,7 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp0 = z2 + z3; tmp1 = z2 - z3; - + tmp10 = tmp0 + tmp2; tmp13 = tmp0 - tmp2; tmp11 = tmp1 + tmp3; @@ -4900,7 +4900,7 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS+PASS1_BITS+3) & RANGE_MASK]; - + wsptr += 4; /* advance pointer to next row */ } } @@ -5116,7 +5116,7 @@ jpeg_idct_1x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; /* Even part */ - + tmp10 = DEQUANTIZE(coef_block[DCTSIZE*0], quantptr[DCTSIZE*0]); /* Add fudge factor here for final descale. */ tmp10 += ONE << 2; diff --git a/3rdparty/libjpeg/jmemmgr.c b/3rdparty/libjpeg/jmemmgr.c index d801b322da..06a4ad24c1 100644 --- a/3rdparty/libjpeg/jmemmgr.c +++ b/3rdparty/libjpeg/jmemmgr.c @@ -238,13 +238,13 @@ out_of_memory (j_common_ptr cinfo, int which) * machines, but may be too small if longs are 64 bits or more. */ -static const size_t first_pool_slop[JPOOL_NUMPOOLS] = +static const size_t first_pool_slop[JPOOL_NUMPOOLS] = { 1600, /* first PERMANENT pool */ 16000 /* first IMAGE pool */ }; -static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = +static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = { 0, /* additional PERMANENT pools */ 5000 /* additional IMAGE pools */ diff --git a/3rdparty/libjpeg/jpeglib.h b/3rdparty/libjpeg/jpeglib.h index 341a19c9a3..b03d031210 100644 --- a/3rdparty/libjpeg/jpeglib.h +++ b/3rdparty/libjpeg/jpeglib.h @@ -135,9 +135,9 @@ typedef struct { /* The decompressor output side may not use these variables. */ int dc_tbl_no; /* DC entropy table selector (0..3) */ int ac_tbl_no; /* AC entropy table selector (0..3) */ - + /* Remaining fields should be treated as private by applications. */ - + /* These values are computed during compression or decompression startup: */ /* Component's size in DCT blocks. * Any dummy blocks added to complete an MCU are not counted; therefore @@ -367,7 +367,7 @@ struct jpeg_compress_struct { UINT16 X_density; /* Horizontal pixel density */ UINT16 Y_density; /* Vertical pixel density */ boolean write_Adobe_marker; /* should an Adobe marker be written? */ - + /* State variable: index of next scanline to be written to * jpeg_write_scanlines(). Application may use this to control its * processing loop, e.g., "while (next_scanline < image_height)". @@ -395,7 +395,7 @@ struct jpeg_compress_struct { * There are v_samp_factor * DCTSIZE sample rows of each component in an * "iMCU" (interleaved MCU) row. */ - + /* * These fields are valid during any one scan. * They describe the components and MCUs actually appearing in the scan. @@ -403,10 +403,10 @@ struct jpeg_compress_struct { int comps_in_scan; /* # of JPEG components in this scan */ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; /* *cur_comp_info[i] describes component that appears i'th in SOS */ - + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ - + int blocks_in_MCU; /* # of DCT blocks per MCU */ int MCU_membership[C_MAX_BLOCKS_IN_MCU]; /* MCU_membership[i] is index in cur_comp_info of component owning */ @@ -678,7 +678,7 @@ struct jpeg_error_mgr { #define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ /* Reset error state variables at start of a new image */ JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); - + /* The message ID code and any parameters are saved here. * A message can have one string parameter or up to 8 int parameters. */ @@ -688,11 +688,11 @@ struct jpeg_error_mgr { int i[8]; char s[JMSG_STR_PARM_MAX]; } msg_parm; - + /* Standard state variables for error facility */ - + int trace_level; /* max msg_level that will be displayed */ - + /* For recoverable corrupt-data errors, we emit a warning message, * but keep going unless emit_message chooses to abort. emit_message * should count warnings in num_warnings. The surrounding application @@ -850,7 +850,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); /* Short forms of external names for systems with brain-damaged linkers. * We shorten external names to be unique in the first six letters, which * is good enough for all known systems. - * (If your compiler itself needs names to be unique in less than 15 + * (If your compiler itself needs names to be unique in less than 15 * characters, you are out of luck. Get a better compiler.) */ diff --git a/3rdparty/libjpeg/jquant1.c b/3rdparty/libjpeg/jquant1.c index b2f96aa15d..a32629beae 100644 --- a/3rdparty/libjpeg/jquant1.c +++ b/3rdparty/libjpeg/jquant1.c @@ -424,7 +424,7 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) /* * Create the ordered-dither tables. - * Components having the same number of representative colors may + * Components having the same number of representative colors may * share a dither table. */ diff --git a/3rdparty/libjpeg/jquant2.c b/3rdparty/libjpeg/jquant2.c index af601e334b..85eb4c3616 100644 --- a/3rdparty/libjpeg/jquant2.c +++ b/3rdparty/libjpeg/jquant2.c @@ -41,7 +41,7 @@ * color space, and repeatedly splits the "largest" remaining box until we * have as many boxes as desired colors. Then the mean color in each * remaining box becomes one of the possible output colors. - * + * * The second pass over the image maps each input pixel to the closest output * color (optionally after applying a Floyd-Steinberg dithering correction). * This mapping is logically trivial, but making it go fast enough requires @@ -278,7 +278,7 @@ find_biggest_color_pop (boxptr boxlist, int numboxes) register int i; register long maxc = 0; boxptr which = NULL; - + for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { if (boxp->colorcount > maxc && boxp->volume > 0) { which = boxp; @@ -298,7 +298,7 @@ find_biggest_volume (boxptr boxlist, int numboxes) register int i; register INT32 maxv = 0; boxptr which = NULL; - + for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { if (boxp->volume > maxv) { which = boxp; @@ -321,11 +321,11 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) int c0min,c0max,c1min,c1max,c2min,c2max; INT32 dist0,dist1,dist2; long ccount; - + c0min = boxp->c0min; c0max = boxp->c0max; c1min = boxp->c1min; c1max = boxp->c1max; c2min = boxp->c2min; c2max = boxp->c2max; - + if (c0max > c0min) for (c0 = c0min; c0 <= c0max; c0++) for (c1 = c1min; c1 <= c1max; c1++) { @@ -405,7 +405,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE; dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE; boxp->volume = dist0*dist0 + dist1*dist1 + dist2*dist2; - + /* Now scan remaining volume of box and compute population */ ccount = 0; for (c0 = c0min; c0 <= c0max; c0++) @@ -511,11 +511,11 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) long c0total = 0; long c1total = 0; long c2total = 0; - + c0min = boxp->c0min; c0max = boxp->c0max; c1min = boxp->c1min; c1max = boxp->c1max; c2min = boxp->c2min; c2max = boxp->c2max; - + for (c0 = c0min; c0 <= c0max; c0++) for (c1 = c1min; c1 <= c1max; c1++) { histp = & histogram[c0][c1][c2min]; @@ -528,7 +528,7 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) } } } - + cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total); cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total); cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total); @@ -797,17 +797,17 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, bptr = bestdist; for (i = BOX_C0_ELEMS*BOX_C1_ELEMS*BOX_C2_ELEMS-1; i >= 0; i--) *bptr++ = 0x7FFFFFFFL; - + /* For each color selected by find_nearby_colors, * compute its distance to the center of each cell in the box. * If that's less than best-so-far, update best distance and color number. */ - + /* Nominal steps between cell centers ("x" in Thomas article) */ #define STEP_C0 ((1 << C0_SHIFT) * C0_SCALE) #define STEP_C1 ((1 << C1_SHIFT) * C1_SCALE) #define STEP_C2 ((1 << C2_SHIFT) * C2_SCALE) - + for (i = 0; i < numcolors; i++) { icolor = GETJSAMPLE(colorlist[i]); /* Compute (square of) distance from minc0/c1/c2 to this color */ @@ -881,7 +881,7 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1); minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1); minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1); - + /* Determine which colormap entries are close enough to be candidates * for the nearest entry to some cell in the update box. */ diff --git a/3rdparty/portaudio/include/pa_asio.h b/3rdparty/portaudio/include/pa_asio.h index 64d1bd4e7c..a06ce766e4 100644 --- a/3rdparty/portaudio/include/pa_asio.h +++ b/3rdparty/portaudio/include/pa_asio.h @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -59,7 +59,7 @@ extern "C" @param minLatency A pointer to the location which will recieve the minimum latency value. @param maxLatency A pointer to the location which will recieve the maximum latency value. @param preferredLatency A pointer to the location which will recieve the preferred latency value. - @param granularity A pointer to the location which will recieve the granularity. This value + @param granularity A pointer to the location which will recieve the granularity. This value determines which values between minLatency and maxLatency are available. ie the step size, if granularity is -1 then available latency settings are powers of two. @@ -70,7 +70,7 @@ extern "C" PaError PaAsio_GetAvailableLatencyValues( PaDeviceIndex device, long *minLatency, long *maxLatency, long *preferredLatency, long *granularity ); - + /** Display the ASIO control panel for the specified device. @param device The global index of the device whose control panel is to be displayed. @@ -90,7 +90,7 @@ PaError PaAsio_ShowControlPanel( PaDeviceIndex device, void* systemSpecific ); PaError PaAsio_GetInputChannelName( PaDeviceIndex device, int channelIndex, const char** channelName ); - + /** Retrieve a pointer to a string containing the name of the specified input channel. The string is valid until Pa_Terminate is called. @@ -101,11 +101,11 @@ PaError PaAsio_GetOutputChannelName( PaDeviceIndex device, int channelIndex, /** Set the sample rate of an open paASIO stream. - - @param stream The stream to operate on. - @param sampleRate The new sample rate. - Note that this function may fail if the stream is alredy running and the + @param stream The stream to operate on. + @param sampleRate The new sample rate. + + Note that this function may fail if the stream is alredy running and the ASIO driver does not support switching the sample rate of a running stream. Returns paIncompatibleStreamHostApi if stream is not a paASIO stream. diff --git a/3rdparty/portaudio/include/pa_jack.h b/3rdparty/portaudio/include/pa_jack.h index ba2aeb9c08..9e66ca0494 100644 --- a/3rdparty/portaudio/include/pa_jack.h +++ b/3rdparty/portaudio/include/pa_jack.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/include/pa_linux_alsa.h b/3rdparty/portaudio/include/pa_linux_alsa.h index de89ae9bff..e3e0e8920c 100644 --- a/3rdparty/portaudio/include/pa_linux_alsa.h +++ b/3rdparty/portaudio/include/pa_linux_alsa.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/include/pa_mac_core.h b/3rdparty/portaudio/include/pa_mac_core.h index b0921b3c73..600d8afe54 100644 --- a/3rdparty/portaudio/include/pa_mac_core.h +++ b/3rdparty/portaudio/include/pa_mac_core.h @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -64,8 +64,8 @@ typedef struct PaHostApiTypeId hostApiType; /**host API for which this data is intended */ unsigned long version; /**structure version */ unsigned long flags; /* flags to modify behaviour */ - SInt32 const * channelMap; /* Channel map for HAL channel mapping , if not needed, use NULL;*/ - unsigned long channelMapSize; /* Channel map size for HAL channel mapping , if not needed, use 0;*/ + SInt32 const * channelMap; /* Channel map for HAL channel mapping , if not needed, use NULL;*/ + unsigned long channelMapSize; /* Channel map size for HAL channel mapping , if not needed, use 0;*/ } PaMacCoreStreamInfo; /* @@ -96,7 +96,7 @@ void PaMacCore_SetupChannelMap( PaMacCoreStreamInfo *data, const SInt32 * const * @return A valid AudioDeviceID, or NULL if an error occurred. */ AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s ); - + /* * Retrieve the AudioDeviceID of the output device assigned to an open stream * diff --git a/3rdparty/portaudio/include/pa_win_ds.h b/3rdparty/portaudio/include/pa_win_ds.h index a0a71dc75a..d1377a7168 100644 --- a/3rdparty/portaudio/include/pa_win_ds.h +++ b/3rdparty/portaudio/include/pa_win_ds.h @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -83,7 +83,7 @@ typedef struct PaWinDirectSoundStreamInfo{ /* support for WAVEFORMATEXTENSIBLE channel masks. If flags contains - paWinDirectSoundUseChannelMask this allows you to specify which speakers + paWinDirectSoundUseChannelMask this allows you to specify which speakers to address in a multichannel stream. Constants for channelMask are specified in pa_win_waveformat.h @@ -98,4 +98,4 @@ typedef struct PaWinDirectSoundStreamInfo{ } #endif /* __cplusplus */ -#endif /* PA_WIN_DS_H */ +#endif /* PA_WIN_DS_H */ diff --git a/3rdparty/portaudio/include/pa_win_wasapi.h b/3rdparty/portaudio/include/pa_win_wasapi.h index 92ecbed974..9f47a28c86 100644 --- a/3rdparty/portaudio/include/pa_win_wasapi.h +++ b/3rdparty/portaudio/include/pa_win_wasapi.h @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -69,7 +69,7 @@ typedef enum PaWasapiFlags method can only provide 15-20ms latency. */ paWinWasapiPolling = (1 << 3), - /* forces custom thread priority setting. must be used if PaWasapiStreamInfo::threadPriority + /* forces custom thread priority setting. must be used if PaWasapiStreamInfo::threadPriority is set to custom value. */ paWinWasapiThreadPriority = (1 << 4) } @@ -81,7 +81,7 @@ PaWasapiFlags; #define paWinWasapiThreadPriority (paWinWasapiThreadPriority) -/* Host processor. Allows to skip internal PA processing completely. +/* Host processor. Allows to skip internal PA processing completely. You must set paWinWasapiRedirectHostProcessor flag to PaWasapiStreamInfo::flags member in order to have host processor redirected to your callback. Use with caution! inputFrames and outputFrames depend solely on final device setup (buffer @@ -125,7 +125,7 @@ PaWasapiThreadPriority; /* Stream descriptor. */ -typedef struct PaWasapiStreamInfo +typedef struct PaWasapiStreamInfo { unsigned long size; /**< sizeof(PaWasapiStreamInfo) */ PaHostApiTypeId hostApiType; /**< paWASAPI */ @@ -134,16 +134,16 @@ typedef struct PaWasapiStreamInfo unsigned long flags; /**< collection of PaWasapiFlags */ /* Support for WAVEFORMATEXTENSIBLE channel masks. If flags contains - paWinWasapiUseChannelMask this allows you to specify which speakers + paWinWasapiUseChannelMask this allows you to specify which speakers to address in a multichannel stream. Constants for channelMask - are specified in pa_win_waveformat.h. Will be used only if + are specified in pa_win_waveformat.h. Will be used only if paWinWasapiUseChannelMask flag is specified. */ PaWinWaveFormatChannelMask channelMask; - /* Delivers raw data to callback obtained from GetBuffer() methods skipping - internal PortAudio processing inventory completely. userData parameter will - be the same that was passed to Pa_OpenStream method. Will be used only if + /* Delivers raw data to callback obtained from GetBuffer() methods skipping + internal PortAudio processing inventory completely. userData parameter will + be the same that was passed to Pa_OpenStream method. Will be used only if paWinWasapiRedirectHostProcessor flag is specified. */ PaWasapiHostProcessorCallback hostProcessorOutput; @@ -157,11 +157,11 @@ typedef struct PaWasapiStreamInfo to setup thread priority. */ PaWasapiThreadPriority threadPriority; -} +} PaWasapiStreamInfo; -/** Returns default sound format for device. Format is represented by PaWinWaveFormat or +/** Returns default sound format for device. Format is represented by PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure. @param pFormat pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure. @@ -191,7 +191,7 @@ int/*PaWasapiDeviceRole*/ PaWasapi_GetDeviceRole( PaDeviceIndex nDevice ); @param hTask a handle to pointer to priority task. Must be used with PaWasapi_RevertThreadPriority method to revert thread priority to initial state. - @param nPriorityClass an Id of thread priority of PaWasapiThreadPriority type. Specifying + @param nPriorityClass an Id of thread priority of PaWasapiThreadPriority type. Specifying eThreadPriorityNone does nothing. @return Error code indicating success or failure. @@ -214,8 +214,8 @@ PaError PaWasapi_ThreadPriorityRevert( void *hTask ); IMPORTANT: WASAPI is implemented for Callback and Blocking interfaces. It supports Shared and Exclusive - share modes. - + share modes. + Exclusive Mode: Exclusive mode allows to deliver audio data directly to hardware bypassing @@ -224,20 +224,20 @@ PaError PaWasapi_ThreadPriorityRevert( void *hTask ); Callback Interface: - Provides best audio quality with low latency. Callback interface is implemented in + Provides best audio quality with low latency. Callback interface is implemented in two versions: 1) Event-Driven: This is the most powerful WASAPI implementation which is capable to provides glitch-free - audio at 2ms latency in Exclusive mode. Lowest possible latency for this mode is - usually - 2ms for HD Audio class audio chips (including on-board audio, 2ms was achieved + audio at 2ms latency in Exclusive mode. Lowest possible latency for this mode is + usually - 2ms for HD Audio class audio chips (including on-board audio, 2ms was achieved on Realtek ALC888/S/T). For Shared mode latency can not go lower than 20ms. 2) Poll-Driven: Polling is another 2-nd method to operate with WASAPI. It is less efficient than Event-Driven and provides latency at around 12-13ms. Polling must be used to overcome a system bug under Windows Vista x64 when application is WOW64(32-bit) and Event-Driven method simply times - out (event handle is never signalled on buffer completion). Please note, such Vista bug + out (event handle is never signalled on buffer completion). Please note, such Vista bug does not exist in Windows 7 x64. Polling is setup by speciying 'paWinWasapiPolling' flag. Thread priority can be boosted by specifying 'paWinWasapiBlockingThreadPriorityPro' flag. @@ -245,19 +245,19 @@ PaError PaWasapi_ThreadPriorityRevert( void *hTask ); Blocking Interface: Blocking interface is implemented but due to above described Poll-Driven method can not - deliver low latency audio. Specifying too low latency in Shared mode will result in + deliver low latency audio. Specifying too low latency in Shared mode will result in distorted audio although Exclusive mode adds stability. Pa_IsFormatSupported: To check format with correct Share Mode (Exclusive/Shared) you must supply - PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of + PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of PaStreamParameters::hostApiSpecificStreamInfo structure. Pa_OpenStream: To set desired Share Mode (Exclusive/Shared) you must supply - PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of + PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of PaStreamParameters::hostApiSpecificStreamInfo structure. */ @@ -265,4 +265,4 @@ PaError PaWasapi_ThreadPriorityRevert( void *hTask ); } #endif /* __cplusplus */ -#endif /* PA_WIN_WASAPI_H */ +#endif /* PA_WIN_WASAPI_H */ diff --git a/3rdparty/portaudio/include/pa_win_waveformat.h b/3rdparty/portaudio/include/pa_win_waveformat.h index 2c00267117..43124a158f 100644 --- a/3rdparty/portaudio/include/pa_win_waveformat.h +++ b/3rdparty/portaudio/include/pa_win_waveformat.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -125,11 +125,11 @@ typedef unsigned long PaWinWaveFormatChannelMask; /* PaWinWaveFormat is defined here to provide compatibility with - compilation environments which don't have headers defining + compilation environments which don't have headers defining WAVEFORMATEXTENSIBLE (e.g. older versions of MSVC, Borland C++ etc. The fields for WAVEFORMATEX and WAVEFORMATEXTENSIBLE are declared as an - unsigned char array here to avoid clients who include this file having + unsigned char array here to avoid clients who include this file having a dependency on windows.h and mmsystem.h, and also to to avoid having to write separate packing pragmas for each compiler. */ @@ -138,18 +138,18 @@ typedef unsigned long PaWinWaveFormatChannelMask; typedef struct{ unsigned char fields[ PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE ]; - unsigned long extraLongForAlignment; /* ensure that compiler aligns struct to DWORD */ + unsigned long extraLongForAlignment; /* ensure that compiler aligns struct to DWORD */ } PaWinWaveFormat; /* WAVEFORMATEXTENSIBLE fields: - + union { - WORD wValidBitsPerSample; - WORD wSamplesPerBlock; - WORD wReserved; + WORD wValidBitsPerSample; + WORD wSamplesPerBlock; + WORD wReserved; } Samples; - DWORD dwChannelMask; + DWORD dwChannelMask; GUID SubFormat; */ @@ -179,11 +179,11 @@ int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat ); Use the following two functions to initialize the waveformat structure. */ -void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat, +void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat, int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate ); -void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat, +void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat, int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate, PaWinWaveFormatChannelMask channelMask ); @@ -196,4 +196,4 @@ PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels ); } #endif /* __cplusplus */ -#endif /* PA_WIN_WAVEFORMAT_H */ \ No newline at end of file +#endif /* PA_WIN_WAVEFORMAT_H */ diff --git a/3rdparty/portaudio/include/pa_win_wmme.h b/3rdparty/portaudio/include/pa_win_wmme.h index deffd1006f..45987773d8 100644 --- a/3rdparty/portaudio/include/pa_win_wmme.h +++ b/3rdparty/portaudio/include/pa_win_wmme.h @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -53,7 +53,7 @@ extern "C" #endif /* __cplusplus */ -/* The following are flags which can be set in +/* The following are flags which can be set in PaWinMmeStreamInfo's flags field. */ @@ -101,7 +101,7 @@ typedef struct PaWinMmeStreamInfo{ Pa_OpenStream(). */ unsigned long framesPerBuffer; - unsigned long bufferCount; /* formerly numBuffers */ + unsigned long bufferCount; /* formerly numBuffers */ /* multiple devices per direction support If flags contains the PaWinMmeUseMultipleDevices flag, @@ -119,7 +119,7 @@ typedef struct PaWinMmeStreamInfo{ /* support for WAVEFORMATEXTENSIBLE channel masks. If flags contains - paWinMmeUseChannelMask this allows you to specify which speakers + paWinMmeUseChannelMask this allows you to specify which speakers to address in a multichannel stream. Constants for channelMask are specified in pa_win_waveformat.h @@ -156,7 +156,7 @@ HWAVEIN PaWinMME_GetStreamInputHandle( PaStream* stream, int handleIndex ); /** Retrieve the number of wave out handles used by a PortAudio WinMME stream. Returns zero if the stream is input only. - + @return A non-negative value indicating the number of wave out handles or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered. @@ -183,4 +183,4 @@ HWAVEOUT PaWinMME_GetStreamOutputHandle( PaStream* stream, int handleIndex ); } #endif /* __cplusplus */ -#endif /* PA_WIN_WMME_H */ +#endif /* PA_WIN_WMME_H */ diff --git a/3rdparty/portaudio/include/portaudio.h b/3rdparty/portaudio/include/portaudio.h index 89964ab3e2..d3a44bbdb5 100644 --- a/3rdparty/portaudio/include/portaudio.h +++ b/3rdparty/portaudio/include/portaudio.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -50,7 +50,7 @@ extern "C" { #endif /* __cplusplus */ - + /** Retrieve the release number of the currently running PortAudio build, eg 1900. */ @@ -116,9 +116,9 @@ const char *Pa_GetErrorText( PaError errorCode ); and Pa_GetErrorText(), this function MUST be called before using any other PortAudio API functions. - If Pa_Initialize() is called multiple times, each successful - call must be matched with a corresponding call to Pa_Terminate(). - Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not + If Pa_Initialize() is called multiple times, each successful + call must be matched with a corresponding call to Pa_Terminate(). + Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not required to be fully nested. Note that if Pa_Initialize() returns an error code, Pa_Terminate() should @@ -145,7 +145,7 @@ PaError Pa_Initialize( void ); @return paNoError if successful, otherwise an error code indicating the cause of failure. - + @see Pa_Initialize */ PaError Pa_Terminate( void ); @@ -269,7 +269,7 @@ typedef struct PaHostApiInfo if no default output device is available. */ PaDeviceIndex defaultOutputDevice; - + } PaHostApiInfo; @@ -298,7 +298,7 @@ const PaHostApiInfo * Pa_GetHostApiInfo( PaHostApiIndex hostApi ); @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered. - + The paHostApiNotFound error code indicates that the host API specified by the type parameter is not available. @@ -325,7 +325,7 @@ PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type ); A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter is out of range. - + @see PaHostApiInfo */ PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi, @@ -401,7 +401,7 @@ PaDeviceIndex Pa_GetDefaultOutputDevice( void ); /** The type used to represent monotonic time in seconds that can be used for syncronisation. The type is used for the outTime argument to the PaStreamCallback and as the result of Pa_GetStreamTime(). - + @see PaStreamCallback, Pa_GetStreamTime */ typedef double PaTime; @@ -447,7 +447,7 @@ typedef struct PaDeviceInfo int structVersion; /* this is struct version 2 */ const char *name; PaHostApiIndex hostApi; /* note this is a host API index, not a type id*/ - + int maxInputChannels; int maxOutputChannels; @@ -489,7 +489,7 @@ typedef struct PaStreamParameters This field must not be set to paNoDevice. */ PaDeviceIndex device; - + /** The number of channels of sound to be delivered to the stream callback or accessed by Pa_ReadStream() or Pa_WriteStream(). It can range from 1 to the value of maxInputChannels in the @@ -564,9 +564,9 @@ PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters, A single PaStream can provide multiple channels of real-time streaming audio input and output to a client application. A stream provides access to audio hardware represented by one or more - PaDevices. Depending on the underlying Host API, it may be possible - to open multiple streams using the same device, however this behavior - is implementation defined. Portable applications should assume that + PaDevices. Depending on the underlying Host API, it may be possible + to open multiple streams using the same device, however this behavior + is implementation defined. Portable applications should assume that a PaDevice may be simultaneously used by at most one PaStream. Pointers to PaStream objects are passed between PortAudio functions that @@ -624,7 +624,7 @@ typedef unsigned long PaStreamFlags; /** Call the stream callback to fill initial output buffers, rather than the default behavior of priming the buffers with zeros (silence). This flag has no effect for input-only and blocking read/write streams. - + @see PaStreamFlags */ #define paPrimeOutputBuffersUsingStreamCallback ((PaStreamFlags) 0x00000008) @@ -703,11 +703,11 @@ typedef enum PaStreamCallbackResult Functions of type PaStreamCallback are implemented by PortAudio clients. They consume, process or generate audio in response to requests from an active PortAudio stream. - + @param input and @param output are arrays of interleaved samples, the format, packing and number of channels used by the buffers are determined by parameters to Pa_OpenStream(). - + @param frameCount The number of sample frames to be processed by the stream callback. @@ -752,10 +752,10 @@ typedef int PaStreamCallback( /** Opens a stream for either input, output or both. - + @param stream The address of a PaStream pointer which will receive a pointer to the newly opened stream. - + @param inputParameters A structure that describes the input parameters used by the opened stream. See PaStreamParameters for a description of these parameters. inputParameters must be NULL for output-only streams. @@ -763,10 +763,10 @@ typedef int PaStreamCallback( @param outputParameters A structure that describes the output parameters used by the opened stream. See PaStreamParameters for a description of these parameters. outputParameters must be NULL for input-only streams. - + @param sampleRate The desired sampleRate. For full-duplex streams it is the sample rate for both input and output - + @param framesPerBuffer The number of frames passed to the stream callback function, or the preferred block granularity for a blocking read/write stream. The special value paFramesPerBufferUnspecified (0) may be used to request that @@ -778,11 +778,11 @@ typedef int PaStreamCallback( will be kept to the theoretical minimum however, it is strongly recommended that a non-zero framesPerBuffer value only be used when your algorithm requires a fixed number of frames per stream callback. - + @param streamFlags Flags which modify the behaviour of the streaming process. This parameter may contain a combination of flags ORed together. Some flags may only be relevant to certain buffer formats. - + @param streamCallback A pointer to a client supplied function that is responsible for processing and filling input and output buffers. If this parameter is NULL the stream will be opened in 'blocking read/write' mode. In blocking mode, @@ -795,7 +795,7 @@ typedef int PaStreamCallback( function. It could for example, contain a pointer to instance data necessary for processing the audio buffers. This parameter is ignored if streamCallback is NULL. - + @return Upon success Pa_OpenStream() returns paNoError and places a pointer to a valid PaStream in the stream argument. The stream is inactive (stopped). @@ -820,7 +820,7 @@ PaError Pa_OpenStream( PaStream** stream, @param stream The address of a PaStream pointer which will receive a pointer to the newly opened stream. - + @param numInputChannels The number of channels of sound that will be supplied to the stream callback or returned by Pa_ReadStream. It can range from 1 to the value of maxInputChannels in the PaDeviceInfo record for the default input @@ -835,7 +835,7 @@ PaError Pa_OpenStream( PaStream** stream, provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. sampleFormat may be any of the formats described by the PaSampleFormat enumeration. - + @param sampleRate Same as Pa_OpenStream parameter of the same name. @param framesPerBuffer Same as Pa_OpenStream parameter of the same name. @param streamCallback Same as Pa_OpenStream parameter of the same name. @@ -861,7 +861,7 @@ PaError Pa_OpenDefaultStream( PaStream** stream, PaError Pa_CloseStream( PaStream *stream ); -/** Functions of type PaStreamFinishedCallback are implemented by PortAudio +/** Functions of type PaStreamFinishedCallback are implemented by PortAudio clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback function. Once registered they are called when the stream becomes inactive (ie once a call to Pa_StopStream() will not block). @@ -870,7 +870,7 @@ PaError Pa_CloseStream( PaStream *stream ); output, if the stream callback returns paComplete, or Pa_StopStream is called, the stream finished callback will not be called until all generated sample data has been played. - + @param userData The userData parameter supplied to Pa_OpenStream() @see Pa_SetStreamFinishedCallback @@ -878,12 +878,12 @@ PaError Pa_CloseStream( PaStream *stream ); typedef void PaStreamFinishedCallback( void *userData ); -/** Register a stream finished callback function which will be called when the - stream becomes inactive. See the description of PaStreamFinishedCallback for +/** Register a stream finished callback function which will be called when the + stream becomes inactive. See the description of PaStreamFinishedCallback for further details about when the callback will be called. @param stream a pointer to a PaStream that is in the stopped state - if the - stream is not stopped, the stream's finished callback will remain unchanged + stream is not stopped, the stream's finished callback will remain unchanged and an error code will be returned. @param streamFinishedCallback a pointer to a function with the same signature @@ -896,7 +896,7 @@ typedef void PaStreamFinishedCallback( void *userData ); @see PaStreamFinishedCallback */ -PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); +PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); /** Commences audio processing. @@ -981,7 +981,7 @@ typedef struct PaStreamInfo parameter passed to Pa_OpenStream(). */ double sampleRate; - + } PaStreamInfo; @@ -1004,7 +1004,7 @@ const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream ); /** Determine the current time for the stream according to the same clock used to generate buffer timestamps. This time may be used for syncronising other events to the audio stream, for example synchronizing audio to MIDI. - + @return The stream's current time in seconds, or 0 if an error occurred. @see PaTime, PaStreamCallback @@ -1019,7 +1019,7 @@ PaTime Pa_GetStreamTime( PaStream *stream ); This function may be called from the stream callback function or the application. - + @return A floating point value, typically between 0.0 and 1.0, where 1.0 indicates that the stream callback is consuming the maximum number of CPU cycles possible @@ -1036,7 +1036,7 @@ double Pa_GetStreamCpuLoad( PaStream* stream ); system to supply the data. @param stream A pointer to an open stream previously created with Pa_OpenStream. - + @param buffer A pointer to a buffer of sample frames. The buffer contains samples in the format specified by the inputParameters->sampleFormat field used to open the stream, and the number of channels specified by diff --git a/3rdparty/portaudio/pablio/pablio.c b/3rdparty/portaudio/pablio/pablio.c index 494702e9f6..a07ac6e901 100644 --- a/3rdparty/portaudio/pablio/pablio.c +++ b/3rdparty/portaudio/pablio/pablio.c @@ -30,13 +30,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/pablio/pablio.h b/3rdparty/portaudio/pablio/pablio.h index d996a03429..e411b298f1 100644 --- a/3rdparty/portaudio/pablio/pablio.h +++ b/3rdparty/portaudio/pablio/pablio.h @@ -39,13 +39,13 @@ extern "C" */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/pablio/test_rw.c b/3rdparty/portaudio/pablio/test_rw.c index d717b9a07c..a4b9539bcc 100644 --- a/3rdparty/portaudio/pablio/test_rw.c +++ b/3rdparty/portaudio/pablio/test_rw.c @@ -31,13 +31,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/pablio/test_rw_echo.c b/3rdparty/portaudio/pablio/test_rw_echo.c index 3738c9e6b6..ddd3b4bfc3 100644 --- a/3rdparty/portaudio/pablio/test_rw_echo.c +++ b/3rdparty/portaudio/pablio/test_rw_echo.c @@ -36,13 +36,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/pablio/test_w_saw.c b/3rdparty/portaudio/pablio/test_w_saw.c index 42a3d4fb9e..ff84f12c88 100644 --- a/3rdparty/portaudio/pablio/test_w_saw.c +++ b/3rdparty/portaudio/pablio/test_w_saw.c @@ -32,13 +32,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/pablio/test_w_saw8.c b/3rdparty/portaudio/pablio/test_w_saw8.c index dc0e00f062..55123c83d1 100644 --- a/3rdparty/portaudio/pablio/test_w_saw8.c +++ b/3rdparty/portaudio/pablio/test_w_saw8.c @@ -32,13 +32,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/common/pa_allocation.c b/3rdparty/portaudio/src/common/pa_allocation.c index c78c2cf7e2..efbef010d2 100644 --- a/3rdparty/portaudio/src/common/pa_allocation.c +++ b/3rdparty/portaudio/src/common/pa_allocation.c @@ -27,13 +27,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -78,7 +78,7 @@ static struct PaUtilAllocationGroupLink *AllocateLinks( long count, { struct PaUtilAllocationGroupLink *result; int i; - + result = (struct PaUtilAllocationGroupLink *)PaUtil_AllocateMemory( sizeof(struct PaUtilAllocationGroupLink) * count ); if( result ) @@ -95,7 +95,7 @@ static struct PaUtilAllocationGroupLink *AllocateLinks( long count, } result[count-1].next = nextSpare; } - + return result; } @@ -147,7 +147,7 @@ void* PaUtil_GroupAllocateMemory( PaUtilAllocationGroup* group, long size ) { struct PaUtilAllocationGroupLink *links, *link; void *result = 0; - + /* allocate more links if necessary */ if( !group->spareLinks ) { @@ -176,7 +176,7 @@ void* PaUtil_GroupAllocateMemory( PaUtilAllocationGroup* group, long size ) } } - return result; + return result; } @@ -208,7 +208,7 @@ void PaUtil_GroupFreeMemory( PaUtilAllocationGroup* group, void *buffer ) break; } - + previous = current; current = current->next; } diff --git a/3rdparty/portaudio/src/common/pa_allocation.h b/3rdparty/portaudio/src/common/pa_allocation.h index 811dd72e0e..f297c2ef9e 100644 --- a/3rdparty/portaudio/src/common/pa_allocation.h +++ b/3rdparty/portaudio/src/common/pa_allocation.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -44,7 +44,7 @@ @brief Allocation Group prototypes. An Allocation Group makes it easy to allocate multiple blocks of memory and free them all at once. - + An allocation group is useful for keeping track of multiple blocks of memory which are allocated at the same time (such as during initialization) and need to be deallocated at the same time. The allocation group maintains diff --git a/3rdparty/portaudio/src/common/pa_converters.c b/3rdparty/portaudio/src/common/pa_converters.c index 965c1460e0..82616fcb62 100644 --- a/3rdparty/portaudio/src/common/pa_converters.c +++ b/3rdparty/portaudio/src/common/pa_converters.c @@ -26,13 +26,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -40,7 +40,7 @@ @ingroup common_src @brief Conversion function implementations. - + If the C9x function lrintf() is available, define PA_USE_C99_LRINTF to use it @todo Consider whether functions which dither but don't clip should exist, @@ -49,7 +49,7 @@ @todo implement the converters marked IMPLEMENT ME: Float32_To_UInt8_Dither, Float32_To_UInt8_Clip, Float32_To_UInt8_DitherClip, Int32_To_Int24_Dither, - Int32_To_UInt8_Dither, Int24_To_Int16_Dither, Int24_To_Int8_Dither, + Int32_To_UInt8_Dither, Int24_To_Int16_Dither, Int24_To_Int8_Dither, Int24_To_UInt8_Dither, Int16_To_Int8_Dither, Int16_To_UInt8_Dither, @todo review the converters marked REVIEW: Float32_To_Int32, @@ -71,7 +71,7 @@ PaSampleFormat PaUtil_SelectClosestAvailableFormat( format &= ~paNonInterleaved; availableFormats &= ~paNonInterleaved; - + if( (format & availableFormats) == 0 ) { /* NOTE: this code depends on the sample format constants being in @@ -94,7 +94,7 @@ PaSampleFormat PaUtil_SelectClosestAvailableFormat( { result = 0; } - + if( result == 0 ){ /* scan for worse formats */ result = format; @@ -107,7 +107,7 @@ PaSampleFormat PaUtil_SelectClosestAvailableFormat( if( (result & availableFormats) == 0 ) result = paSampleFormatNotSupported; } - + }else{ result = format; } @@ -283,7 +283,7 @@ PaUtilConverterTable paConverters = { 0, /* PaUtilConverter *Int24_To_Int8_Dither; */ 0, /* PaUtilConverter *Int24_To_UInt8; */ 0, /* PaUtilConverter *Int24_To_UInt8_Dither; */ - + 0, /* PaUtilConverter *Int16_To_Float32; */ 0, /* PaUtilConverter *Int16_To_Int32; */ 0, /* PaUtilConverter *Int16_To_Int24; */ @@ -345,9 +345,9 @@ static void Float32_To_Int32( *dest = lrintf(scaled-0.5f); #else double scaled = *src * 0x7FFFFFFF; - *dest = (PaInt32) scaled; + *dest = (PaInt32) scaled; #endif - + src += sourceStride; dest += destinationStride; } @@ -392,7 +392,7 @@ static void Float32_To_Int32_Clip( float *src = (float*)sourceBuffer; PaInt32 *dest = (PaInt32*)destinationBuffer; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { /* REVIEW */ @@ -455,13 +455,13 @@ static void Float32_To_Int24( PaInt32 temp; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { /* convert to 32 bit and drop the low 8 bits */ double scaled = *src * 0x7FFFFFFF; temp = (PaInt32) scaled; - + #if defined(PA_LITTLE_ENDIAN) dest[0] = (unsigned char)(temp >> 8); dest[1] = (unsigned char)(temp >> 16); @@ -495,7 +495,7 @@ static void Float32_To_Int24_Dither( double dither = PaUtil_GenerateFloatTriangularDither( ditherGenerator ); /* use smaller scaler to prevent overflow when we add the dither */ double dithered = ((double)*src * (2147483646.0)) + dither; - + temp = (PaInt32) dithered; #if defined(PA_LITTLE_ENDIAN) @@ -525,7 +525,7 @@ static void Float32_To_Int24_Clip( PaInt32 temp; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { /* convert to 32 bit and drop the low 8 bits */ @@ -558,16 +558,16 @@ static void Float32_To_Int24_DitherClip( float *src = (float*)sourceBuffer; unsigned char *dest = (unsigned char*)destinationBuffer; PaInt32 temp; - + while( count-- ) { /* convert to 32 bit and drop the low 8 bits */ - + double dither = PaUtil_GenerateFloatTriangularDither( ditherGenerator ); /* use smaller scaler to prevent overflow when we add the dither */ double dithered = ((double)*src * (2147483646.0)) + dither; PA_CLIP_( dithered, -2147483648., 2147483647. ); - + temp = (PaInt32) dithered; #if defined(PA_LITTLE_ENDIAN) @@ -898,7 +898,7 @@ static void Int32_To_Int24( PaInt32 *src = (PaInt32*)sourceBuffer; unsigned char *dest = (unsigned char*)destinationBuffer; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { /* REVIEW */ @@ -1029,7 +1029,7 @@ static void Int32_To_UInt8( while( count-- ) { - (*dest) = (unsigned char)(((*src) >> 24) + 128); + (*dest) = (unsigned char)(((*src) >> 24) + 128); src += sourceStride; dest += destinationStride; @@ -1068,12 +1068,12 @@ static void Int24_To_Float32( PaInt32 temp; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { #if defined(PA_LITTLE_ENDIAN) - temp = (((long)src[0]) << 8); + temp = (((long)src[0]) << 8); temp = temp | (((long)src[1]) << 16); temp = temp | (((long)src[2]) << 24); #elif defined(PA_BIG_ENDIAN) @@ -1101,12 +1101,12 @@ static void Int24_To_Int32( PaInt32 temp; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { #if defined(PA_LITTLE_ENDIAN) - temp = (((long)src[0]) << 8); + temp = (((long)src[0]) << 8); temp = temp | (((long)src[1]) << 16); temp = temp | (((long)src[2]) << 24); #elif defined(PA_BIG_ENDIAN) @@ -1131,14 +1131,14 @@ static void Int24_To_Int16( { unsigned char *src = (unsigned char*)sourceBuffer; PaInt16 *dest = (PaInt16*)destinationBuffer; - + PaInt16 temp; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { - + #if defined(PA_LITTLE_ENDIAN) /* src[0] is discarded */ temp = (((PaInt16)src[1])); @@ -1181,12 +1181,12 @@ static void Int24_To_Int8( { unsigned char *src = (unsigned char*)sourceBuffer; signed char *dest = (signed char*)destinationBuffer; - + (void) ditherGenerator; /* unused parameter */ - + while( count-- ) - { - + { + #if defined(PA_LITTLE_ENDIAN) /* src[0] is discarded */ /* src[1] is discarded */ @@ -1227,12 +1227,12 @@ static void Int24_To_UInt8( { unsigned char *src = (unsigned char*)sourceBuffer; unsigned char *dest = (unsigned char*)destinationBuffer; - + (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { - + #if defined(PA_LITTLE_ENDIAN) /* src[0] is discarded */ /* src[1] is discarded */ @@ -1240,7 +1240,7 @@ static void Int24_To_UInt8( #elif defined(PA_BIG_ENDIAN) *dest = (unsigned char)(src[0] + 128); /* src[1] is discarded */ - /* src[2] is discarded */ + /* src[2] is discarded */ #endif src += sourceStride * 3; @@ -1301,7 +1301,7 @@ static void Int16_To_Int32( /* REVIEW: we should consider something like (*src << 16) | (*src & 0xFFFF) */ - + *dest = *src << 16; src += sourceStride; @@ -1321,11 +1321,11 @@ static void Int16_To_Int24( PaInt16 temp; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { temp = *src; - + #if defined(PA_LITTLE_ENDIAN) dest[0] = 0; dest[1] = (unsigned char)(temp); @@ -1394,7 +1394,7 @@ static void Int16_To_UInt8( while( count-- ) { - (*dest) = (unsigned char)(((*src) >> 8) + 128); + (*dest) = (unsigned char)(((*src) >> 8) + 128); src += sourceStride; dest += destinationStride; @@ -1582,7 +1582,7 @@ static void UInt8_To_Int24( unsigned char *src = (unsigned char*)sourceBuffer; unsigned char *dest = (unsigned char*)destinationBuffer; (void) ditherGenerator; /* unused parameters */ - + while( count-- ) { @@ -1595,9 +1595,9 @@ static void UInt8_To_Int24( dest[1] = 0; dest[2] = 0; #endif - + src += sourceStride; - dest += destinationStride * 3; + dest += destinationStride * 3; } } @@ -1650,7 +1650,7 @@ static void Copy_8_To_8( { unsigned char *src = (unsigned char*)sourceBuffer; unsigned char *dest = (unsigned char*)destinationBuffer; - + (void) ditherGenerator; /* unused parameter */ while( count-- ) @@ -1671,9 +1671,9 @@ static void Copy_16_To_16( { PaUint16 *src = (PaUint16 *)sourceBuffer; PaUint16 *dest = (PaUint16 *)destinationBuffer; - + (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { *dest = *src; @@ -1694,7 +1694,7 @@ static void Copy_24_To_24( unsigned char *dest = (unsigned char*)destinationBuffer; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { dest[0] = src[0]; @@ -1717,7 +1717,7 @@ static void Copy_32_To_32( PaUint32 *src = (PaUint32 *)sourceBuffer; (void) ditherGenerator; /* unused parameter */ - + while( count-- ) { *dest = *src; @@ -1739,7 +1739,7 @@ PaUtilConverterTable paConverters = { Float32_To_Int24_Dither, /* PaUtilConverter *Float32_To_Int24_Dither; */ Float32_To_Int24_Clip, /* PaUtilConverter *Float32_To_Int24_Clip; */ Float32_To_Int24_DitherClip, /* PaUtilConverter *Float32_To_Int24_DitherClip; */ - + Float32_To_Int16, /* PaUtilConverter *Float32_To_Int16; */ Float32_To_Int16_Dither, /* PaUtilConverter *Float32_To_Int16_Dither; */ Float32_To_Int16_Clip, /* PaUtilConverter *Float32_To_Int16_Clip; */ diff --git a/3rdparty/portaudio/src/common/pa_converters.h b/3rdparty/portaudio/src/common/pa_converters.h index 7ddfcaa3c2..8b09d684c8 100644 --- a/3rdparty/portaudio/src/common/pa_converters.h +++ b/3rdparty/portaudio/src/common/pa_converters.h @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -119,7 +119,7 @@ PaUtilConverter* PaUtil_SelectConverter( PaSampleFormat sourceFormat, typedef void PaUtilZeroer( void *destinationBuffer, signed int destinationStride, unsigned int count ); - + /** Find a buffer zeroer function for the given destination format. @return A pointer to a PaUtilZeroer which will perform the requested @@ -145,7 +145,7 @@ typedef struct{ PaUtilConverter *Float32_To_Int24_Dither; PaUtilConverter *Float32_To_Int24_Clip; PaUtilConverter *Float32_To_Int24_DitherClip; - + PaUtilConverter *Float32_To_Int16; PaUtilConverter *Float32_To_Int16_Dither; PaUtilConverter *Float32_To_Int16_Clip; @@ -193,7 +193,7 @@ typedef struct{ PaUtilConverter *Int8_To_Int24; PaUtilConverter *Int8_To_Int16; PaUtilConverter *Int8_To_UInt8; - + PaUtilConverter *UInt8_To_Float32; PaUtilConverter *UInt8_To_Int32; PaUtilConverter *UInt8_To_Int24; diff --git a/3rdparty/portaudio/src/common/pa_cpuload.c b/3rdparty/portaudio/src/common/pa_cpuload.c index 445503c291..f9034d3c4c 100644 --- a/3rdparty/portaudio/src/common/pa_cpuload.c +++ b/3rdparty/portaudio/src/common/pa_cpuload.c @@ -27,13 +27,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/common/pa_cpuload.h b/3rdparty/portaudio/src/common/pa_cpuload.h index 4a594430b8..2dfa37ae3c 100644 --- a/3rdparty/portaudio/src/common/pa_cpuload.h +++ b/3rdparty/portaudio/src/common/pa_cpuload.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -68,5 +68,5 @@ double PaUtil_GetCpuLoad( PaUtilCpuLoadMeasurer* measurer ); #ifdef __cplusplus } -#endif /* __cplusplus */ +#endif /* __cplusplus */ #endif /* PA_CPULOAD_H */ diff --git a/3rdparty/portaudio/src/common/pa_debugprint.c b/3rdparty/portaudio/src/common/pa_debugprint.c index 6cb114eca1..a38b5f2e0e 100644 --- a/3rdparty/portaudio/src/common/pa_debugprint.c +++ b/3rdparty/portaudio/src/common/pa_debugprint.c @@ -81,7 +81,7 @@ void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb) /* Some Windows Mobile SDKs don't define vsnprintf but all define _vsnprintf (hopefully). According to MSDN "vsnprintf is identical to _vsnprintf". So we use _vsnprintf with MSC. */ - #define VSNPRINTF _vsnprintf + #define VSNPRINTF _vsnprintf #else #define VSNPRINTF vsnprintf #endif diff --git a/3rdparty/portaudio/src/common/pa_debugprint.h b/3rdparty/portaudio/src/common/pa_debugprint.h index 5fba7667dc..48262a62a0 100644 --- a/3rdparty/portaudio/src/common/pa_debugprint.h +++ b/3rdparty/portaudio/src/common/pa_debugprint.h @@ -101,7 +101,7 @@ void PaUtil_DebugPrint( const char *format, ... ); #ifdef PA_LOG_API_CALLS -#define PA_LOGAPI(x) PaUtil_DebugPrint x +#define PA_LOGAPI(x) PaUtil_DebugPrint x #define PA_LOGAPI_ENTER(functionName) PaUtil_DebugPrint( functionName " called.\n" ) @@ -133,7 +133,7 @@ void PaUtil_DebugPrint( const char *format, ... ); #define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result ) #endif - + typedef void (*PaUtilLogCallback ) (const char *log); /** diff --git a/3rdparty/portaudio/src/common/pa_dither.c b/3rdparty/portaudio/src/common/pa_dither.c index 7a1b13125b..79b20bef7f 100644 --- a/3rdparty/portaudio/src/common/pa_dither.c +++ b/3rdparty/portaudio/src/common/pa_dither.c @@ -26,13 +26,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -72,10 +72,10 @@ PaInt32 PaUtil_Generate16BitTriangularDither( PaUtilTriangularDitherGenerator *s /* Generate triangular distribution about 0. * Shift before adding to prevent overflow which would skew the distribution. - * Also shift an extra bit for the high pass filter. + * Also shift an extra bit for the high pass filter. */ #define DITHER_SHIFT_ ((sizeof(PaInt32)*8 - PA_DITHER_BITS_) + 1) - + current = (((PaInt32)state->randSeed1)>>DITHER_SHIFT_) + (((PaInt32)state->randSeed2)>>DITHER_SHIFT_); @@ -100,7 +100,7 @@ float PaUtil_GenerateFloatTriangularDither( PaUtilTriangularDitherGenerator *sta /* Generate triangular distribution about 0. * Shift before adding to prevent overflow which would skew the distribution. - * Also shift an extra bit for the high pass filter. + * Also shift an extra bit for the high pass filter. */ current = (((PaInt32)state->randSeed1)>>DITHER_SHIFT_) + (((PaInt32)state->randSeed2)>>DITHER_SHIFT_); @@ -137,7 +137,7 @@ things like this: r3=(r1 & 0x7F)<<8; instead of calling rand() again. float s1, s2; //error feedback buffers float s = 0.5f; //set to 0.0f for no noise shaping float w = pow(2.0,bits-1); //word length (usually bits=16) - float wi= 1.0f/w; + float wi= 1.0f/w; float d = wi / RAND_MAX; //dither amplitude (2 lsb) float o = wi * 0.5f; //remove dc offset float in, tmp; @@ -148,19 +148,19 @@ things like this: r3=(r1 & 0x7F)<<8; instead of calling rand() again. r2=r1; //can make HP-TRI dither by r1=rand(); //subtracting previous rand() - + in += s * (s1 + s1 - s2); //error feedback - tmp = in + o + d * (float)(r1 - r2); //dc offset and dither - + tmp = in + o + d * (float)(r1 - r2); //dc offset and dither + out = (int)(w * tmp); //truncate downwards if(tmp<0.0f) out--; //this is faster than floor() - s2 = s1; + s2 = s1; s1 = in - wi * (float)out; //error --- +-- paul.kellett@maxim.abel.co.uk http://www.maxim.abel.co.uk */ @@ -172,7 +172,7 @@ http://www.maxim.abel.co.uk Type : First order error feedforward dithering code References : Posted by Jon Watte -Notes : +Notes : This is about as simple a dithering algorithm as you can implement, but it's likely to sound better than just truncating to N bits. @@ -183,36 +183,36 @@ and integer SIMD type instructions, or CMOV. Last, if sound quality is paramount (such as when going from > 16 bits to 16 bits) you probably want to use a higher-order dither function found elsewhere -on this site. +on this site. -Code : -// This code will down-convert and dither a 16-bit signed short -// mono signal into an 8-bit unsigned char signal, using a first -// order forward-feeding error term dither. +Code : +// This code will down-convert and dither a 16-bit signed short +// mono signal into an 8-bit unsigned char signal, using a first +// order forward-feeding error term dither. -#define uchar unsigned char +#define uchar unsigned char -void dither_one_channel_16_to_8( short * input, uchar * output, int count, int * memory ) -{ - int m = *memory; - while( count-- > 0 ) { - int i = *input++; - i += m; - int j = i + 32768 - 128; - uchar o; - if( j < 0 ) { - o = 0; - } - else if( j > 65535 ) { - o = 255; - } - else { - o = (uchar)((j>>8)&0xff); - } - m = ((j-32768+128)-i); - *output++ = o; - } - *memory = m; -} +void dither_one_channel_16_to_8( short * input, uchar * output, int count, int * memory ) +{ + int m = *memory; + while( count-- > 0 ) { + int i = *input++; + i += m; + int j = i + 32768 - 128; + uchar o; + if( j < 0 ) { + o = 0; + } + else if( j > 65535 ) { + o = 255; + } + else { + o = (uchar)((j>>8)&0xff); + } + m = ((j-32768+128)-i); + *output++ = o; + } + *memory = m; +} */ diff --git a/3rdparty/portaudio/src/common/pa_dither.h b/3rdparty/portaudio/src/common/pa_dither.h index a5131b27fa..9b76be93f9 100644 --- a/3rdparty/portaudio/src/common/pa_dither.h +++ b/3rdparty/portaudio/src/common/pa_dither.h @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/common/pa_endianness.h b/3rdparty/portaudio/src/common/pa_endianness.h index 84e904ca7b..2e47331d0e 100644 --- a/3rdparty/portaudio/src/common/pa_endianness.h +++ b/3rdparty/portaudio/src/common/pa_endianness.h @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/common/pa_front.c b/3rdparty/portaudio/src/common/pa_front.c index 28f0c60e8d..6e82cdc476 100644 --- a/3rdparty/portaudio/src/common/pa_front.c +++ b/3rdparty/portaudio/src/common/pa_front.c @@ -27,26 +27,26 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup common_src - @brief Implements PortAudio API functions defined in portaudio.h, checks + @brief Implements PortAudio API functions defined in portaudio.h, checks some errors, delegates platform-specific behavior to host API implementations. - - Implements the functions defined in the PortAudio API (portaudio.h), - validates some parameters and checks for state inconsistencies before - forwarding API requests to specific Host API implementations (via the - interface declared in pa_hostapi.h), and Streams (via the interface + + Implements the functions defined in the PortAudio API (portaudio.h), + validates some parameters and checks for state inconsistencies before + forwarding API requests to specific Host API implementations (via the + interface declared in pa_hostapi.h), and Streams (via the interface declared in pa_stream.h). This file manages initialization and termination of Host API @@ -180,7 +180,7 @@ static PaError InitializeHostApis( void ) if( !hostApis_ ) { result = paInsufficientMemory; - goto error; + goto error; } hostApisCount_ = 0; @@ -233,7 +233,7 @@ error: belongs and returns it. if is non-null, the host specific device index is returned in it. returns -1 if is out of range. - + */ static int FindHostApi( PaDeviceIndex device, int *hostSpecificDeviceIndex ) { @@ -323,7 +323,7 @@ PaError Pa_Initialize( void ) { PA_VALIDATE_TYPE_SIZES; PA_VALIDATE_ENDIANNESS; - + PaUtil_InitializeClock(); PaUtil_ResetTraceMessages(); @@ -410,11 +410,11 @@ const char *Pa_GetErrorText( PaError errorCode ) case paCanNotWriteToAnInputOnlyStream: result = "Can't write to an input only stream"; break; case paIncompatibleStreamHostApi: result = "Incompatible stream host API"; break; case paBadBufferPtr: result = "Bad buffer pointer"; break; - default: + default: if( errorCode > 0 ) - result = "Invalid error code (value greater than zero)"; + result = "Invalid error code (value greater than zero)"; else - result = "Invalid error code"; + result = "Invalid error code"; break; } return result; @@ -425,7 +425,7 @@ PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type ) { PaHostApiIndex result; int i; - + PA_LOGAPI_ENTER_PARAMS( "Pa_HostApiTypeIdToHostApiIndex" ); PA_LOGAPI(("\tPaHostApiTypeId type: %d\n", type )); @@ -436,14 +436,14 @@ PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type ) else { result = paHostApiNotFound; - + for( i=0; i < hostApisCount_; ++i ) { if( hostApis_[i]->info.type == type ) { result = i; break; - } + } } } @@ -458,7 +458,7 @@ PaError PaUtil_GetHostApiRepresentation( struct PaUtilHostApiRepresentation **ho { PaError result; int i; - + if( !PA_IS_INITIALISED_ ) { result = paNotInitialized; @@ -466,7 +466,7 @@ PaError PaUtil_GetHostApiRepresentation( struct PaUtilHostApiRepresentation **ho else { result = paHostApiNotFound; - + for( i=0; i < hostApisCount_; ++i ) { if( hostApis_[i]->info.type == type ) @@ -487,7 +487,7 @@ PaError PaUtil_DeviceIndexToHostApiDeviceIndex( { PaError result; PaDeviceIndex x; - + x = device - hostApi->privatePaFrontInfo.baseDeviceIndex; if( x < 0 || x >= hostApi->info.deviceCount ) @@ -572,7 +572,7 @@ const PaHostApiInfo* Pa_GetHostApiInfo( PaHostApiIndex hostApi ) else if( hostApi < 0 || hostApi >= hostApisCount_ ) { info = NULL; - + PA_LOGAPI(("Pa_GetHostApiInfo returned:\n" )); PA_LOGAPI(("\tPaHostApiInfo*: NULL [ hostApi out of range ]\n" )); @@ -681,7 +681,7 @@ PaDeviceIndex Pa_GetDefaultOutputDevice( void ) { PaHostApiIndex hostApi; PaDeviceIndex result; - + PA_LOGAPI_ENTER( "Pa_GetDefaultOutputDevice" ); hostApi = Pa_GetDefaultHostApi(); @@ -765,7 +765,7 @@ static int SampleFormatIsValid( PaSampleFormat format ) ValidateOpenStreamParameters() checks that parameters to Pa_OpenStream() conform to the expected values as described below. This function is also designed to be used with the proposed Pa_IsFormatSupported() function. - + There are basically two types of validation that could be performed: Generic conformance validation, and device capability mismatch validation. This function performs only generic conformance validation. @@ -774,21 +774,21 @@ static int SampleFormatIsValid( PaSampleFormat format ) combinations of parameters - for example, even if the sampleRate seems ok, it might not be for a duplex stream - we have no way of checking this in an API-neutral way, so we don't try. - + On success the function returns PaNoError and fills in hostApi, hostApiInputDeviceID, and hostApiOutputDeviceID fields. On failure the function returns an error code indicating the first encountered parameter error. - - + + If ValidateOpenStreamParameters() returns paNoError, the following assertions are guaranteed to be true. - + - at least one of inputParameters & outputParmeters is valid (not NULL) - if inputParameters & outputParameters are both valid, that inputParameters->device & outputParameters->device both use the same host api - + PaDeviceIndex inputParameters->device - is within range (0 to Pa_GetDeviceCount-1) Or: - is paUseHostApiSpecificDeviceSpecification and @@ -798,30 +798,30 @@ static int SampleFormatIsValid( PaSampleFormat format ) int inputParameters->channelCount - if inputParameters->device is not paUseHostApiSpecificDeviceSpecification, channelCount is > 0 - upper bound is NOT validated against device capabilities - + PaSampleFormat inputParameters->sampleFormat - is one of the sample formats defined in portaudio.h void *inputParameters->hostApiSpecificStreamInfo - if supplied its hostApi field matches the input device's host Api - + PaDeviceIndex outputParmeters->device - is within range (0 to Pa_GetDeviceCount-1) - + int outputParmeters->channelCount - if inputDevice is valid, channelCount is > 0 - upper bound is NOT validated against device capabilities - + PaSampleFormat outputParmeters->sampleFormat - is one of the sample formats defined in portaudio.h - + void *outputParmeters->hostApiSpecificStreamInfo - if supplied its hostApi field matches the output device's host Api - + double sampleRate - is not an 'absurd' rate (less than 1000. or greater than 200000.) - sampleRate is NOT validated against device capabilities - + PaStreamFlags streamFlags - unused platform neutral flags are zero - paNeverDropInput is only used for full-duplex callback streams with @@ -948,7 +948,7 @@ static PaError ValidateOpenStreamParameters( != (*hostApi)->info.type ) return paIncompatibleHostApiSpecificStreamInfo; } - } + } if( (inputParameters != NULL) && (outputParameters != NULL) ) { @@ -957,8 +957,8 @@ static PaError ValidateOpenStreamParameters( return paBadIODeviceCombination; } } - - + + /* Check for absurd sample rates. */ if( (sampleRate < 1000.0) || (sampleRate > 200000.0) ) return paInvalidSampleRate; @@ -980,7 +980,7 @@ static PaError ValidateOpenStreamParameters( if( framesPerBuffer != paFramesPerBufferUnspecified ) return paInvalidFlag; } - + return paNoError; } @@ -1020,7 +1020,7 @@ PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters, PA_LOGAPI(("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency )); PA_LOGAPI(("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo )); } - + PA_LOGAPI(("\tdouble sampleRate: %g\n", sampleRate )); #endif @@ -1043,7 +1043,7 @@ PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters, PA_LOGAPI_EXIT_PAERROR( "Pa_IsFormatSupported", result ); return result; } - + if( inputParameters ) { @@ -1130,7 +1130,7 @@ PaError Pa_OpenStream( PaStream** stream, PA_LOGAPI(("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency )); PA_LOGAPI(("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo )); } - + PA_LOGAPI(("\tdouble sampleRate: %g\n", sampleRate )); PA_LOGAPI(("\tunsigned long framesPerBuffer: %d\n", framesPerBuffer )); PA_LOGAPI(("\tPaStreamFlags streamFlags: 0x%x\n", streamFlags )); @@ -1177,7 +1177,7 @@ PaError Pa_OpenStream( PaStream** stream, PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )); return result; } - + if( inputParameters ) { @@ -1251,8 +1251,8 @@ PaError Pa_OpenDefaultStream( PaStream** stream, { hostApiInputParameters.device = Pa_GetDefaultInputDevice(); if( hostApiInputParameters.device == paNoDevice ) - return paDeviceUnavailable; - + return paDeviceUnavailable; + hostApiInputParameters.channelCount = inputChannelCount; hostApiInputParameters.sampleFormat = sampleFormat; /* defaultHighInputLatency is used below instead of @@ -1260,7 +1260,7 @@ PaError Pa_OpenDefaultStream( PaStream** stream, stream to work reliably than it is for it to work with the lowest latency. */ - hostApiInputParameters.suggestedLatency = + hostApiInputParameters.suggestedLatency = Pa_GetDeviceInfo( hostApiInputParameters.device )->defaultHighInputLatency; hostApiInputParameters.hostApiSpecificStreamInfo = NULL; hostApiInputParametersPtr = &hostApiInputParameters; @@ -1274,7 +1274,7 @@ PaError Pa_OpenDefaultStream( PaStream** stream, { hostApiOutputParameters.device = Pa_GetDefaultOutputDevice(); if( hostApiOutputParameters.device == paNoDevice ) - return paDeviceUnavailable; + return paDeviceUnavailable; hostApiOutputParameters.channelCount = outputChannelCount; hostApiOutputParameters.sampleFormat = sampleFormat; @@ -1658,7 +1658,7 @@ PaError Pa_WriteStream( PaStream* stream, else if( result == 1 ) { result = paStreamIsStopped; - } + } } } diff --git a/3rdparty/portaudio/src/common/pa_hostapi.h b/3rdparty/portaudio/src/common/pa_hostapi.h index 5462d44397..c075f4f204 100644 --- a/3rdparty/portaudio/src/common/pa_hostapi.h +++ b/3rdparty/portaudio/src/common/pa_hostapi.h @@ -29,20 +29,20 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup common_src - @brief Interfaces and representation structures used by pa_front.c + @brief Interfaces and representation structures used by pa_front.c to manage and communicate with host API implementations. */ @@ -112,13 +112,13 @@ typedef struct PaUtilHostApiRepresentation { The inputParameters and outputParameters pointers should not be saved as they will not remain valid after OpenStream is called. - + The following guarantees are made about parameters to (*OpenStream)(): [NOTE: the following list up to *END PA FRONT VALIDATIONS* should be kept in sync with the one for ValidateOpenStreamParameters and Pa_OpenStream in pa_front.c] - + PaHostApiRepresentation *hostApi - is valid for this implementation @@ -129,7 +129,7 @@ typedef struct PaUtilHostApiRepresentation { - if inputParameters & outputParmeters are both valid, that inputParameters->device & outputParmeters->device both use the same host api - + PaDeviceIndex inputParameters->device - is within range (0 to Pa_CountDevices-1) Or: - is paUseHostApiSpecificDeviceSpecification and @@ -139,30 +139,30 @@ typedef struct PaUtilHostApiRepresentation { int inputParameters->numChannels - if inputParameters->device is not paUseHostApiSpecificDeviceSpecification, numInputChannels is > 0 - upper bound is NOT validated against device capabilities - + PaSampleFormat inputParameters->sampleFormat - is one of the sample formats defined in portaudio.h void *inputParameters->hostApiSpecificStreamInfo - if supplied its hostApi field matches the input device's host Api - + PaDeviceIndex outputParmeters->device - is within range (0 to Pa_CountDevices-1) - + int outputParmeters->numChannels - if inputDevice is valid, numInputChannels is > 0 - upper bound is NOT validated against device capabilities - + PaSampleFormat outputParmeters->sampleFormat - is one of the sample formats defined in portaudio.h - + void *outputParmeters->hostApiSpecificStreamInfo - if supplied its hostApi field matches the output device's host Api - + double sampleRate - is not an 'absurd' rate (less than 1000. or greater than 200000.) - sampleRate is NOT validated against device capabilities - + PaStreamFlags streamFlags - unused platform neutral flags are zero - paNeverDropInput is only used for full-duplex callback streams @@ -174,7 +174,7 @@ typedef struct PaUtilHostApiRepresentation { The following validations MUST be performed by (*OpenStream)(): - check that input device can support numInputChannels - + - check that input device can support inputSampleFormat, or that we have the capability to convert from outputSampleFormat to a native format @@ -183,7 +183,7 @@ typedef struct PaUtilHostApiRepresentation { or return an error if no inputStreamInfo is expected - check that output device can support numOutputChannels - + - check that output device can support outputSampleFormat, or that we have the capability to convert from outputSampleFormat to a native format @@ -223,11 +223,11 @@ typedef struct PaUtilHostApiRepresentation { /** Prototype for the initialization function which must be implemented by every host API. - - This function should only return an error other than paNoError if it encounters - an unexpected and fatal error (memory allocation error for example). In general, - there may be conditions under which it returns a NULL interface pointer and also - returns paNoError. For example, if the ASIO implementation detects that ASIO is + + This function should only return an error other than paNoError if it encounters + an unexpected and fatal error (memory allocation error for example). In general, + there may be conditions under which it returns a NULL interface pointer and also + returns paNoError. For example, if the ASIO implementation detects that ASIO is not installed, it should return a NULL interface, and paNoError. @see paHostApiInitializers @@ -246,7 +246,7 @@ extern PaUtilHostApiInitializer *paHostApiInitializers[]; /** The index of the default host API in the paHostApiInitializers array. - + There is a platform specific file which defines paDefaultHostApiIndex for that platform, see pa_win/pa_win_hostapis.c for example. */ diff --git a/3rdparty/portaudio/src/common/pa_memorybarrier.h b/3rdparty/portaudio/src/common/pa_memorybarrier.h index f689622201..68134e0738 100644 --- a/3rdparty/portaudio/src/common/pa_memorybarrier.h +++ b/3rdparty/portaudio/src/common/pa_memorybarrier.h @@ -30,13 +30,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/common/pa_process.c b/3rdparty/portaudio/src/common/pa_process.c index 4770610b86..9cc70eb8c7 100644 --- a/3rdparty/portaudio/src/common/pa_process.c +++ b/3rdparty/portaudio/src/common/pa_process.c @@ -27,13 +27,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -41,7 +41,7 @@ @ingroup common_src @brief Buffer Processor implementation. - + The code in this file is not optimised yet - although it's not clear that it needs to be. there may appear to be redundancies that could be factored into common functions, but the redundanceis are left @@ -232,7 +232,7 @@ PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bp, bp->framesInTempInputBuffer = bp->initialFramesInTempInputBuffer; bp->framesInTempOutputBuffer = bp->initialFramesInTempOutputBuffer; - + if( inputChannelCount > 0 ) { bytesPerSample = Pa_GetSampleSize( hostInputSampleFormat ); @@ -261,20 +261,20 @@ PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bp, PaUtil_SelectConverter( hostInputSampleFormat, userInputSampleFormat, streamFlags ); bp->inputZeroer = PaUtil_SelectZeroer( hostInputSampleFormat ); - + bp->userInputIsInterleaved = (userInputSampleFormat & paNonInterleaved)?0:1; tempInputBufferSize = bp->framesPerTempBuffer * bp->bytesPerUserInputSample * inputChannelCount; - + bp->tempInputBuffer = PaUtil_AllocateMemory( tempInputBufferSize ); if( bp->tempInputBuffer == 0 ) { result = paInsufficientMemory; goto error; } - + if( bp->framesInTempInputBuffer > 0 ) memset( bp->tempInputBuffer, 0, tempInputBufferSize ); @@ -343,7 +343,7 @@ PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bp, if( bp->framesInTempOutputBuffer > 0 ) memset( bp->tempOutputBuffer, 0, tempOutputBufferSize ); - + if( userOutputSampleFormat & paNonInterleaved ) { bp->tempOutputBufferPtrs = @@ -358,7 +358,7 @@ PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bp, bp->hostOutputChannels[0] = (PaUtilChannelDescriptor*) PaUtil_AllocateMemory( sizeof(PaUtilChannelDescriptor)*outputChannelCount * 2 ); if( bp->hostOutputChannels[0] == 0 ) - { + { result = paInsufficientMemory; goto error; } @@ -408,7 +408,7 @@ void PaUtil_TerminateBufferProcessor( PaUtilBufferProcessor* bp ) if( bp->hostInputChannels[0] ) PaUtil_FreeMemory( bp->hostInputChannels[0] ); - + if( bp->tempOutputBuffer ) PaUtil_FreeMemory( bp->tempOutputBuffer ); @@ -435,7 +435,7 @@ void PaUtil_ResetBufferProcessor( PaUtilBufferProcessor* bp ) } if( bp->framesInTempOutputBuffer > 0 ) - { + { tempOutputBufferSize = bp->framesPerTempBuffer * bp->bytesPerUserOutputSample * bp->outputChannelCount; memset( bp->tempOutputBuffer, 0, tempOutputBufferSize ); @@ -463,7 +463,7 @@ void PaUtil_SetInputFrameCount( PaUtilBufferProcessor* bp, else bp->hostInputFrameCount[0] = frameCount; } - + void PaUtil_SetNoInput( PaUtilBufferProcessor* bp ) { @@ -477,7 +477,7 @@ void PaUtil_SetInputChannel( PaUtilBufferProcessor* bp, unsigned int channel, void *data, unsigned int stride ) { assert( channel < bp->inputChannelCount ); - + bp->hostInputChannels[0][channel].data = data; bp->hostInputChannels[0][channel].stride = stride; } @@ -509,7 +509,7 @@ void PaUtil_SetNonInterleavedInputChannel( PaUtilBufferProcessor* bp, unsigned int channel, void *data ) { assert( channel < bp->inputChannelCount ); - + bp->hostInputChannels[0][channel].data = data; bp->hostInputChannels[0][channel].stride = 1; } @@ -544,7 +544,7 @@ void PaUtil_Set2ndInterleavedInputChannels( PaUtilBufferProcessor* bp, assert( firstChannel < bp->inputChannelCount ); assert( firstChannel + channelCount <= bp->inputChannelCount ); - + for( i=0; i< channelCount; ++i ) { bp->hostInputChannels[1][channel+i].data = p; @@ -553,12 +553,12 @@ void PaUtil_Set2ndInterleavedInputChannels( PaUtilBufferProcessor* bp, } } - + void PaUtil_Set2ndNonInterleavedInputChannel( PaUtilBufferProcessor* bp, unsigned int channel, void *data ) { assert( channel < bp->inputChannelCount ); - + bp->hostInputChannels[1][channel].data = data; bp->hostInputChannels[1][channel].stride = 1; } @@ -605,7 +605,7 @@ void PaUtil_SetInterleavedOutputChannels( PaUtilBufferProcessor* bp, assert( firstChannel < bp->outputChannelCount ); assert( firstChannel + channelCount <= bp->outputChannelCount ); - + for( i=0; i< channelCount; ++i ) { PaUtil_SetOutputChannel( bp, channel + i, p, channelCount ); @@ -653,7 +653,7 @@ void PaUtil_Set2ndInterleavedOutputChannels( PaUtilBufferProcessor* bp, assert( firstChannel < bp->outputChannelCount ); assert( firstChannel + channelCount <= bp->outputChannelCount ); - + for( i=0; i< channelCount; ++i ) { PaUtil_Set2ndOutputChannel( bp, channel + i, p, channelCount ); @@ -661,12 +661,12 @@ void PaUtil_Set2ndInterleavedOutputChannels( PaUtilBufferProcessor* bp, } } - + void PaUtil_Set2ndNonInterleavedOutputChannel( PaUtilBufferProcessor* bp, unsigned int channel, void *data ) { assert( channel < bp->outputChannelCount ); - + PaUtil_Set2ndOutputChannel( bp, channel, data, 1 ); } @@ -678,11 +678,11 @@ void PaUtil_BeginBufferProcessing( PaUtilBufferProcessor* bp, /* the first streamCallback will be called to process samples which are currently in the input buffer before the ones starting at the timeInfo time */ - + bp->timeInfo->inputBufferAdcTime -= bp->framesInTempInputBuffer * bp->samplePeriod; - + /* We just pass through timeInfo->currentTime provided by the caller. This is - not strictly conformant to the word of the spec, since the buffer processor + not strictly conformant to the word of the spec, since the buffer processor might call the callback multiple times, and we never refresh currentTime. */ /* the first streamCallback will be called to generate samples which will be @@ -742,7 +742,7 @@ static unsigned long NonAdaptingProcess( PaUtilBufferProcessor *bp, could use more elaborate logic here and sometimes process buffers in-place. */ - + destBytePtr = (unsigned char *)bp->tempInputBuffer; if( bp->userInputIsInterleaved ) @@ -762,7 +762,7 @@ static unsigned long NonAdaptingProcess( PaUtilBufferProcessor *bp, bp->tempInputBufferPtrs[i] = ((unsigned char*)bp->tempInputBuffer) + i * bp->bytesPerUserInputSample * frameCount; } - + userInput = bp->tempInputBufferPtrs; } @@ -818,7 +818,7 @@ static unsigned long NonAdaptingProcess( PaUtilBufferProcessor *bp, userOutput = bp->tempOutputBufferPtrs; } } - + *streamCallbackResult = bp->streamCallback( userInput, userOutput, frameCount, bp->timeInfo, bp->callbackStatusFlags, bp->userData ); @@ -833,14 +833,14 @@ static unsigned long NonAdaptingProcess( PaUtilBufferProcessor *bp, bp->timeInfo->outputBufferDacTime += frameCount * bp->samplePeriod; /* convert output data (user -> host) */ - + if( bp->outputChannelCount != 0 && bp->hostOutputChannels[0][0].data ) { /* could use more elaborate logic here and sometimes process buffers in-place. */ - + srcBytePtr = (unsigned char *)bp->tempOutputBuffer; if( bp->userOutputIsInterleaved ) @@ -868,7 +868,7 @@ static unsigned long NonAdaptingProcess( PaUtilBufferProcessor *bp, frameCount * hostOutputChannels[i].stride * bp->bytesPerHostOutputSample; } } - + framesProcessed += frameCount; framesToGo -= frameCount; @@ -923,7 +923,7 @@ static unsigned long AdaptingInputOnlyProcess( PaUtilBufferProcessor *bp, unsigned long frameCount; unsigned long framesToGo = framesToProcess; unsigned long framesProcessed = 0; - + userOutput = 0; do @@ -939,7 +939,7 @@ static unsigned long AdaptingInputOnlyProcess( PaUtilBufferProcessor *bp, destBytePtr = ((unsigned char*)bp->tempInputBuffer) + bp->bytesPerUserInputSample * bp->inputChannelCount * bp->framesInTempInputBuffer; - + destSampleStrideSamples = bp->inputChannelCount; destChannelStrideBytes = bp->bytesPerUserInputSample; @@ -959,7 +959,7 @@ static unsigned long AdaptingInputOnlyProcess( PaUtilBufferProcessor *bp, bp->tempInputBufferPtrs[i] = ((unsigned char*)bp->tempInputBuffer) + i * bp->bytesPerUserInputSample * bp->framesPerUserBuffer; } - + userInput = bp->tempInputBufferPtrs; } @@ -999,7 +999,7 @@ static unsigned long AdaptingInputOnlyProcess( PaUtilBufferProcessor *bp, bp->timeInfo->inputBufferAdcTime += bp->framesPerUserBuffer * bp->samplePeriod; } - + bp->framesInTempInputBuffer = 0; } @@ -1054,7 +1054,7 @@ static unsigned long AdaptingOutputOnlyProcess( PaUtilBufferProcessor *bp, } bp->timeInfo->inputBufferAdcTime = 0; - + *streamCallbackResult = bp->streamCallback( userInput, userOutput, bp->framesPerUserBuffer, bp->timeInfo, bp->callbackStatusFlags, bp->userData ); @@ -1091,7 +1091,7 @@ static unsigned long AdaptingOutputOnlyProcess( PaUtilBufferProcessor *bp, srcBytePtr = ((unsigned char*)bp->tempOutputBuffer) + bp->bytesPerUserOutputSample * (bp->framesPerUserBuffer - bp->framesInTempOutputBuffer); - + srcSampleStrideSamples = 1; srcChannelStrideBytes = bp->framesPerUserBuffer * bp->bytesPerUserOutputSample; } @@ -1132,9 +1132,9 @@ static unsigned long AdaptingOutputOnlyProcess( PaUtilBufferProcessor *bp, frameCount * hostOutputChannels[i].stride * bp->bytesPerHostOutputSample; } } - + framesProcessed += frameCount; - + framesToGo -= frameCount; }while( framesToGo > 0 ); @@ -1144,7 +1144,7 @@ static unsigned long AdaptingOutputOnlyProcess( PaUtilBufferProcessor *bp, /* CopyTempOutputBuffersToHostOutputBuffers is called from AdaptingProcess to copy frames from tempOutputBuffer to hostOutputChannels. This includes data conversion - and interleaving. + and interleaving. */ static void CopyTempOutputBuffersToHostOutputBuffers( PaUtilBufferProcessor *bp) { @@ -1179,7 +1179,7 @@ static void CopyTempOutputBuffersToHostOutputBuffers( PaUtilBufferProcessor *bp) srcBytePtr = ((unsigned char*)bp->tempOutputBuffer) + bp->bytesPerUserOutputSample * bp->outputChannelCount * (bp->framesPerUserBuffer - bp->framesInTempOutputBuffer); - + srcSampleStrideSamples = bp->outputChannelCount; srcChannelStrideBytes = bp->bytesPerUserOutputSample; } @@ -1241,7 +1241,7 @@ static unsigned long AdaptingProcess( PaUtilBufferProcessor *bp, unsigned int destSampleStrideSamples; /* stride from one sample to the next within a channel, in samples */ unsigned int destChannelStrideBytes; /* stride from one channel to the next, in bytes */ unsigned int i, j; - + framesAvailable = bp->hostInputFrameCount[0] + bp->hostInputFrameCount[1];/* this is assumed to be the same as the output buffer's frame count */ @@ -1251,9 +1251,9 @@ static unsigned long AdaptingProcess( PaUtilBufferProcessor *bp, endProcessingMinFrameCount = (bp->framesPerUserBuffer - 1); /* Fill host output with remaining frames in user output (tempOutputBuffer) */ - CopyTempOutputBuffersToHostOutputBuffers( bp ); + CopyTempOutputBuffersToHostOutputBuffers( bp ); - while( framesAvailable > endProcessingMinFrameCount ) + while( framesAvailable > endProcessingMinFrameCount ) { if( bp->framesInTempOutputBuffer == 0 && *streamCallbackResult != paContinue ) @@ -1267,7 +1267,7 @@ static unsigned long AdaptingProcess( PaUtilBufferProcessor *bp, if( frameCount > 0 ) { hostOutputChannels = bp->hostOutputChannels[i]; - + for( j=0; joutputChannelCount; ++j ) { bp->outputZeroer( hostOutputChannels[j].data, @@ -1281,7 +1281,7 @@ static unsigned long AdaptingProcess( PaUtilBufferProcessor *bp, bp->hostOutputFrameCount[i] = 0; } } - } + } /* copy frames from host to user input buffers */ @@ -1339,7 +1339,7 @@ static unsigned long AdaptingProcess( PaUtilBufferProcessor *bp, bp->hostInputFrameCount[0] -= frameCount; else bp->hostInputFrameCount[1] -= frameCount; - + bp->framesInTempInputBuffer += frameCount; /* update framesAvailable and framesProcessed based on input consumed @@ -1411,13 +1411,13 @@ static unsigned long AdaptingProcess( PaUtilBufferProcessor *bp, } } - /* copy frames from user (tempOutputBuffer) to host output buffers (hostOutputChannels) + /* copy frames from user (tempOutputBuffer) to host output buffers (hostOutputChannels) Means to process the user output provided by the callback. Has to be called after each callback. */ - CopyTempOutputBuffersToHostOutputBuffers( bp ); + CopyTempOutputBuffersToHostOutputBuffers( bp ); } - + return framesProcessed; } @@ -1426,7 +1426,7 @@ unsigned long PaUtil_EndBufferProcessing( PaUtilBufferProcessor* bp, int *stream { unsigned long framesToProcess, framesToGo; unsigned long framesProcessed = 0; - + if( bp->inputChannelCount != 0 && bp->outputChannelCount != 0 && bp->hostInputChannels[0][0].data /* input was supplied (see PaUtil_SetNoInput) */ && bp->hostOutputChannels[0][0].data /* output was supplied (see PaUtil_SetNoOutput) */ ) @@ -1501,17 +1501,17 @@ unsigned long PaUtil_EndBufferProcessing( PaUtilBufferProcessor* bp, int *stream *hostOutputFrameCount ); assert( framesToProcess != 0 ); - + framesProcessedThisIteration = NonAdaptingProcess( bp, streamCallbackResult, hostInputChannels, hostOutputChannels, - framesToProcess ); + framesToProcess ); *hostInputFrameCount -= framesProcessedThisIteration; *hostOutputFrameCount -= framesProcessedThisIteration; framesProcessed += framesProcessedThisIteration; framesToGo -= framesProcessedThisIteration; - + }while( framesToGo > 0 ); } else @@ -1528,7 +1528,7 @@ unsigned long PaUtil_EndBufferProcessing( PaUtilBufferProcessor* bp, int *stream framesToProcess ); /* process second buffer if provided */ - + framesToProcess = (bp->inputChannelCount != 0) ? bp->hostInputFrameCount[1] : bp->hostOutputFrameCount[1]; @@ -1546,7 +1546,7 @@ unsigned long PaUtil_EndBufferProcessing( PaUtilBufferProcessor* bp, int *stream if( bp->inputChannelCount != 0 && bp->outputChannelCount != 0 ) { /* full duplex */ - + if( bp->hostBufferSizeMode == paUtilVariableHostBufferSizePartialUsageAllowed ) { framesProcessed = AdaptingProcess( bp, streamCallbackResult, @@ -1597,7 +1597,7 @@ unsigned long PaUtil_EndBufferProcessing( PaUtilBufferProcessor* bp, int *stream int PaUtil_IsBufferProcessorOutputEmpty( PaUtilBufferProcessor* bp ) { return (bp->framesInTempOutputBuffer) ? 0 : 1; -} +} unsigned long PaUtil_CopyInput( PaUtilBufferProcessor* bp, @@ -1617,7 +1617,7 @@ unsigned long PaUtil_CopyInput( PaUtilBufferProcessor* bp, if( bp->userInputIsInterleaved ) { destBytePtr = (unsigned char*)*buffer; - + destSampleStrideSamples = bp->inputChannelCount; destChannelStrideBytes = bp->bytesPerUserInputSample; @@ -1642,11 +1642,11 @@ unsigned long PaUtil_CopyInput( PaUtilBufferProcessor* bp, else { /* user input is not interleaved */ - + nonInterleavedDestPtrs = (void**)*buffer; destSampleStrideSamples = 1; - + for( i=0; iinputChannelCount; ++i ) { destBytePtr = (unsigned char*)nonInterleavedDestPtrs[i]; @@ -1659,7 +1659,7 @@ unsigned long PaUtil_CopyInput( PaUtilBufferProcessor* bp, /* advance callers dest pointer (nonInterleavedDestPtrs[i]) */ destBytePtr += bp->bytesPerUserInputSample * framesToCopy; nonInterleavedDestPtrs[i] = destBytePtr; - + /* advance dest ptr for next iteration */ hostInputChannels[i].data = ((unsigned char*)hostInputChannels[i].data) + framesToCopy * hostInputChannels[i].stride * bp->bytesPerHostInputSample; @@ -1667,7 +1667,7 @@ unsigned long PaUtil_CopyInput( PaUtilBufferProcessor* bp, } bp->hostInputFrameCount[0] -= framesToCopy; - + return framesToCopy; } @@ -1688,7 +1688,7 @@ unsigned long PaUtil_CopyOutput( PaUtilBufferProcessor* bp, if( bp->userOutputIsInterleaved ) { srcBytePtr = (unsigned char*)*buffer; - + srcSampleStrideSamples = bp->outputChannelCount; srcChannelStrideBytes = bp->bytesPerUserOutputSample; @@ -1714,15 +1714,15 @@ unsigned long PaUtil_CopyOutput( PaUtilBufferProcessor* bp, else { /* user output is not interleaved */ - + nonInterleavedSrcPtrs = (void**)*buffer; srcSampleStrideSamples = 1; - + for( i=0; ioutputChannelCount; ++i ) { srcBytePtr = (unsigned char*)nonInterleavedSrcPtrs[i]; - + bp->outputConverter( hostOutputChannels[i].data, hostOutputChannels[i].stride, srcBytePtr, srcSampleStrideSamples, @@ -1732,7 +1732,7 @@ unsigned long PaUtil_CopyOutput( PaUtilBufferProcessor* bp, /* advance callers source pointer (nonInterleavedSrcPtrs[i]) */ srcBytePtr += bp->bytesPerUserOutputSample * framesToCopy; nonInterleavedSrcPtrs[i] = srcBytePtr; - + /* advance dest ptr for next iteration */ hostOutputChannels[i].data = ((unsigned char*)hostOutputChannels[i].data) + framesToCopy * hostOutputChannels[i].stride * bp->bytesPerHostOutputSample; @@ -1740,7 +1740,7 @@ unsigned long PaUtil_CopyOutput( PaUtilBufferProcessor* bp, } bp->hostOutputFrameCount[0] += framesToCopy; - + return framesToCopy; } @@ -1767,6 +1767,6 @@ unsigned long PaUtil_ZeroOutput( PaUtilBufferProcessor* bp, unsigned long frameC } bp->hostOutputFrameCount[0] += framesToZero; - + return framesToZero; } diff --git a/3rdparty/portaudio/src/common/pa_process.h b/3rdparty/portaudio/src/common/pa_process.h index 89584bc074..ddc65c669d 100644 --- a/3rdparty/portaudio/src/common/pa_process.h +++ b/3rdparty/portaudio/src/common/pa_process.h @@ -28,16 +28,16 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ - + /** @file @ingroup common_src @@ -72,7 +72,7 @@ The following sections provide an overview of how to use the buffer processor. Interested readers are advised to consult the host API implementations for examples of buffer processor usage. - +

Initialization, resetting and termination

@@ -92,7 +92,7 @@ When the buffer processor is no longer used call PaUtil_TerminateBufferProcessor. - +

Using the buffer processor for a callback stream

The buffer processor's role in a callback stream is to take host input buffers @@ -176,7 +176,7 @@ host buffer(s), so the above steps need to be repeated until the user buffer(s) are full. - + To copy data to the host output buffer from the user buffers(s) supplied to Pa_WriteStream use the following calling sequence. @@ -192,7 +192,7 @@ -# Call PaUtil_CopyOutput with the user buffer pointer (or a copy of the array of buffer pointers for a non-interleaved stream) passed to Pa_WriteStream, along with the number of frames in the user buffer(s). - Be careful to pass a copy of the user buffer pointers to + Be careful to pass a copy of the user buffer pointers to PaUtil_CopyOutput because PaUtil_CopyOutput advances the pointers to the start of the next region to copy. - PaUtil_CopyOutput will not copy more data than fits in the host buffer(s), @@ -264,7 +264,7 @@ typedef struct { int userInputIsInterleaved; PaUtilConverter *inputConverter; PaUtilZeroer *inputZeroer; - + unsigned int outputChannelCount; unsigned int bytesPerHostOutputSample; unsigned int bytesPerUserOutputSample; @@ -323,7 +323,7 @@ typedef struct { @param userInputSampleFormat Format of user input samples, as passed to Pa_OpenStream. This parameter is ignored for ouput-only streams. - + @param hostInputSampleFormat Format of host input samples. This parameter is ignored for output-only streams. See note about host buffer interleave below. @@ -332,17 +332,17 @@ typedef struct { @param userOutputSampleFormat Format of user output samples, as passed to Pa_OpenStream. This parameter is ignored for input-only streams. - + @param hostOutputSampleFormat Format of host output samples. This parameter is ignored for input-only streams. See note about host buffer interleave below. @param sampleRate Sample rate of the stream. The more accurate this is the better - it is used for updating time stamps when adapting buffers. - + @param streamFlags Stream flags as passed to Pa_OpenStream, this parameter is used for selecting special sample conversion options such as clipping and dithering. - + @param framesPerUserBuffer Number of frames per user buffer, as requested by the framesPerBuffer parameter to Pa_OpenStream. This parameter may be zero to indicate that the user will accept any (and varying) buffer sizes. @@ -355,11 +355,11 @@ typedef struct { @param hostBufferSizeMode A mode flag indicating the size variability of host buffers that will be passed to the buffer processor. See PaUtilHostBufferSizeMode for further details. - + @param streamCallback The user stream callback passed to Pa_OpenStream. @param userData The user data field passed to Pa_OpenStream. - + @note The interleave flag is ignored for host buffer formats. Host interleave is determined by the use of different SetInput and SetOutput functions. @@ -367,7 +367,7 @@ typedef struct { @return An error code indicating whether the initialization was successful. If the error code is not PaNoError, the buffer processor was not initialized and should not be used. - + @see Pa_OpenStream, PaUtilHostBufferSizeMode, PaUtil_TerminateBufferProcessor */ PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bufferProcessor, @@ -385,7 +385,7 @@ PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bufferProcessor /** Terminate a buffer processor's representation. Deallocates any temporary buffers allocated by PaUtil_InitializeBufferProcessor. - + @param bufferProcessor The buffer processor structure to terminate. @see PaUtil_InitializeBufferProcessor. @@ -430,7 +430,7 @@ unsigned long PaUtil_GetBufferProcessorOutputLatency( PaUtilBufferProcessor* buf Functions to set host input and output buffers, used by both callback streams and blocking read/write streams. */ -/*@{*/ +/*@{*/ /** Set the number of frames in the input host buffer(s) specified by the @@ -447,7 +447,7 @@ unsigned long PaUtil_GetBufferProcessorOutputLatency( PaUtilBufferProcessor* buf void PaUtil_SetInputFrameCount( PaUtilBufferProcessor* bufferProcessor, unsigned long frameCount ); - + /** Indicate that no input is avalable. This function should be used when priming the output of a full-duplex stream opened with the paPrimeOutputBuffersUsingStreamCallback flag. Note that it is not necessary @@ -520,7 +520,7 @@ void PaUtil_Set2ndInterleavedInputChannels( PaUtilBufferProcessor* bufferProcess void PaUtil_Set2ndNonInterleavedInputChannel( PaUtilBufferProcessor* bufferProcessor, unsigned int channel, void *data ); - + /** Set the number of frames in the output host buffer(s) specified by the PaUtil_Set*OutputChannel functions. @@ -570,7 +570,7 @@ void PaUtil_SetOutputChannel( PaUtilBufferProcessor* bufferProcessor, void PaUtil_SetInterleavedOutputChannels( PaUtilBufferProcessor* bufferProcessor, unsigned int firstChannel, void *data, unsigned int channelCount ); - + /** Provide the buffer processor with a pointer to one non-interleaved host output channel. @@ -628,12 +628,12 @@ void PaUtil_Set2ndNonInterleavedOutputChannel( PaUtilBufferProcessor* bufferProc void PaUtil_BeginBufferProcessing( PaUtilBufferProcessor* bufferProcessor, PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags callbackStatusFlags ); - + /** Finish processing a host buffer (or a pair of host buffers in the full-duplex case) for a callback stream. @param bufferProcessor The buffer processor. - + @param callbackResult On input, indicates a previous callback result, and on exit, the result of the user stream callback, if it is called. On entry callbackResult should contain one of { paContinue, paComplete, or @@ -662,7 +662,7 @@ unsigned long PaUtil_EndBufferProcessing( PaUtilBufferProcessor* bufferProcessor a callbackResult of paComplete. @param bufferProcessor The buffer processor. - + @return Returns non-zero when callback generated output remains in the internal buffer and zero (0) when there internal buffer contains no callback generated data. @@ -734,7 +734,7 @@ unsigned long PaUtil_CopyOutput( PaUtilBufferProcessor* bufferProcessor, @param bufferProcessor The buffer processor. @param frameCount The maximum number of frames to zero. - + @return The number of frames zeroed. */ unsigned long PaUtil_ZeroOutput( PaUtilBufferProcessor* bufferProcessor, diff --git a/3rdparty/portaudio/src/common/pa_ringbuffer.c b/3rdparty/portaudio/src/common/pa_ringbuffer.c index 310d719f2c..4163efe467 100644 --- a/3rdparty/portaudio/src/common/pa_ringbuffer.c +++ b/3rdparty/portaudio/src/common/pa_ringbuffer.c @@ -7,7 +7,7 @@ * modified for SMP safety on Mac OS X by Bjorn Roche * modified for SMP safety on Linux by Leland Lucius * also, allowed for const where possible - * modified for multiple-byte-sized data elements by Sven Fischer + * modified for multiple-byte-sized data elements by Sven Fischer * * Note that this is safe only for a single-thread reader and a * single-thread writer. @@ -37,13 +37,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/common/pa_ringbuffer.h b/3rdparty/portaudio/src/common/pa_ringbuffer.h index 7efd1914d9..e11ced3cf6 100644 --- a/3rdparty/portaudio/src/common/pa_ringbuffer.h +++ b/3rdparty/portaudio/src/common/pa_ringbuffer.h @@ -8,7 +8,7 @@ * Author: Phil Burk, http://www.softsynth.com * modified for SMP safety on OS X by Bjorn Roche. * also allowed for const where possible. - * modified for multiple-byte-sized data elements by Sven Fischer + * modified for multiple-byte-sized data elements by Sven Fischer * * Note that this is safe only for a single-thread reader * and a single-thread writer. @@ -38,13 +38,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -58,11 +58,11 @@ a single reader and a single writer (ie. one thread or callback writes to the ring buffer, another thread or callback reads from it). - The PaUtilRingBuffer structure manages a ring buffer containing N - elements, where N must be a power of two. An element may be any size + The PaUtilRingBuffer structure manages a ring buffer containing N + elements, where N must be a power of two. An element may be any size (specified in bytes). - The memory area used to store the buffer elements must be allocated by + The memory area used to store the buffer elements must be allocated by the client prior to calling PaUtil_InitializeRingBuffer() and must outlive the use of the ring buffer. */ diff --git a/3rdparty/portaudio/src/common/pa_skeleton.c b/3rdparty/portaudio/src/common/pa_skeleton.c index d5cb52d82d..d22533a4a2 100644 --- a/3rdparty/portaudio/src/common/pa_skeleton.c +++ b/3rdparty/portaudio/src/common/pa_skeleton.c @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -152,10 +152,10 @@ PaError PaSkeleton_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiI (*hostApi)->info.defaultInputDevice = paNoDevice; /* IMPLEMENT ME */ (*hostApi)->info.defaultOutputDevice = paNoDevice; /* IMPLEMENT ME */ - (*hostApi)->info.deviceCount = 0; + (*hostApi)->info.deviceCount = 0; deviceCount = 0; /* IMPLEMENT ME */ - + if( deviceCount > 0 ) { (*hostApi)->deviceInfos = (PaDeviceInfo**)PaUtil_GroupAllocateMemory( @@ -193,14 +193,14 @@ PaError PaSkeleton_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiI deviceInfo->maxInputChannels = 0; /* IMPLEMENT ME */ deviceInfo->maxOutputChannels = 0; /* IMPLEMENT ME */ - + deviceInfo->defaultLowInputLatency = 0.; /* IMPLEMENT ME */ deviceInfo->defaultLowOutputLatency = 0.; /* IMPLEMENT ME */ deviceInfo->defaultHighInputLatency = 0.; /* IMPLEMENT ME */ - deviceInfo->defaultHighOutputLatency = 0.; /* IMPLEMENT ME */ + deviceInfo->defaultHighOutputLatency = 0.; /* IMPLEMENT ME */ deviceInfo->defaultSampleRate = 0.; /* IMPLEMENT ME */ - + (*hostApi)->deviceInfos[i] = deviceInfo; ++(*hostApi)->info.deviceCount; } @@ -231,7 +231,7 @@ error: PaUtil_FreeAllAllocations( skeletonHostApi->allocations ); PaUtil_DestroyAllocationGroup( skeletonHostApi->allocations ); } - + PaUtil_FreeMemory( skeletonHostApi ); } return result; @@ -264,7 +264,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, { int inputChannelCount, outputChannelCount; PaSampleFormat inputSampleFormat, outputSampleFormat; - + if( inputParameters ) { inputChannelCount = inputParameters->channelCount; @@ -274,7 +274,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, this implementation doesn't support any custom sample formats */ if( inputSampleFormat & paCustomFormat ) return paSampleFormatNotSupported; - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ @@ -303,7 +303,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, this implementation doesn't support any custom sample formats */ if( outputSampleFormat & paCustomFormat ) return paSampleFormatNotSupported; - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ @@ -322,7 +322,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, { outputChannelCount = 0; } - + /* IMPLEMENT ME: @@ -420,7 +420,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, { outputChannelCount = outputParameters->channelCount; outputSampleFormat = outputParameters->sampleFormat; - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ @@ -499,10 +499,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, /* we assume a fixed host buffer size in this example, but the buffer processor - can also support bounded and unknown host buffer sizes by passing + can also support bounded and unknown host buffer sizes by passing paUtilBoundedHostBufferSize or paUtilUnknownHostBufferSize instead of paUtilFixedHostBufferSize below. */ - + result = PaUtil_InitializeBufferProcessor( &stream->bufferProcessor, inputChannelCount, inputSampleFormat, hostInputSampleFormat, outputChannelCount, outputSampleFormat, hostOutputSampleFormat, @@ -523,7 +523,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor); stream->streamRepresentation.streamInfo.sampleRate = sampleRate; - + /* IMPLEMENT ME: - additional stream setup + opening @@ -545,7 +545,7 @@ error: /* ExampleHostProcessingLoop() illustrates the kind of processing which may occur in a host implementation. - + */ static void ExampleHostProcessingLoop( void *inputBuffer, void *outputBuffer, void *userData ) { @@ -553,9 +553,9 @@ static void ExampleHostProcessingLoop( void *inputBuffer, void *outputBuffer, vo PaStreamCallbackTimeInfo timeInfo = {0,0,0}; /* IMPLEMENT ME */ int callbackResult; unsigned long framesProcessed; - + PaUtil_BeginCpuLoadMeasurement( &stream->cpuLoadMeasurer ); - + /* IMPLEMENT ME: - generate timing information @@ -576,7 +576,7 @@ static void ExampleHostProcessingLoop( void *inputBuffer, void *outputBuffer, vo or a mixture, you will want to call PaUtil_SetInterleaved*Channels(), PaUtil_SetNonInterleaved*Channel() or PaUtil_Set*Channel() here. */ - + PaUtil_SetInputFrameCount( &stream->bufferProcessor, 0 /* default to host buffer size */ ); PaUtil_SetInterleavedInputChannels( &stream->bufferProcessor, 0, /* first channel of inputBuffer is channel 0 */ @@ -598,7 +598,7 @@ static void ExampleHostProcessingLoop( void *inputBuffer, void *outputBuffer, vo callbackResult = paContinue; framesProcessed = PaUtil_EndBufferProcessing( &stream->bufferProcessor, &callbackResult ); - + /* If you need to byte swap or shift outputBuffer to convert it to host format, do it here. @@ -694,7 +694,7 @@ static PaError AbortStream( PaStream *s ) /* suppress unused variable warnings */ (void) stream; - + /* IMPLEMENT ME, see portaudio.h for required behavior */ return result; @@ -707,7 +707,7 @@ static PaError IsStreamStopped( PaStream *s ) /* suppress unused variable warnings */ (void) stream; - + /* IMPLEMENT ME, see portaudio.h for required behavior */ return 0; @@ -720,7 +720,7 @@ static PaError IsStreamActive( PaStream *s ) /* suppress unused variable warnings */ (void) stream; - + /* IMPLEMENT ME, see portaudio.h for required behavior */ return 0; @@ -733,7 +733,7 @@ static PaTime GetStreamTime( PaStream *s ) /* suppress unused variable warnings */ (void) stream; - + /* IMPLEMENT ME, see portaudio.h for required behavior*/ return 0; @@ -764,7 +764,7 @@ static PaError ReadStream( PaStream* s, (void) buffer; (void) frames; (void) stream; - + /* IMPLEMENT ME, see portaudio.h for required behavior*/ return paNoError; @@ -781,7 +781,7 @@ static PaError WriteStream( PaStream* s, (void) buffer; (void) frames; (void) stream; - + /* IMPLEMENT ME, see portaudio.h for required behavior*/ return paNoError; @@ -794,7 +794,7 @@ static signed long GetStreamReadAvailable( PaStream* s ) /* suppress unused variable warnings */ (void) stream; - + /* IMPLEMENT ME, see portaudio.h for required behavior*/ return 0; @@ -807,7 +807,7 @@ static signed long GetStreamWriteAvailable( PaStream* s ) /* suppress unused variable warnings */ (void) stream; - + /* IMPLEMENT ME, see portaudio.h for required behavior*/ return 0; diff --git a/3rdparty/portaudio/src/common/pa_stream.c b/3rdparty/portaudio/src/common/pa_stream.c index ea91821f8d..d61a5fba3d 100644 --- a/3rdparty/portaudio/src/common/pa_stream.c +++ b/3rdparty/portaudio/src/common/pa_stream.c @@ -27,13 +27,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/common/pa_stream.h b/3rdparty/portaudio/src/common/pa_stream.h index 8d707b79cf..e6490b9157 100644 --- a/3rdparty/portaudio/src/common/pa_stream.h +++ b/3rdparty/portaudio/src/common/pa_stream.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -164,7 +164,7 @@ void PaUtil_InitializeStreamRepresentation( PaUtilStreamInterface *streamInterface, PaStreamCallback *streamCallback, void *userData ); - + /** Clean up a PaUtilStreamRepresentation structure previously initialized by a call to PaUtil_InitializeStreamRepresentation. @@ -198,7 +198,7 @@ PaError PaUtil_ValidateStreamPointer( PaStream *stream ); PA_STREAM_REP( (stream) )->streamInterface - + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/3rdparty/portaudio/src/common/pa_trace.c b/3rdparty/portaudio/src/common/pa_trace.c index 24305003f7..99d19a0eeb 100644 --- a/3rdparty/portaudio/src/common/pa_trace.c +++ b/3rdparty/portaudio/src/common/pa_trace.c @@ -27,13 +27,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/common/pa_trace.h b/3rdparty/portaudio/src/common/pa_trace.h index b11509e0ec..f0cd6245a4 100644 --- a/3rdparty/portaudio/src/common/pa_trace.h +++ b/3rdparty/portaudio/src/common/pa_trace.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -45,8 +45,8 @@ @brief Real-time safe event trace logging facility for debugging. Allows data to be logged to a fixed size trace buffer in a real-time - execution context (such as at interrupt time). Each log entry consists - of a message comprising a string pointer and an int. The trace buffer + execution context (such as at interrupt time). Each log entry consists + of a message comprising a string pointer and an int. The trace buffer may be dumped to stdout later. This facility is only active if PA_TRACE_REALTIME_EVENTS is set to 1, @@ -57,8 +57,8 @@ @fn PaUtil_AddTraceMessage @brief Add a message to the trace buffer. A message consists of string and an int. - @param msg The string pointer must remain valid until PaUtil_DumpTraceMessages - is called. As a result, usually only string literals should be passed as + @param msg The string pointer must remain valid until PaUtil_DumpTraceMessages + is called. As a result, usually only string literals should be passed as the msg parameter. @fn PaUtil_DumpTraceMessages @@ -70,7 +70,7 @@ #endif #ifndef PA_MAX_TRACE_RECORDS -#define PA_MAX_TRACE_RECORDS (2048) /**< Maximum number of records stored in trace buffer */ +#define PA_MAX_TRACE_RECORDS (2048) /**< Maximum number of records stored in trace buffer */ #endif #ifdef __cplusplus @@ -84,7 +84,7 @@ extern "C" void PaUtil_ResetTraceMessages(); void PaUtil_AddTraceMessage( const char *msg, int data ); void PaUtil_DumpTraceMessages(); - + #else #define PaUtil_ResetTraceMessages() /* noop */ diff --git a/3rdparty/portaudio/src/common/pa_types.h b/3rdparty/portaudio/src/common/pa_types.h index 5b647d641e..f628783adf 100644 --- a/3rdparty/portaudio/src/common/pa_types.h +++ b/3rdparty/portaudio/src/common/pa_types.h @@ -1,7 +1,7 @@ #ifndef PA_TYPES_H #define PA_TYPES_H -/* +/* * Portable Audio I/O Library * integer type definitions * @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/common/pa_util.h b/3rdparty/portaudio/src/common/pa_util.h index 95ea6789a6..33bf474483 100644 --- a/3rdparty/portaudio/src/common/pa_util.h +++ b/3rdparty/portaudio/src/common/pa_util.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -115,7 +115,7 @@ void PaUtil_SetLastHostErrorInfo( PaHostApiTypeId hostApiType, long errorCode, const char *errorText ); - + /* the following functions are implemented in a platform platform specific .c file */ diff --git a/3rdparty/portaudio/src/hostapi/alsa/pa_linux_alsa.c b/3rdparty/portaudio/src/hostapi/alsa/pa_linux_alsa.c index 224f4ff636..cd51fddee9 100644 --- a/3rdparty/portaudio/src/hostapi/alsa/pa_linux_alsa.c +++ b/3rdparty/portaudio/src/hostapi/alsa/pa_linux_alsa.c @@ -32,13 +32,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -320,7 +320,7 @@ static void Terminate( struct PaUtilHostApiRepresentation *hostApi ) /** Determine max channels and default latencies. * - * This function provides functionality to grope an opened (might be opened for capture or playback) pcm device for + * This function provides functionality to grope an opened (might be opened for capture or playback) pcm device for * traits like max channels, suitable default latencies and default sample rate. Upon error, max channels is set to zero, * and a suitable result returned. The device is closed before returning. */ @@ -379,7 +379,7 @@ static PaError GropeDevice( snd_pcm_t* pcm, int isPlug, StreamDirection mode, in } ENSURE_( GetExactSampleRate( hwParams, &defaultSr ), paUnanticipatedHostError ); } - + ENSURE_( snd_pcm_hw_params_get_channels_min( hwParams, &minChans ), paUnanticipatedHostError ); ENSURE_( snd_pcm_hw_params_get_channels_max( hwParams, &maxChans ), paUnanticipatedHostError ); assert( maxChans <= INT_MAX ); @@ -415,7 +415,7 @@ static PaError GropeDevice( snd_pcm_t* pcm, int isPlug, StreamDirection mode, in ENSURE_( snd_pcm_hw_params_set_buffer_size_near( pcm, hwParams, &lowLatency ), paUnanticipatedHostError ); /* Have to reset hwParams, to set new buffer size */ - ENSURE_( snd_pcm_hw_params_any( pcm, hwParams ), paUnanticipatedHostError ); + ENSURE_( snd_pcm_hw_params_any( pcm, hwParams ), paUnanticipatedHostError ); ENSURE_( snd_pcm_hw_params_set_buffer_size_near( pcm, hwParams, &highLatency ), paUnanticipatedHostError ); *minChannels = (int)minChans; @@ -706,7 +706,7 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi ) { hasCapture = 1; } - + snd_pcm_info_set_stream( pcmInfo, SND_PCM_STREAM_PLAYBACK ); if( snd_ctl_pcm_info( ctl, pcmInfo ) >= 0 ) { @@ -774,7 +774,7 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi ) ENSURE_(err, paUnanticipatedHostError); } } - else + else { ENSURE_( snd_config_get_string( tp, &tpStr ), paUnanticipatedHostError ); } @@ -986,7 +986,7 @@ static snd_pcm_format_t Pa2AlsaFormat( PaSampleFormat paFormat ) } /** Open an ALSA pcm handle. - * + * * The device to be open can be specified in a custom PaAlsaStreamInfo struct, or it will be a device number. In case of a * device number, it maybe specified through an env variable (PA_ALSA_PLUGHW) that we should open the corresponding plugin * device. @@ -1005,7 +1005,7 @@ static PaError AlsaOpen( const PaUtilHostApiRepresentation *hostApi, const PaStr { int usePlug = 0; deviceInfo = GetDeviceInfo( hostApi, params->device ); - + /* If device name starts with hw: and PA_ALSA_PLUGHW is 1, we open the plughw device instead */ if( !strncmp( "hw:", deviceInfo->alsaName, 3 ) && getenv( "PA_ALSA_PLUGHW" ) ) usePlug = atoi( getenv( "PA_ALSA_PLUGHW" ) ); @@ -1045,7 +1045,7 @@ static PaError TestParameters( const PaUtilHostApiRepresentation *hostApi, const PaSampleFormat hostFormat; snd_pcm_hw_params_t *hwParams; snd_pcm_hw_params_alloca( &hwParams ); - + if( !parameters->hostApiSpecificStreamInfo ) { const PaAlsaDeviceInfo *devInfo = GetDeviceInfo( hostApi, parameters->device ); @@ -1296,7 +1296,7 @@ static PaError PaAlsaStreamComponent_InitialConfigure( PaAlsaStreamComponent *se /* reject if there's no sample rate within 1% of the one requested */ if( (fabs( *sampleRate - sr ) / *sampleRate) > 0.01 ) { - PA_DEBUG(("%s: Wanted %f, closest sample rate was %d\n", __FUNCTION__, sampleRate, sr )); + PA_DEBUG(("%s: Wanted %f, closest sample rate was %d\n", __FUNCTION__, sampleRate, sr )); PA_ENSURE( paInvalidSampleRate ); } @@ -1361,7 +1361,7 @@ static PaError PaAlsaStreamComponent_FinishConfigure( PaAlsaStreamComponent *sel ENSURE_( snd_pcm_sw_params_set_silence_threshold( self->pcm, swParams, 0 ), paUnanticipatedHostError ); ENSURE_( snd_pcm_sw_params_set_silence_size( self->pcm, swParams, boundary ), paUnanticipatedHostError ); } - + ENSURE_( snd_pcm_sw_params_set_avail_min( self->pcm, swParams, self->framesPerBuffer ), paUnanticipatedHostError ); ENSURE_( snd_pcm_sw_params_set_xfer_align( self->pcm, swParams, 1 ), paUnanticipatedHostError ); ENSURE_( snd_pcm_sw_params_set_tstamp_mode( self->pcm, swParams, SND_PCM_TSTAMP_ENABLE ), paUnanticipatedHostError ); @@ -1473,7 +1473,7 @@ static PaError PaAlsaStreamComponent_DetermineFramesPerBuffer( PaAlsaStreamCompo PaError result = paNoError; unsigned long bufferSize = params->suggestedLatency * sampleRate, framesPerHostBuffer; int dir = 0; - + { snd_pcm_uframes_t tmp; snd_pcm_hw_params_get_buffer_size_min( hwParams, &tmp ); @@ -1653,7 +1653,7 @@ error: * buffer size, this method tries it best to determine a period size which is a multiple of the user buffer size. * * The framesPerBuffer attributes of the individual capture and playback components of the stream are set to corresponding - * values determined here. Since these should be reported as + * values determined here. Since these should be reported as * * This is one of those blocks of code that will just take a lot of * refinement to be any good. @@ -1745,7 +1745,7 @@ static PaError PaAlsaStream_DetermineFramesPerBuffer( PaAlsaStream* self, double } optimalPeriodSize /= 2; } - + if( optimalPeriodSize > periodSize ) periodSize = optimalPeriodSize; @@ -2051,7 +2051,7 @@ static void SilenceBuffer( PaAlsaStream *stream ) * Depending on wether the stream is in callback or blocking mode, we will respectively start or simply * prepare the playback pcm. If the buffer has _not_ been primed, we will in callback mode prepare and * silence the buffer before starting playback. In blocking mode we simply prepare, as the playback will - * be started automatically as the user writes to output. + * be started automatically as the user writes to output. * * The capture pcm, however, will simply be prepared and started. */ @@ -2160,7 +2160,7 @@ error: AbortStream( stream ); } stream->isActive = 0; - + goto end; } @@ -2362,7 +2362,7 @@ static int SetApproximateSampleRate( snd_pcm_t *pcm, snd_pcm_hw_params_t *hwPara static int GetExactSampleRate( snd_pcm_hw_params_t *hwParams, double *sampleRate ) { unsigned int num, den; - int err; + int err; assert( hwParams ); @@ -2435,7 +2435,7 @@ error: } /** Decide if we should continue polling for specified direction, eventually adjust the poll timeout. - * + * */ static PaError ContinuePoll( const PaAlsaStream *stream, StreamDirection streamDir, int *pollTimeout, int *continuePoll ) { @@ -2506,7 +2506,7 @@ static void OnExit( void *data ) stream->callback_finished = 1; /* Let the outside world know stream was stopped in callback */ PA_DEBUG(( "%s: Stopping ALSA handles\n", __FUNCTION__ )); AlsaStop( stream, stream->callbackAbort ); - + PA_DEBUG(( "%s: Stoppage\n", __FUNCTION__ )); /* Eventually notify user all buffers have played */ @@ -2859,7 +2859,7 @@ error: * * @param framesAvail Return the number of available frames * @param xrunOccurred Return whether an xrun has occurred - */ + */ static PaError PaAlsaStream_WaitForFrames( PaAlsaStream *self, unsigned long *framesAvail, int *xrunOccurred ) { PaError result = paNoError; @@ -2911,7 +2911,7 @@ static PaError PaAlsaStream_WaitForFrames( PaAlsaStream *self, unsigned long *fr PA_ENSURE( PaAlsaStreamComponent_BeginPolling( &self->playback, playbackPfds ) ); totalFds += self->playback.nfds; } - + if( poll( self->pfds, totalFds, pollTimeout ) < 0 ) { /* XXX: Depend on preprocessor condition? */ @@ -3010,7 +3010,7 @@ error: * * Mmapped buffer space is acquired from ALSA, and registered with the buffer processor. Differences between the * number of host and user channels is taken into account. - * + * * @param numFrames On entrance the number of requested frames, on exit the number of contiguously accessible frames. */ static PaError PaAlsaStreamComponent_RegisterChannels( PaAlsaStreamComponent* self, PaUtilBufferProcessor* bp, @@ -3140,13 +3140,13 @@ static PaError PaAlsaStream_SetUpBuffers( PaAlsaStream* self, unsigned long* num if( self->capture.pcm && self->capture.ready ) { captureFrames = *numFrames; - PA_ENSURE( PaAlsaStreamComponent_RegisterChannels( &self->capture, &self->bufferProcessor, &captureFrames, + PA_ENSURE( PaAlsaStreamComponent_RegisterChannels( &self->capture, &self->bufferProcessor, &captureFrames, &xrun ) ); } if( self->playback.pcm && self->playback.ready ) { playbackFrames = *numFrames; - PA_ENSURE( PaAlsaStreamComponent_RegisterChannels( &self->playback, &self->bufferProcessor, &playbackFrames, + PA_ENSURE( PaAlsaStreamComponent_RegisterChannels( &self->playback, &self->bufferProcessor, &playbackFrames, &xrun ) ); } if( xrun ) @@ -3171,7 +3171,7 @@ static PaError PaAlsaStream_SetUpBuffers( PaAlsaStream* self, unsigned long* num { PA_DEBUG(( "%s: playbackFrames: %lu, playback.ready: %d\n", __FUNCTION__, playbackFrames, self->playback.ready )); } - + commonFrames = 0; goto end; } @@ -3208,7 +3208,7 @@ static PaError PaAlsaStream_SetUpBuffers( PaAlsaStream* self, unsigned long* num PaUtil_SetNoOutput( &self->bufferProcessor ); } } - + end: *numFrames = commonFrames; error: @@ -3254,7 +3254,7 @@ static void *CallbackThreadFunc( void *userData ) if( stream->primeBuffers ) { snd_pcm_sframes_t avail; - + if( stream->playback.pcm ) ENSURE_( snd_pcm_prepare( stream->playback.pcm ), paUnanticipatedHostError ); if( stream->capture.pcm && !stream->pcmsSynced ) @@ -3297,7 +3297,7 @@ static void *CallbackThreadFunc( void *userData ) stream->callbackAbort = (paAbort == callbackResult); if( stream->callbackAbort || /** @concern BlockAdaption: Go on if adaption buffers are empty */ - PaUtil_IsBufferProcessorOutputEmpty( &stream->bufferProcessor ) ) + PaUtil_IsBufferProcessorOutputEmpty( &stream->bufferProcessor ) ) { goto end; } @@ -3484,7 +3484,7 @@ static PaError WriteStream( PaStream* s, const void *buffer, unsigned long frame snd_pcm_uframes_t framesGot, framesAvail; const void *userBuffer; snd_pcm_t *save = stream->capture.pcm; - + assert( stream ); PA_UNLESS( stream->playback.pcm, paCanNotWriteToAnInputOnlyStream ); @@ -3622,11 +3622,11 @@ static PaError GetAlsaStreamPointer( PaStream* s, PaAlsaStream** stream ) PaError result = paNoError; PaUtilHostApiRepresentation* hostApi; PaAlsaHostApiRepresentation* alsaHostApi; - + PA_ENSURE( PaUtil_ValidateStreamPointer( s ) ); PA_ENSURE( PaUtil_GetHostApiRepresentation( &hostApi, paALSA ) ); alsaHostApi = (PaAlsaHostApiRepresentation*)hostApi; - + PA_UNLESS( PA_STREAM_REP( s )->streamInterface == &alsaHostApi->callbackStreamInterface || PA_STREAM_REP( s )->streamInterface == &alsaHostApi->blockingStreamInterface, paIncompatibleStreamHostApi ); diff --git a/3rdparty/portaudio/src/hostapi/asihpi/pa_linux_asihpi.c b/3rdparty/portaudio/src/hostapi/asihpi/pa_linux_asihpi.c index 3ebfafa019..0646e9c9d4 100644 --- a/3rdparty/portaudio/src/hostapi/asihpi/pa_linux_asihpi.c +++ b/3rdparty/portaudio/src/hostapi/asihpi/pa_linux_asihpi.c @@ -1950,10 +1950,10 @@ static PaError PaAsiHpi_PrimeOutputWithSilence( PaAsiHpiStream *stream ) zeroer(out->tempBuffer, 1, out->tempBufferSize / Pa_GetSampleSize(outputFormat) ); /* Write temp buffer to hardware fifo twice, to get started */ #if (HPI_VER >= HPI_VERSION_CONSTRUCTOR( 3, 5, 5 )) - PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( out->hpiDevice->subSys, out->hpiStream, + PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( out->hpiDevice->subSys, out->hpiStream, out->tempBuffer, out->tempBufferSize, &out->hpiFormat), paUnanticipatedHostError ); - PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( out->hpiDevice->subSys, out->hpiStream, + PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( out->hpiDevice->subSys, out->hpiStream, out->tempBuffer, out->tempBufferSize, &out->hpiFormat), paUnanticipatedHostError ); #else @@ -2482,7 +2482,7 @@ static PaError PaAsiHpi_BeginProcessing( PaAsiHpiStream *stream, unsigned long * if( stream->input ) { PaAsiHpiStreamInfo info; - + #if (HPI_VER < HPI_VERSION_CONSTRUCTOR( 3, 5, 5 )) HPI_DATA data; #endif @@ -2514,7 +2514,7 @@ static PaError PaAsiHpi_BeginProcessing( PaAsiHpiStream *stream, unsigned long * #if (HPI_VER >= HPI_VERSION_CONSTRUCTOR( 3, 5, 5 )) /* Read block of data into temp buffer */ PA_ASIHPI_UNLESS_( HPI_InStreamReadBuf( stream->input->hpiDevice->subSys, - stream->input->hpiStream, + stream->input->hpiStream, stream->input->tempBuffer, framesToGet * stream->input->bytesPerFrame), paUnanticipatedHostError ); @@ -2583,9 +2583,9 @@ static PaError PaAsiHpi_EndProcessing( PaAsiHpiStream *stream, unsigned long num #if (HPI_VER >= HPI_VERSION_CONSTRUCTOR( 3, 5, 5 )) /* Write temp buffer to HPI stream */ PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( stream->output->hpiDevice->subSys, - stream->output->hpiStream, + stream->output->hpiStream, stream->output->tempBuffer, - numFrames * stream->output->bytesPerFrame, + numFrames * stream->output->bytesPerFrame, &stream->output->hpiFormat), paUnanticipatedHostError ); #else diff --git a/3rdparty/portaudio/src/hostapi/asio/iasiothiscallresolver.cpp b/3rdparty/portaudio/src/hostapi/asio/iasiothiscallresolver.cpp index 8dfefbd67b..89f0361c7d 100644 --- a/3rdparty/portaudio/src/hostapi/asio/iasiothiscallresolver.cpp +++ b/3rdparty/portaudio/src/hostapi/asio/iasiothiscallresolver.cpp @@ -71,7 +71,7 @@ (IUnknown functions) 0 virtual HRESULT STDMETHODCALLTYPE (*QueryInterface)(REFIID riid, void **ppv) = 0; 4 virtual ULONG STDMETHODCALLTYPE (*AddRef)() = 0; - 8 virtual ULONG STDMETHODCALLTYPE (*Release)() = 0; + 8 virtual ULONG STDMETHODCALLTYPE (*Release)() = 0; (IASIO functions) 12 virtual ASIOBool (*init)(void *sysHandle) = 0; @@ -128,7 +128,7 @@ with MSVC, and requires that you ship the OpenASIO DLL with your application. - + ACKNOWLEDGEMENTS Ross Bencina: worked out the thiscall details above, wrote the original @@ -186,7 +186,7 @@ extern IASIO* theAsioDriver; // The following macros define the inline assembler for BORLAND first then gcc -#if defined(__BCPLUSPLUS__) || defined(__BORLANDC__) +#if defined(__BCPLUSPLUS__) || defined(__BORLANDC__) #define CALL_THISCALL_0( resultName, thisPtr, funcOffset )\ @@ -383,7 +383,7 @@ ULONG STDMETHODCALLTYPE IASIOThiscallResolver::AddRef() ULONG STDMETHODCALLTYPE IASIOThiscallResolver::Release() { assert( false ); // this function should never be called by the ASIO SDK. - + return 1; } @@ -465,7 +465,7 @@ ASIOError IASIOThiscallResolver::getSampleRate(ASIOSampleRate *sampleRate) } ASIOError IASIOThiscallResolver::setSampleRate(ASIOSampleRate sampleRate) -{ +{ ASIOBool result; CALL_THISCALL_1_DOUBLE( result, that_, 56, sampleRate ); return result; diff --git a/3rdparty/portaudio/src/hostapi/asio/pa_asio.cpp b/3rdparty/portaudio/src/hostapi/asio/pa_asio.cpp index 6b1b822a5e..b246f96233 100644 --- a/3rdparty/portaudio/src/hostapi/asio/pa_asio.cpp +++ b/3rdparty/portaudio/src/hostapi/asio/pa_asio.cpp @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -83,7 +83,7 @@ @todo review ReadStream, WriteStream, GetStreamReadAvailable, GetStreamWriteAvailable - @todo review Blocking i/o latency computations in OpenStream(), changing ring + @todo review Blocking i/o latency computations in OpenStream(), changing ring buffer to a non-power-of-two structure could reduce blocking i/o latency. @todo implement IsFormatSupported @@ -171,8 +171,8 @@ /* external reference to ASIO SDK's asioDrivers. - This is a bit messy because we want to explicitly manage - allocation/deallocation of this structure, but some layers of the SDK + This is a bit messy because we want to explicitly manage + allocation/deallocation of this structure, but some layers of the SDK which we currently use (eg the implementation in asio.cpp) still use this global version. @@ -322,7 +322,7 @@ typedef struct AsioDrivers *asioDrivers; void *systemSpecific; - + /* the ASIO C API only allows one ASIO driver to be open at a time, so we keep track of whether we have the driver open here, and use this information to return errors from OpenStream if the @@ -987,7 +987,7 @@ static PaError LoadAsioDriver( PaAsioHostApiRepresentation *asioHostApi, const c ASIOError asioError; int asioIsInitialized = 0; - /* + /* ASIO uses CoCreateInstance() to load a driver. That requires that CoInitialize(0) be called for every thread that loads a driver. It is OK to call CoInitialize(0) multiple times form one thread as long @@ -1097,7 +1097,7 @@ PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex try { asioHostApi->asioDrivers = new AsioDrivers(); /* calls CoInitialize(0) */ - } + } catch (std::bad_alloc) { asioHostApi->asioDrivers = 0; @@ -1175,7 +1175,7 @@ PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex // we face fact that some drivers were not meant for it, drivers which act // like shells on top of REAL drivers, for instance. // so we get duplicate handles, locks and other problems. - // so lets NOT try to load any such wrappers. + // so lets NOT try to load any such wrappers. // The ones i [davidv] know of so far are: if ( strcmp (names[i],"ASIO DirectX Full Duplex Driver") == 0 @@ -1189,16 +1189,16 @@ PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex } - if( IsDebuggerPresent_ && IsDebuggerPresent_() ) + if( IsDebuggerPresent_ && IsDebuggerPresent_() ) { /* ASIO Digidesign Driver uses PACE copy protection which quits out if a debugger is running. So we don't load it if a debugger is running. */ - if( strcmp(names[i], "ASIO Digidesign Driver") == 0 ) + if( strcmp(names[i], "ASIO Digidesign Driver") == 0 ) { - PA_DEBUG(("BLACKLISTED!!! ASIO Digidesign Driver would quit the debugger\n")); - continue; - } - } + PA_DEBUG(("BLACKLISTED!!! ASIO Digidesign Driver would quit the debugger\n")); + continue; + } + } /* Attempt to load the asio driver... */ @@ -1263,11 +1263,11 @@ PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex defaultHighLatencyBufferSize / deviceInfo->defaultSampleRate; if( defaultHighLatency < defaultLowLatency ) - defaultHighLatency = defaultLowLatency; /* just incase the driver returns something strange */ - + defaultHighLatency = defaultLowLatency; /* just incase the driver returns something strange */ + deviceInfo->defaultHighInputLatency = defaultHighLatency; deviceInfo->defaultHighOutputLatency = defaultHighLatency; - + }else{ deviceInfo->defaultLowInputLatency = 0.; @@ -1416,9 +1416,9 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, PaAsioDriverInfo *driverInfo = &asioHostApi->openAsioDriverInfo; int inputChannelCount, outputChannelCount; PaSampleFormat inputSampleFormat, outputSampleFormat; - PaDeviceIndex asioDeviceIndex; + PaDeviceIndex asioDeviceIndex; ASIOError asioError; - + if( inputParameters && outputParameters ) { /* full duplex ASIO stream must use the same device for input and output */ @@ -1426,7 +1426,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, if( inputParameters->device != outputParameters->device ) return paBadIODeviceCombination; } - + if( inputParameters ) { inputChannelCount = inputParameters->channelCount; @@ -1436,7 +1436,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, this implementation doesn't support any custom sample formats */ if( inputSampleFormat & paCustomFormat ) return paSampleFormatNotSupported; - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ @@ -1464,7 +1464,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, this implementation doesn't support any custom sample formats */ if( outputSampleFormat & paCustomFormat ) return paSampleFormatNotSupported; - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ @@ -1487,7 +1487,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, /* if an ASIO device is open we can only get format information for the currently open device */ - if( asioHostApi->openAsioDeviceIndex != paNoDevice + if( asioHostApi->openAsioDeviceIndex != paNoDevice && asioHostApi->openAsioDeviceIndex != asioDeviceIndex ) { return paDeviceUnavailable; @@ -1525,7 +1525,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, goto done; } } - + /* query for sample rate support */ asioError = ASIOCanSampleRate( sampleRate ); if( asioError == ASE_NoClock || asioError == ASE_NotPresent ) @@ -1746,7 +1746,7 @@ static PaError ValidateAsioSpecificStreamInfo( if( (*channelSelectors)[i] < 0 || (*channelSelectors)[i] >= deviceChannelCount ){ return paInvalidChannelCount; - } + } } } @@ -1764,7 +1764,7 @@ static bool IsUsingExternalClockSource() /* davidv: listing ASIO Clock sources. there is an ongoing investigation by me about whether or not to call ASIOSetSampleRate if an external Clock is used. A few drivers expected different things here */ - + asioError = ASIOGetClockSources(clocks, &numSources); if( asioError != ASE_OK ){ PA_DEBUG(("ERROR: ASIOGetClockSources: %s\n", PaAsio_GetAsioErrorText(asioError) )); @@ -1772,7 +1772,7 @@ static bool IsUsingExternalClockSource() PA_DEBUG(("INFO ASIOGetClockSources listing %d clocks\n", numSources )); for (int i=0;ichannelNum = i; } - + info->buffers[0] = info->buffers[1] = 0; } @@ -2551,14 +2551,14 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, // buffer processor latency. it reports the added latency separately PA_DEBUG(("PaAsio : ASIO InputLatency = %ld (%ld ms), added buffProc:%ld (%ld ms)\n", stream->inputLatency, - (long)((stream->inputLatency*1000)/ sampleRate), + (long)((stream->inputLatency*1000)/ sampleRate), PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor), (long)((PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor)*1000)/ sampleRate) )); PA_DEBUG(("PaAsio : ASIO OuputLatency = %ld (%ld ms), added buffProc:%ld (%ld ms)\n", stream->outputLatency, - (long)((stream->outputLatency*1000)/ sampleRate), + (long)((stream->outputLatency*1000)/ sampleRate), PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor), (long)((PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor)*1000)/ sampleRate) )); @@ -2572,7 +2572,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, stream->postOutput = driverInfo->postOutput; stream->isStopped = 1; stream->isActive = 0; - + asioHostApi->openAsioDeviceIndex = asioDeviceIndex; theAsioStream = stream; @@ -2798,17 +2798,17 @@ static ASIOTime *bufferSwitchTimeInfo( ASIOTime *timeInfo, long index, ASIOBool } int buffersDone = 0; - + do { if( buffersDone > 0 ) { // this is a reentered buffer, we missed processing it on time // set the input overflow and output underflow flags as appropriate - + if( theAsioStream->inputChannelCount > 0 ) theAsioStream->callbackFlags |= paInputOverflow; - + if( theAsioStream->outputChannelCount > 0 ) theAsioStream->callbackFlags |= paOutputUnderflow; } @@ -2998,7 +2998,7 @@ previousTime = paTimeInfo.currentTime; } } } - + ++buffersDone; }while( PaAsio_AtomicDecrement(&theAsioStream->reenterCount) >= 0 ); @@ -3335,7 +3335,7 @@ static PaError AbortStream( PaStream *s ) static PaError IsStreamStopped( PaStream *s ) { PaAsioStream *stream = (PaAsioStream*)s; - + return stream->isStopped; } @@ -3493,7 +3493,7 @@ static PaError ReadStream( PaStream *s , &lRingBufferSize2nd); /* Set number of frames to be copied from the ring buffer. */ - PaUtil_SetInputFrameCount( pBp, lRingBufferSize1st ); + PaUtil_SetInputFrameCount( pBp, lRingBufferSize1st ); /* Setup ring buffer access. */ PaUtil_SetInterleavedInputChannels(pBp , /* Buffer processor. */ 0 , /* The first channel's index. */ @@ -3640,7 +3640,7 @@ static PaError WriteStream( PaStream *s , /* If block processing has stopped, abort! */ if( blockingState->stopFlag ) { return result = paStreamIsStopped; } - + /* If a timeout is encountered, give up eventually. */ return result = paTimedOut; } @@ -3665,7 +3665,7 @@ static PaError WriteStream( PaStream *s , &lRingBufferSize2nd); /* Set number of frames to be copied to the ring buffer. */ - PaUtil_SetOutputFrameCount( pBp, lRingBufferSize1st ); + PaUtil_SetOutputFrameCount( pBp, lRingBufferSize1st ); /* Setup ring buffer access. */ PaUtil_SetInterleavedOutputChannels(pBp , /* Buffer processor. */ 0 , /* The first channel's index. */ @@ -3907,10 +3907,10 @@ PaError PaAsio_ShowControlPanel( PaDeviceIndex device, void* systemSpecific ) } PA_DEBUG(("PaAsio_ShowControlPanel: ASIOInit(): %s\n", PaAsio_GetAsioErrorText(asioError) )); -PA_DEBUG(("asioVersion: ASIOInit(): %ld\n", asioDriverInfo.asioVersion )); -PA_DEBUG(("driverVersion: ASIOInit(): %ld\n", asioDriverInfo.driverVersion )); -PA_DEBUG(("Name: ASIOInit(): %s\n", asioDriverInfo.name )); -PA_DEBUG(("ErrorMessage: ASIOInit(): %s\n", asioDriverInfo.errorMessage )); +PA_DEBUG(("asioVersion: ASIOInit(): %ld\n", asioDriverInfo.asioVersion )); +PA_DEBUG(("driverVersion: ASIOInit(): %ld\n", asioDriverInfo.driverVersion )); +PA_DEBUG(("Name: ASIOInit(): %s\n", asioDriverInfo.name )); +PA_DEBUG(("ErrorMessage: ASIOInit(): %s\n", asioDriverInfo.errorMessage )); asioError = ASIOControlPanel(); if( asioError != ASE_OK ) @@ -3975,7 +3975,7 @@ PaError PaAsio_GetInputChannelName( PaDeviceIndex device, int channelIndex, *channelName = asioDeviceInfo->asioChannelInfos[channelIndex].name; return paNoError; - + error: return result; } @@ -4009,7 +4009,7 @@ PaError PaAsio_GetOutputChannelName( PaDeviceIndex device, int channelIndex, asioDeviceInfo->commonDeviceInfo.maxInputChannels + channelIndex].name; return paNoError; - + error: return result; } @@ -4025,7 +4025,7 @@ static PaError GetAsioStreamPointer( PaAsioStream **stream, PaStream *s ) PaError result; PaUtilHostApiRepresentation *hostApi; PaAsioHostApiRepresentation *asioHostApi; - + result = PaUtil_ValidateStreamPointer( s ); if( result != paNoError ) return result; @@ -4035,7 +4035,7 @@ static PaError GetAsioStreamPointer( PaAsioStream **stream, PaStream *s ) return result; asioHostApi = (PaAsioHostApiRepresentation*)hostApi; - + if( PA_STREAM_REP( s )->streamInterface == &asioHostApi->callbackStreamInterface || PA_STREAM_REP( s )->streamInterface == &asioHostApi->blockingStreamInterface ) { diff --git a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core.c b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core.c index bd509731cb..d3dd7bd37e 100644 --- a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core.c +++ b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core.c @@ -15,7 +15,7 @@ * Olivier Tristan for feedback and testing * Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O * interface. - * + * * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 1999-2002 Ross Bencina, Phil Burk @@ -41,13 +41,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -373,7 +373,7 @@ static PaError gatherDeviceInfo(PaMacAUHAL *auhalHostApi) break; } } - } + } if( 0 != AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &auhalHostApi->defaultOut) ) { @@ -390,7 +390,7 @@ static PaError gatherDeviceInfo(PaMacAUHAL *auhalHostApi) break; } } - } + } VDBUG( ( "Default in : %ld\n", auhalHostApi->defaultIn ) ); VDBUG( ( "Default out: %ld\n", auhalHostApi->defaultOut ) ); @@ -433,7 +433,7 @@ static PaError GetChannelInfo( PaMacAUHAL *auhalHostApi, deviceInfo->maxInputChannels = numChannels; else deviceInfo->maxOutputChannels = numChannels; - + if (numChannels > 0) /* do not try to retrieve the latency if there is no channels. */ { /* Get the latency. Don't fail if we can't get this. */ @@ -535,12 +535,12 @@ PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIn int unixErr; VVDBUG(("PaMacCore_Initialize(): hostApiIndex=%d\n", hostApiIndex)); - + SInt32 major; SInt32 minor; Gestalt(gestaltSystemVersionMajor, &major); Gestalt(gestaltSystemVersionMinor, &minor); - + // Starting with 10.6 systems, the HAL notification thread is created internally if (major == 10 && minor >= 6) { CFRunLoopRef theRunLoop = NULL; @@ -550,7 +550,7 @@ PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIn goto error; } } - + unixErr = initializeXRunListenerList(); if( 0 != unixErr ) { return UNIX_ERR(unixErr); @@ -586,7 +586,7 @@ PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIn (*hostApi)->info.defaultInputDevice = paNoDevice; (*hostApi)->info.defaultOutputDevice = paNoDevice; - (*hostApi)->info.deviceCount = 0; + (*hostApi)->info.deviceCount = 0; if( auhalHostApi->devCount > 0 ) { @@ -665,7 +665,7 @@ error: PaUtil_FreeAllAllocations( auhalHostApi->allocations ); PaUtil_DestroyAllocationGroup( auhalHostApi->allocations ); } - + PaUtil_FreeMemory( auhalHostApi ); } return result; @@ -714,7 +714,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, outputParameters ? outputParameters->channelCount : -1, outputParameters ? outputParameters->sampleFormat : -1, (float) sampleRate )); - + /** These first checks are standard PA checks. We do some fancier checks later. */ if( inputParameters ) @@ -726,7 +726,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, this implementation doesn't support any custom sample formats */ if( inputSampleFormat & paCustomFormat ) return paSampleFormatNotSupported; - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ @@ -751,7 +751,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, this implementation doesn't support any custom sample formats */ if( outputSampleFormat & paCustomFormat ) return paSampleFormatNotSupported; - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ @@ -767,7 +767,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, { outputChannelCount = 0; } - + /* FEEDBACK */ /* I think the only way to check a given format SR combo is */ /* to try opening it. This could be disruptive, is that Okay? */ @@ -785,7 +785,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, if( err != paNoError && err != paInvalidSampleRate ) DBUG( ( "OpenStream @ %g returned: %d: %s\n", (float) sampleRate, err, Pa_GetErrorText( err ) ) ); - if( err ) + if( err ) return err; err = CloseStream( s ); if( err ) { @@ -861,7 +861,7 @@ static PaError OpenAndSetupOneAudioUnit( outChannelMap = ((PaMacCoreStreamInfo*)outStreamParams->hostApiSpecificStreamInfo) ->channelMap; outChannelMapSize = ((PaMacCoreStreamInfo*)outStreamParams->hostApiSpecificStreamInfo) - ->channelMapSize; + ->channelMapSize; } /* Override user's flags here, if desired for testing. */ @@ -1166,7 +1166,7 @@ static PaError OpenAndSetupOneAudioUnit( (float)sourceFormat.mSampleRate, (float)desiredFormat.mSampleRate ) ); /* create our converter */ - ERR_WRAP( AudioConverterNew( + ERR_WRAP( AudioConverterNew( &sourceFormat, &desiredFormat, srConverter ) ); @@ -1302,7 +1302,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, { outputChannelCount = outputParameters->channelCount; outputSampleFormat = outputParameters->sampleFormat; - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ @@ -1517,7 +1517,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, result = paInsufficientMemory; goto error; } - + /* * If input and output devs are different or we are doing SR conversion, * we also need a @@ -1723,9 +1723,9 @@ static PaTime TimeStampToSecs(PaMacCoreStream *stream, const AudioTimeStamp* tim #define RING_BUFFER_EMPTY (1000) -static OSStatus ringBufferIOProc( AudioConverterRef inAudioConverter, - UInt32*ioDataSize, - void** outData, +static OSStatus ringBufferIOProc( AudioConverterRef inAudioConverter, + UInt32*ioDataSize, + void** outData, void*inUserData ) { void *dummyData; @@ -1741,9 +1741,9 @@ static OSStatus ringBufferIOProc( AudioConverterRef inAudioConverter, } assert(sizeof(UInt32) == sizeof(ring_buffer_size_t)); PaUtil_GetRingBufferReadRegions( rb, *ioDataSize, - outData, (ring_buffer_size_t *)ioDataSize, + outData, (ring_buffer_size_t *)ioDataSize, &dummyData, &dummySize ); - + assert( *ioDataSize ); PaUtil_AdvanceRingBufferReadIndex( rb, *ioDataSize ); @@ -1876,7 +1876,7 @@ static OSStatus AudioIOProc( void *inRefCon, * -- OR Simplex Output * * This case handles output data as in the full duplex case, - * and, if there is input data, reads it off the ring buffer + * and, if there is input data, reads it off the ring buffer * and into the PA buffer processor. If sample rate conversion * is required on input, that is done here as well. */ @@ -1923,7 +1923,7 @@ static OSStatus AudioIOProc( void *inRefCon, UInt32 size; float data[ inChan * frames ]; size = sizeof( data ); - err = AudioConverterFillBuffer( + err = AudioConverterFillBuffer( stream->inputSRConverter, ringBufferIOProc, &stream->inputRingBuffer, @@ -1937,7 +1937,7 @@ static OSStatus AudioIOProc( void *inRefCon, } ERR( err ); assert( !err ); - + PaUtil_SetInputFrameCount( &(stream->bufferProcessor), frames ); PaUtil_SetInterleavedInputChannels( &(stream->bufferProcessor), 0, @@ -2092,7 +2092,7 @@ static OSStatus AudioIOProc( void *inRefCon, long f; size = sizeof( data ); - err = AudioConverterFillBuffer( + err = AudioConverterFillBuffer( stream->inputSRConverter, ringBufferIOProc, &stream->inputRingBuffer, diff --git a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c index 15698baa17..1c92791d81 100644 --- a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c +++ b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c @@ -15,7 +15,7 @@ * Olivier Tristan for feedback and testing * Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O * interface. - * + * * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 1999-2002 Ross Bencina, Phil Burk @@ -41,13 +41,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h index a6f0ad5dc1..01fb2dced7 100644 --- a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h +++ b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h @@ -15,7 +15,7 @@ * Olivier Tristan for feedback and testing * Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O * interface. - * + * * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 1999-2002 Ross Bencina, Phil Burk @@ -41,13 +41,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h index 1797cbafd4..935b6a18b3 100644 --- a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h +++ b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h @@ -15,7 +15,7 @@ * Olivier Tristan for feedback and testing * Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O * interface. - * + * * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 1999-2002 Ross Bencina, Phil Burk @@ -41,13 +41,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c index 4ef89549b0..1673539404 100644 --- a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c +++ b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c @@ -1,8 +1,8 @@ /* * $Id: pa_mac_core_old.c 1083 2006-08-23 07:30:49Z rossb $ * pa_mac_core.c - * Implementation of PortAudio for Mac OS X CoreAudio - * + * Implementation of PortAudio for Mac OS X CoreAudio + * * PortAudio Portable Real-Time Audio Library * Latest Version at: http://www.portaudio.com * @@ -30,13 +30,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -67,7 +67,7 @@ typedef struct PaMacCore_HAR PaUtilHostApiRepresentation inheritedHostApiRep; PaUtilStreamInterface callbackStreamInterface; PaUtilStreamInterface blockingStreamInterface; - + PaUtilAllocationGroup *allocations; AudioDeviceID *macCoreDeviceIds; } @@ -85,28 +85,28 @@ typedef struct PaMacCore_S PaUtilStreamRepresentation streamRepresentation; PaUtilCpuLoadMeasurer cpuLoadMeasurer; PaUtilBufferProcessor bufferProcessor; - + int primeStreamUsingCallback; - + AudioDeviceID inputDevice; AudioDeviceID outputDevice; - + // Processing thread management -------------- // HANDLE abortEvent; // HANDLE processingThread; // DWORD processingThreadId; - + char throttleProcessingThreadOnOverload; // 0 -> don't throtte, non-0 -> throttle int processingThreadPriority; int highThreadPriority; int throttledThreadPriority; unsigned long throttledSleepMsecs; - + int isStopped; volatile int isActive; volatile int stopProcessing; // stop thread once existing buffers have been returned volatile int abortProcessing; // stop thread immediately - + // DWORD allBuffersDurationMs; // used to calculate timeouts } PaMacCoreStream; @@ -136,7 +136,7 @@ PaMacClientData; static PaError conv_err(OSStatus error) { PaError result; - + switch (error) { case kAudioHardwareNoError: result = paNoError; break; @@ -163,7 +163,7 @@ static PaError conv_err(OSStatus error) default: result = paInternalError; } - + return result; } @@ -175,7 +175,7 @@ static AudioStreamBasicDescription *InitializeStreamDescription(const PaStreamPa streamDescription->mFormatID = kAudioFormatLinearPCM; streamDescription->mFormatFlags = 0; streamDescription->mFramesPerPacket = 1; - + if (parameters->sampleFormat & paNonInterleaved) { streamDescription->mFormatFlags |= kLinearPCMFormatFlagIsNonInterleaved; streamDescription->mChannelsPerFrame = 1; @@ -185,10 +185,10 @@ static AudioStreamBasicDescription *InitializeStreamDescription(const PaStreamPa else { streamDescription->mChannelsPerFrame = parameters->channelCount; } - + streamDescription->mBytesPerFrame = Pa_GetSampleSize(parameters->sampleFormat) * streamDescription->mChannelsPerFrame; streamDescription->mBytesPerPacket = streamDescription->mBytesPerFrame * streamDescription->mFramesPerPacket; - + if (parameters->sampleFormat & paFloat32) { streamDescription->mFormatFlags |= kLinearPCMFormatFlagIsFloat; streamDescription->mBitsPerChannel = 32; @@ -208,11 +208,11 @@ static AudioStreamBasicDescription *InitializeStreamDescription(const PaStreamPa else if (parameters->sampleFormat & paInt8) { streamDescription->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; streamDescription->mBitsPerChannel = 8; - } + } else if (parameters->sampleFormat & paInt32) { streamDescription->mBitsPerChannel = 8; } - + return streamDescription; } */ @@ -220,11 +220,11 @@ static AudioStreamBasicDescription *InitializeStreamDescription(const PaStreamPa static PaStreamCallbackTimeInfo *InitializeTimeInfo(const AudioTimeStamp* now, const AudioTimeStamp* inputTime, const AudioTimeStamp* outputTime) { PaStreamCallbackTimeInfo *timeInfo = PaUtil_AllocateMemory(sizeof(PaStreamCallbackTimeInfo)); - + timeInfo->inputBufferAdcTime = inputTime->mSampleTime; timeInfo->currentTime = now->mSampleTime; timeInfo->outputBufferDacTime = outputTime->mSampleTime; - + return timeInfo; } @@ -238,8 +238,8 @@ static void CleanUp(PaMacCoreHostApiRepresentation *macCoreHostApi) PaUtil_FreeAllAllocations( macCoreHostApi->allocations ); PaUtil_DestroyAllocationGroup( macCoreHostApi->allocations ); } - - PaUtil_FreeMemory( macCoreHostApi ); + + PaUtil_FreeMemory( macCoreHostApi ); } static PaError GetChannelInfo(PaDeviceInfo *deviceInfo, AudioDeviceID macCoreDeviceId, int isInput) @@ -257,12 +257,12 @@ static PaError GetChannelInfo(PaDeviceInfo *deviceInfo, AudioDeviceID macCoreDev for (i = 0; i < buflist->mNumberBuffers; ++i) { numChannels += buflist->mBuffers[i].mNumberChannels; } - + if (isInput) deviceInfo->maxInputChannels = numChannels; else deviceInfo->maxOutputChannels = numChannels; - + int frameLatency; propSize = sizeof(UInt32); err = conv_err(AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyLatency, &propSize, &frameLatency)); @@ -279,7 +279,7 @@ static PaError GetChannelInfo(PaDeviceInfo *deviceInfo, AudioDeviceID macCoreDev } } PaUtil_FreeMemory(buflist); - + return err; } @@ -288,7 +288,7 @@ static PaError InitializeDeviceInfo(PaMacCoreDeviceInfo *macCoreDeviceInfo, Aud PaDeviceInfo *deviceInfo = &macCoreDeviceInfo->inheritedDeviceInfo; deviceInfo->structVersion = 2; deviceInfo->hostApi = hostApiIndex; - + PaError err = paNoError; UInt32 propSize; @@ -299,7 +299,7 @@ static PaError InitializeDeviceInfo(PaMacCoreDeviceInfo *macCoreDeviceInfo, Aud if (!err) { deviceInfo->name = name; } - + Float64 sampleRate; propSize = sizeof(Float64); err = conv_err(AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyNominalSampleRate, &propSize, &sampleRate)); @@ -326,7 +326,7 @@ static PaError InitializeDeviceInfos( PaMacCoreHostApiRepresentation *macCoreHos hostApi->info.deviceCount = 0; hostApi->info.defaultInputDevice = paNoDevice; hostApi->info.defaultOutputDevice = paNoDevice; - + UInt32 propsize; AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propsize, NULL); int numDevices = propsize / sizeof(AudioDeviceID); @@ -346,7 +346,7 @@ static PaError InitializeDeviceInfos( PaMacCoreHostApiRepresentation *macCoreHos { return paInsufficientMemory; } - + macCoreHostApi->macCoreDeviceIds = PaUtil_GroupAllocateMemory(macCoreHostApi->allocations, propsize); AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &propsize, macCoreHostApi->macCoreDeviceIds); @@ -354,7 +354,7 @@ static PaError InitializeDeviceInfos( PaMacCoreHostApiRepresentation *macCoreHos propsize = sizeof(AudioDeviceID); AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &propsize, &defaultInputDevice); AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &propsize, &defaultOutputDevice); - + UInt32 i; for (i = 0; i < numDevices; ++i) { if (macCoreHostApi->macCoreDeviceIds[i] == defaultInputDevice) { @@ -364,7 +364,7 @@ static PaError InitializeDeviceInfos( PaMacCoreHostApiRepresentation *macCoreHos hostApi->info.defaultOutputDevice = i; } InitializeDeviceInfo(&deviceInfoArray[i], macCoreHostApi->macCoreDeviceIds[i], hostApiIndex); - hostApi->deviceInfos[i] = &(deviceInfoArray[i].inheritedDeviceInfo); + hostApi->deviceInfos[i] = &(deviceInfoArray[i].inheritedDeviceInfo); } } @@ -402,7 +402,7 @@ static OSStatus CopyInputData(PaMacClientData* destination, const AudioBufferLis frameSpacing = destination->inputChannelCount; channelSpacing = 1; } - + AudioBuffer const *inputBuffer = &source->mBuffers[0]; void *coreAudioBuffer = inputBuffer->mData; void *portAudioBuffer = destination->inputBuffer; @@ -432,7 +432,7 @@ static OSStatus CopyOutputData(AudioBufferList* destination, PaMacClientData *so frameSpacing = source->outputChannelCount; channelSpacing = 1; } - + AudioBuffer *outputBuffer = &destination->mBuffers[0]; void *coreAudioBuffer = outputBuffer->mData; void *portAudioBuffer = source->outputBuffer; @@ -455,15 +455,15 @@ static OSStatus AudioIOProc( AudioDeviceID inDevice, const AudioTimeStamp* inNow, const AudioBufferList* inInputData, const AudioTimeStamp* inInputTime, - AudioBufferList* outOutputData, + AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, void* inClientData) { PaMacClientData *clientData = (PaMacClientData *)inClientData; PaStreamCallbackTimeInfo *timeInfo = InitializeTimeInfo(inNow, inInputTime, inOutputTime); - + PaUtil_BeginCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer ); - + AudioBuffer *outputBuffer = &outOutputData->mBuffers[0]; unsigned long frameCount = outputBuffer->mDataByteSize / (outputBuffer->mNumberChannels * sizeof(Float32)); @@ -476,7 +476,7 @@ static OSStatus AudioIOProc( AudioDeviceID inDevice, } PaUtil_EndCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer, frameCount ); - + if (result == paComplete || result == paAbort) { Pa_StopStream(clientData->stream); } @@ -490,7 +490,7 @@ static OSStatus AudioInputProc( AudioDeviceID inDevice, const AudioTimeStamp* inNow, const AudioBufferList* inInputData, const AudioTimeStamp* inInputTime, - AudioBufferList* outOutputData, + AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, void* inClientData) { @@ -504,7 +504,7 @@ static OSStatus AudioInputProc( AudioDeviceID inDevice, CopyInputData(clientData, inInputData, frameCount); PaStreamCallbackResult result = clientData->callback(clientData->inputBuffer, clientData->outputBuffer, frameCount, timeInfo, paNoFlag, clientData->userData); - + PaUtil_EndCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer, frameCount ); if( result == paComplete || result == paAbort ) Pa_StopStream(clientData->stream); @@ -517,7 +517,7 @@ static OSStatus AudioOutputProc( AudioDeviceID inDevice, const AudioTimeStamp* inNow, const AudioBufferList* inInputData, const AudioTimeStamp* inInputTime, - AudioBufferList* outOutputData, + AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, void* inClientData) { @@ -540,18 +540,18 @@ static OSStatus AudioOutputProc( AudioDeviceID inDevice, static PaError SetSampleRate(AudioDeviceID device, double sampleRate, int isInput) { PaError result = paNoError; - + double actualSampleRate; UInt32 propSize = sizeof(double); result = conv_err(AudioDeviceSetProperty(device, NULL, 0, isInput, kAudioDevicePropertyNominalSampleRate, propSize, &sampleRate)); - + result = conv_err(AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyNominalSampleRate, &propSize, &actualSampleRate)); - + if (result == paNoError && actualSampleRate != sampleRate) { result = paInvalidSampleRate; } - - return result; + + return result; } static PaError SetFramesPerBuffer(AudioDeviceID device, unsigned long framesPerBuffer, int isInput) @@ -561,13 +561,13 @@ static PaError SetFramesPerBuffer(AudioDeviceID device, unsigned long framesPerB // while (preferredFramesPerBuffer > UINT32_MAX) { // preferredFramesPerBuffer /= 2; // } - + UInt32 actualFramesPerBuffer; UInt32 propSize = sizeof(UInt32); result = conv_err(AudioDeviceSetProperty(device, NULL, 0, isInput, kAudioDevicePropertyBufferFrameSize, propSize, &preferredFramesPerBuffer)); - + result = conv_err(AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyBufferFrameSize, &propSize, &actualFramesPerBuffer)); - + if (result != paNoError) { // do nothing } @@ -577,10 +577,10 @@ static PaError SetFramesPerBuffer(AudioDeviceID device, unsigned long framesPerB else if (actualFramesPerBuffer < framesPerBuffer) { result = paBufferTooBig; } - - return result; + + return result; } - + static PaError SetUpUnidirectionalStream(AudioDeviceID device, double sampleRate, unsigned long framesPerBuffer, int isInput) { PaError err = paNoError; @@ -597,9 +597,9 @@ static PaError SetUpUnidirectionalStream(AudioDeviceID device, double sampleRate extern "C" { #endif // __cplusplus - + PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); - + #ifdef __cplusplus } #endif // __cplusplus @@ -607,7 +607,7 @@ extern "C" static void Terminate( struct PaUtilHostApiRepresentation *hostApi ) { PaMacCoreHostApiRepresentation *macCoreHostApi = (PaMacCoreHostApiRepresentation*)hostApi; - + CleanUp(macCoreHostApi); } @@ -618,7 +618,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, { PaMacCoreHostApiRepresentation *macCoreHostApi = (PaMacCoreHostApiRepresentation*)hostApi; PaDeviceInfo *deviceInfo; - + PaError result = paNoError; if (inputParameters) { deviceInfo = macCoreHostApi->inheritedHostApiRep.deviceInfos[inputParameters->device]; @@ -657,14 +657,14 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, stream->isStopped = 1; stream->inputDevice = kAudioDeviceUnknown; stream->outputDevice = kAudioDeviceUnknown; - + PaUtil_InitializeStreamRepresentation( &stream->streamRepresentation, ( (streamCallback) ? &macCoreHostApi->callbackStreamInterface : &macCoreHostApi->blockingStreamInterface ), streamCallback, userData ); PaUtil_InitializeCpuLoadMeasurer( &stream->cpuLoadMeasurer, sampleRate ); - + *s = (PaStream*)stream; PaMacClientData *clientData = PaUtil_AllocateMemory(sizeof(PaMacClientData)); clientData->stream = stream; @@ -674,7 +674,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, clientData->outputBuffer = 0; clientData->ditherGenerator = PaUtil_AllocateMemory(sizeof(PaUtilTriangularDitherGenerator)); PaUtil_InitializeTriangularDitherState(clientData->ditherGenerator); - + if (inputParameters != NULL) { stream->inputDevice = macCoreHostApi->macCoreDeviceIds[inputParameters->device]; clientData->inputConverter = PaUtil_SelectConverter(paFloat32, inputParameters->sampleFormat, streamFlags); @@ -683,7 +683,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, clientData->inputSampleFormat = inputParameters->sampleFormat; err = SetUpUnidirectionalStream(stream->inputDevice, sampleRate, framesPerBuffer, 1); } - + if (err == paNoError && outputParameters != NULL) { stream->outputDevice = macCoreHostApi->macCoreDeviceIds[outputParameters->device]; clientData->outputConverter = PaUtil_SelectConverter(outputParameters->sampleFormat, paFloat32, streamFlags); @@ -703,7 +703,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, AudioDeviceAddIOProc(stream->inputDevice, AudioInputProc, clientData); AudioDeviceAddIOProc(stream->outputDevice, AudioOutputProc, clientData); } - + return err; } @@ -727,7 +727,7 @@ static PaError CloseStream( PaStream* s ) else { err = conv_err(AudioDeviceRemoveIOProc(stream->outputDevice, AudioIOProc)); } - + return err; } @@ -749,7 +749,7 @@ static PaError StartStream( PaStream *s ) else { err = conv_err(AudioDeviceStart(stream->outputDevice, AudioIOProc)); } - + stream->isActive = 1; stream->isStopped = 0; return err; @@ -759,7 +759,7 @@ static PaError AbortStream( PaStream *s ) { PaError err = paNoError; PaMacCoreStream *stream = (PaMacCoreStream*)s; - + if (stream->inputDevice != kAudioDeviceUnknown) { if (stream->outputDevice == kAudioDeviceUnknown || stream->outputDevice == stream->inputDevice) { err = conv_err(AudioDeviceStop(stream->inputDevice, AudioIOProc)); @@ -772,11 +772,11 @@ static PaError AbortStream( PaStream *s ) else { err = conv_err(AudioDeviceStop(stream->outputDevice, AudioIOProc)); } - + stream->isActive = 0; stream->isStopped = 1; return err; -} +} static PaError StopStream( PaStream *s ) { @@ -787,7 +787,7 @@ static PaError StopStream( PaStream *s ) static PaError IsStreamStopped( PaStream *s ) { PaMacCoreStream *stream = (PaMacCoreStream*)s; - + return stream->isStopped; } @@ -813,7 +813,7 @@ static PaTime GetStreamTime( PaStream *s ) else { err = AudioDeviceGetCurrentTime(stream->outputDevice, timeStamp); } - + result = err ? 0 : timeStamp->mSampleTime; PaUtil_FreeMemory(timeStamp); @@ -824,7 +824,7 @@ static PaTime GetStreamTime( PaStream *s ) static double GetStreamCpuLoad( PaStream* s ) { PaMacCoreStream *stream = (PaMacCoreStream*)s; - + return PaUtil_GetCpuLoad( &stream->cpuLoadMeasurer ); } @@ -868,14 +868,14 @@ PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIn result = paInsufficientMemory; goto error; } - + macCoreHostApi->allocations = PaUtil_CreateAllocationGroup(); if( !macCoreHostApi->allocations ) { result = paInsufficientMemory; goto error; } - + *hostApi = &macCoreHostApi->inheritedHostApiRep; (*hostApi)->info.structVersion = 1; (*hostApi)->info.type = paCoreAudio; @@ -885,29 +885,29 @@ PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIn if (result != paNoError) { goto error; } - + // Set up the proper callbacks to this HostApi's functions (*hostApi)->Terminate = Terminate; (*hostApi)->OpenStream = OpenStream; (*hostApi)->IsFormatSupported = IsFormatSupported; - + PaUtil_InitializeStreamInterface( &macCoreHostApi->callbackStreamInterface, CloseStream, StartStream, StopStream, AbortStream, IsStreamStopped, IsStreamActive, GetStreamTime, GetStreamCpuLoad, PaUtil_DummyRead, PaUtil_DummyWrite, PaUtil_DummyGetReadAvailable, PaUtil_DummyGetWriteAvailable ); - + PaUtil_InitializeStreamInterface( &macCoreHostApi->blockingStreamInterface, CloseStream, StartStream, StopStream, AbortStream, IsStreamStopped, IsStreamActive, GetStreamTime, PaUtil_DummyGetCpuLoad, ReadStream, WriteStream, GetStreamReadAvailable, GetStreamWriteAvailable ); - + return result; - + error: if( macCoreHostApi ) { CleanUp(macCoreHostApi); } - + return result; } diff --git a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c index b58b822022..edc8229ad5 100644 --- a/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c +++ b/3rdparty/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c @@ -15,7 +15,7 @@ * Olivier Tristan for feedback and testing * Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O * interface. - * + * * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 1999-2002 Ross Bencina, Phil Burk @@ -41,13 +41,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -97,16 +97,16 @@ PaError PaMacCore_SetError(OSStatus error, int line, int isError) /*FIXME: still need to handle possible ComponentResult values.*/ /* unfortunately, they don't seem to be documented anywhere.*/ PaError result; - const char *errorType; + const char *errorType; const char *errorText; - + switch (error) { case kAudioHardwareNoError: return paNoError; case kAudioHardwareNotRunningError: errorText = "Audio Hardware Not Running"; result = paInternalError; break; - case kAudioHardwareUnspecifiedError: + case kAudioHardwareUnspecifiedError: errorText = "Unspecified Audio Hardware Error"; result = paInternalError; break; case kAudioHardwareUnknownPropertyError: @@ -115,7 +115,7 @@ PaError PaMacCore_SetError(OSStatus error, int line, int isError) case kAudioHardwareBadPropertySizeError: errorText = "Audio Hardware: Bad Property Size"; result = paInternalError; break; - case kAudioHardwareIllegalOperationError: + case kAudioHardwareIllegalOperationError: errorText = "Audio Hardware: Illegal Operation"; result = paInternalError; break; case kAudioHardwareBadDeviceError: @@ -261,7 +261,7 @@ long computeRingBufferSize( const PaStreamParameters *inputParameters, framesPerBufferTimesChannelCount = MAX( inputFramesPerBuffer * inputParameters->channelCount, outputFramesPerBuffer * outputParameters->channelCount ); - } + } else if( outputParameters ) { latencyTimesChannelCount @@ -316,17 +316,17 @@ long computeRingBufferSize( const PaStreamParameters *inputParameters, */ OSStatus propertyProc( - AudioDeviceID inDevice, - UInt32 inChannel, - Boolean isInput, - AudioDevicePropertyID inPropertyID, + AudioDeviceID inDevice, + UInt32 inChannel, + Boolean isInput, + AudioDevicePropertyID inPropertyID, void* inClientData ) { // this is where we would set the condition variable return noErr; } -/* sets the value of the given property and waits for the change to +/* sets the value of the given property and waits for the change to be acknowledged, and returns the final value, which is not guaranteed by this function to be the same as the desired value. Obviously, this function can only be used for data whose input and output are the @@ -337,10 +337,10 @@ OSStatus propertyProc( determining if the property was read. */ PaError AudioDeviceSetPropertyNowAndWaitForChange( AudioDeviceID inDevice, - UInt32 inChannel, - Boolean isInput, + UInt32 inChannel, + Boolean isInput, AudioDevicePropertyID inPropertyID, - UInt32 inPropertyDataSize, + UInt32 inPropertyDataSize, const void *inPropertyData, void *outPropertyData ) { @@ -349,7 +349,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange( /* First, see if it already has that value. If so, return. */ macErr = AudioDeviceGetProperty( inDevice, inChannel, - isInput, inPropertyID, + isInput, inPropertyID, &outPropertyDataSize, outPropertyData ); if( macErr ) { memset( outPropertyData, 0, inPropertyDataSize ); @@ -367,7 +367,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange( but for now, this is just to make 10.6 happy. */ macErr = AudioDeviceAddPropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc, - NULL ); + NULL ); if( macErr ) /* we couldn't add a listener. */ goto failMac; @@ -389,7 +389,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange( while( tv2.tv_sec - tv1.tv_sec < 30 ) { /* now read the property back out */ macErr = AudioDeviceGetProperty( inDevice, inChannel, - isInput, inPropertyID, + isInput, inPropertyID, &outPropertyDataSize, outPropertyData ); if( macErr ) { memset( outPropertyData, 0, inPropertyDataSize ); @@ -405,7 +405,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange( gettimeofday( &tv2, NULL ); } DBUG( ("Timeout waiting for device setting.\n" ) ); - + AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc ); return paNoError; @@ -481,7 +481,7 @@ PaError setBestSampleRateForDevice( const AudioDeviceID device, (float) ranges[i].mMaximum ) ); #endif VDBUG(("-----\n")); - + /* -- now pick the best available sample rate -- */ for( i=0; iitems = (DSDeviceNameAndGUID*)LocalAlloc( LMEM_FIXED, sizeof(DSDeviceNameAndGUID) * guidVector->free ); if( guidVector->items == NULL ) result = paInsufficientMemory; - + return result; } @@ -350,7 +350,7 @@ static PaError ExpandDSDeviceNameAndGUIDVector( DSDeviceNameAndGUIDVector *guidV PaError result = paNoError; DSDeviceNameAndGUID *newItems; int i; - + /* double size of vector */ int size = guidVector->count + guidVector->free; guidVector->free += size; @@ -379,7 +379,7 @@ static PaError ExpandDSDeviceNameAndGUIDVector( DSDeviceNameAndGUIDVector *guidV LocalFree( guidVector->items ); guidVector->items = newItems; - } + } return result; } @@ -403,7 +403,7 @@ static PaError TerminateDSDeviceNameAndGUIDVector( DSDeviceNameAndGUIDVector *gu } /************************************************************************************ -** Collect preliminary device information during DirectSound enumeration +** Collect preliminary device information during DirectSound enumeration */ static BOOL CALLBACK CollectGUIDsProc(LPGUID lpGUID, LPCTSTR lpszDesc, @@ -424,7 +424,7 @@ static BOOL CALLBACK CollectGUIDsProc(LPGUID lpGUID, return FALSE; } } - + /* Set GUID pointer, copy GUID to storage in DSDeviceNameAndGUIDVector. */ if( lpGUID == NULL ) { @@ -434,7 +434,7 @@ static BOOL CALLBACK CollectGUIDsProc(LPGUID lpGUID, { namesAndGUIDs->items[namesAndGUIDs->count].lpGUID = &namesAndGUIDs->items[namesAndGUIDs->count].guid; - + memcpy( &namesAndGUIDs->items[namesAndGUIDs->count].guid, lpGUID, sizeof(GUID) ); } @@ -450,7 +450,7 @@ static BOOL CALLBACK CollectGUIDsProc(LPGUID lpGUID, ++namesAndGUIDs->count; --namesAndGUIDs->free; - + return TRUE; } @@ -479,7 +479,7 @@ static BOOL CALLBACK KsPropertySetEnumerateCallback( PDSPROPERTY_DIRECTSOUNDDEVI if( deviceNamesAndGUIDs->outputNamesAndGUIDs.items[i].lpGUID && memcmp( &data->DeviceId, deviceNamesAndGUIDs->outputNamesAndGUIDs.items[i].lpGUID, sizeof(GUID) ) == 0 ) { - deviceNamesAndGUIDs->outputNamesAndGUIDs.items[i].pnpInterface = + deviceNamesAndGUIDs->outputNamesAndGUIDs.items[i].pnpInterface = (char*)DuplicateWCharString( deviceNamesAndGUIDs->winDsHostApi->allocations, data->Interface ); break; } @@ -492,7 +492,7 @@ static BOOL CALLBACK KsPropertySetEnumerateCallback( PDSPROPERTY_DIRECTSOUNDDEVI if( deviceNamesAndGUIDs->inputNamesAndGUIDs.items[i].lpGUID && memcmp( &data->DeviceId, deviceNamesAndGUIDs->inputNamesAndGUIDs.items[i].lpGUID, sizeof(GUID) ) == 0 ) { - deviceNamesAndGUIDs->inputNamesAndGUIDs.items[i].pnpInterface = + deviceNamesAndGUIDs->inputNamesAndGUIDs.items[i].pnpInterface = (char*)DuplicateWCharString( deviceNamesAndGUIDs->winDsHostApi->allocations, data->Interface ); break; } @@ -503,13 +503,13 @@ static BOOL CALLBACK KsPropertySetEnumerateCallback( PDSPROPERTY_DIRECTSOUNDDEVI } -static GUID pawin_CLSID_DirectSoundPrivate = +static GUID pawin_CLSID_DirectSoundPrivate = { 0x11ab3ec0, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x00, 0xc0, 0x4f, 0xc2, 0x8a, 0xca }; -static GUID pawin_DSPROPSETID_DirectSoundDevice = +static GUID pawin_DSPROPSETID_DirectSoundDevice = { 0x84624f82, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x00, 0xc0, 0x4f, 0xc2, 0x8a, 0xca }; -static GUID pawin_IID_IKsPropertySet = +static GUID pawin_IID_IKsPropertySet = { 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93 }; @@ -517,17 +517,17 @@ static GUID pawin_IID_IKsPropertySet = FindDevicePnpInterfaces fills in the pnpInterface fields in deviceNamesAndGUIDs with UNICODE file paths to the devices. The DS documentation mentions at least two techniques by which these Interface paths can be found using IKsPropertySet on - the DirectSound class object. One is using the DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION + the DirectSound class object. One is using the DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION property, and the other is using DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE. I tried both methods and only the second worked. I found two postings on the - net from people who had the same problem with the first method, so I think the method used here is + net from people who had the same problem with the first method, so I think the method used here is more common/likely to work. The probem is that IKsPropertySet_Get returns S_OK but the fields of the device description are not filled in. - The mechanism we use works by registering an enumeration callback which is called for + The mechanism we use works by registering an enumeration callback which is called for every DSound device. Our callback searches for a device in our deviceNamesAndGUIDs list with the matching GUID and copies the pointer to the Interface path. - Note that we could have used this enumeration callback to perform the original + Note that we could have used this enumeration callback to perform the original device enumeration, however we choose not to so we can disable this step easily. Apparently the IKsPropertySet mechanism was added in DirectSound 9c 2004 @@ -538,11 +538,11 @@ static GUID pawin_IID_IKsPropertySet = static void FindDevicePnpInterfaces( DSDeviceNamesAndGUIDs *deviceNamesAndGUIDs ) { IClassFactory *pClassFactory; - + if( paWinDsDSoundEntryPoints.DllGetClassObject(&pawin_CLSID_DirectSoundPrivate, &IID_IClassFactory, (PVOID *) &pClassFactory) == S_OK ){ IKsPropertySet *pPropertySet; if( pClassFactory->lpVtbl->CreateInstance( pClassFactory, NULL, &pawin_IID_IKsPropertySet, (PVOID *) &pPropertySet) == S_OK ){ - + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data; ULONG bytesReturned; @@ -558,14 +558,14 @@ static void FindDevicePnpInterfaces( DSDeviceNamesAndGUIDs *deviceNamesAndGUIDs sizeof(data), &bytesReturned ); - + IKsPropertySet_Release( pPropertySet ); } pClassFactory->lpVtbl->Release( pClassFactory ); } /* - The following code fragment, which I chose not to use, queries for the + The following code fragment, which I chose not to use, queries for the device interface for a device with a specific GUID: ULONG BytesReturned; @@ -573,7 +573,7 @@ static void FindDevicePnpInterfaces( DSDeviceNamesAndGUIDs *deviceNamesAndGUIDs memset (&Property, 0, sizeof(Property)); Property.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; - Property.DeviceId = *lpGUID; + Property.DeviceId = *lpGUID; hr = IKsPropertySet_Get( pPropertySet, &pawin_DSPROPSETID_DirectSoundDevice, @@ -594,7 +594,7 @@ static void FindDevicePnpInterfaces( DSDeviceNamesAndGUIDs *deviceNamesAndGUIDs #endif /* PAWIN_USE_WDMKS_DEVICE_INFO */ -/* +/* GUIDs for emulated devices which we blacklist below. are there more than two of them?? */ @@ -638,7 +638,7 @@ static PaError AddOutputDeviceInfoFromDirectSound( memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) ); winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid; } - + if( lpGUID ) { if (IsEqualGUID (&IID_IRolandVSCEmulated1,lpGUID) || @@ -669,7 +669,7 @@ static PaError AddOutputDeviceInfoFromDirectSound( hr = IDirectSound_Initialize( lpDirectSound, lpGUID ); } */ - + if( hr != DS_OK ) { if (hr == DSERR_ALLOCATED) @@ -695,7 +695,7 @@ static PaError AddOutputDeviceInfoFromDirectSound( else { /* Query device characteristics. */ - memset( &caps, 0, sizeof(caps) ); + memset( &caps, 0, sizeof(caps) ); caps.dwSize = sizeof(caps); hr = IDirectSound_GetCaps( lpDirectSound, &caps ); if( hr != DS_OK ) @@ -726,7 +726,7 @@ static PaError AddOutputDeviceInfoFromDirectSound( set deviceOutputChannelCountIsKnown to 0 (unknown). In this case OpenStream will try to open the device when the user requests more than 2 channels, rather than - returning an error. + returning an error. */ if( caps.dwFlags & DSCAPS_PRIMARYSTEREO ) { @@ -739,7 +739,7 @@ static PaError AddOutputDeviceInfoFromDirectSound( winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1; } - /* Guess channels count from speaker configuration. We do it only when + /* Guess channels count from speaker configuration. We do it only when pnpInterface is NULL or when PAWIN_USE_WDMKS_DEVICE_INFO is undefined. */ #ifdef PAWIN_USE_WDMKS_DEVICE_INFO @@ -789,9 +789,9 @@ static PaError AddOutputDeviceInfoFromDirectSound( deviceInfo->defaultLowOutputLatency = 0.; /** @todo IMPLEMENT ME */ deviceInfo->defaultHighInputLatency = 0.; /** @todo IMPLEMENT ME */ deviceInfo->defaultHighOutputLatency = 0.; /** @todo IMPLEMENT ME */ - + /* initialize defaultSampleRate */ - + if( caps.dwFlags & DSCAPS_CONTINUOUSRATE ) { /* initialize to caps.dwMaxSecondarySampleRate incase none of the standard rates match */ @@ -838,7 +838,7 @@ static PaError AddOutputDeviceInfoFromDirectSound( //printf( "min %d max %d\n", caps.dwMinSecondarySampleRate, caps.dwMaxSecondarySampleRate ); - // dwFlags | DSCAPS_CONTINUOUSRATE + // dwFlags | DSCAPS_CONTINUOUSRATE } } @@ -851,7 +851,7 @@ static PaError AddOutputDeviceInfoFromDirectSound( if( lpGUID == NULL ) hostApi->info.defaultOutputDevice = hostApi->info.deviceCount; - + hostApi->info.deviceCount++; } @@ -877,7 +877,7 @@ static PaError AddInputDeviceInfoFromDirectSoundCapture( DSCCAPS caps; int deviceOK = TRUE; PaError result = paNoError; - + /* Copy GUID to the device info structure. Set pointer. */ if( lpGUID == NULL ) { @@ -1013,7 +1013,7 @@ static PaError AddInputDeviceInfoFromDirectSoundCapture( else deviceInfo->defaultSampleRate = 0.; } } - + IDirectSoundCapture_Release( lpDirectSoundCapture ); } @@ -1046,7 +1046,7 @@ PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInde If COM is already initialized CoInitialize will either return FALSE, or RPC_E_CHANGED_MODE if it was initialised in a different threading mode. In either case we shouldn't consider it an error - but we need to be careful to not call CoUninitialize() if + but we need to be careful to not call CoUninitialize() if RPC_E_CHANGED_MODE was returned. */ @@ -1084,12 +1084,12 @@ PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInde (*hostApi)->info.structVersion = 1; (*hostApi)->info.type = paDirectSound; (*hostApi)->info.name = "Windows DirectSound"; - + (*hostApi)->info.deviceCount = 0; (*hostApi)->info.defaultInputDevice = paNoDevice; (*hostApi)->info.defaultOutputDevice = paNoDevice; - + /* DSound - enumerate devices to count them and to gather their GUIDs */ result = InitializeDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs, winDsHostApi->allocations ); @@ -1174,7 +1174,7 @@ PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInde if( result != paNoError ) goto error; } - } + } result = TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs ); if( result != paNoError ) @@ -1184,7 +1184,7 @@ PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInde if( result != paNoError ) goto error; - + (*hostApi)->Terminate = Terminate; (*hostApi)->OpenStream = OpenStream; (*hostApi)->IsFormatSupported = IsFormatSupported; @@ -1210,7 +1210,7 @@ error: PaUtil_FreeAllAllocations( winDsHostApi->allocations ); PaUtil_DestroyAllocationGroup( winDsHostApi->allocations ); } - + PaUtil_FreeMemory( winDsHostApi ); } @@ -1346,7 +1346,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, outputChannelCount = outputParameters->channelCount; outputSampleFormat = outputParameters->sampleFormat; - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ @@ -1367,7 +1367,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, { outputChannelCount = 0; } - + /* IMPLEMENT ME: @@ -1436,12 +1436,12 @@ static int PaWinDs_GetMinLatencyFrames( double sampleRate ) static HRESULT InitFullDuplexInputOutputBuffers( PaWinDsStream *stream, PaWinDsDeviceInfo *inputDevice, PaSampleFormat hostInputSampleFormat, - WORD inputChannelCount, + WORD inputChannelCount, int bytesPerInputBuffer, PaWinWaveFormatChannelMask inputChannelMask, PaWinDsDeviceInfo *outputDevice, PaSampleFormat hostOutputSampleFormat, - WORD outputChannelCount, + WORD outputChannelCount, int bytesPerOutputBuffer, PaWinWaveFormatChannelMask outputChannelMask, unsigned long nFrameRate @@ -1458,7 +1458,7 @@ static HRESULT InitFullDuplexInputOutputBuffers( PaWinDsStream *stream, // capture buffer description // only try wave format extensible. assume it's available on all ds 8 systems - PaWin_InitializeWaveFormatExtensible( &captureWaveFormat, inputChannelCount, + PaWin_InitializeWaveFormatExtensible( &captureWaveFormat, inputChannelCount, hostInputSampleFormat, PaWin_SampleFormatToLinearWaveFormatTag( hostInputSampleFormat ), nFrameRate, inputChannelMask ); @@ -1470,7 +1470,7 @@ static HRESULT InitFullDuplexInputOutputBuffers( PaWinDsStream *stream, // render buffer description - PaWin_InitializeWaveFormatExtensible( &renderWaveFormat, outputChannelCount, + PaWin_InitializeWaveFormatExtensible( &renderWaveFormat, outputChannelCount, hostOutputSampleFormat, PaWin_SampleFormatToLinearWaveFormatTag( hostOutputSampleFormat ), nFrameRate, outputChannelMask ); @@ -1482,7 +1482,7 @@ static HRESULT InitFullDuplexInputOutputBuffers( PaWinDsStream *stream, /* note that we don't create a primary buffer here at all */ - hr = paWinDsDSoundEntryPoints.DirectSoundFullDuplexCreate8( + hr = paWinDsDSoundEntryPoints.DirectSoundFullDuplexCreate8( inputDevice->lpGUID, outputDevice->lpGUID, &captureDesc, &secondaryRenderDesc, GetDesktopWindow(), /* see InitOutputBuffer() for a discussion of whether this is a good idea */ @@ -1490,7 +1490,7 @@ static HRESULT InitFullDuplexInputOutputBuffers( PaWinDsStream *stream, &stream->pDirectSoundFullDuplex8, &pCaptureBuffer8, &pRenderBuffer8, - NULL /* pUnkOuter must be NULL */ + NULL /* pUnkOuter must be NULL */ ); if( hr == DS_OK ) @@ -1500,7 +1500,7 @@ static HRESULT InitFullDuplexInputOutputBuffers( PaWinDsStream *stream, /* retrieve the pre ds 8 buffer interfaces which are used by the rest of the code */ hr = IUnknown_QueryInterface( pCaptureBuffer8, &IID_IDirectSoundCaptureBuffer, &stream->pDirectSoundInputBuffer ); - + if( hr == DS_OK ) hr = IUnknown_QueryInterface( pRenderBuffer8, &IID_IDirectSoundBuffer, &stream->pDirectSoundOutputBuffer ); @@ -1521,7 +1521,7 @@ static HRESULT InitFullDuplexInputOutputBuffers( PaWinDsStream *stream, IUnknown_Release( stream->pDirectSoundOutputBuffer ); stream->pDirectSoundOutputBuffer = NULL; } - + IUnknown_Release( stream->pDirectSoundFullDuplex8 ); stream->pDirectSoundFullDuplex8 = NULL; } @@ -1541,8 +1541,8 @@ static HRESULT InitInputBuffer( PaWinDsStream *stream, PaWinDsDeviceInfo *device DSCBUFFERDESC captureDesc; PaWinWaveFormat waveFormat; HRESULT result; - - if( (result = paWinDsDSoundEntryPoints.DirectSoundCaptureCreate( + + if( (result = paWinDsDSoundEntryPoints.DirectSoundCaptureCreate( device->lpGUID, &stream->pDirectSoundCapture, NULL) ) != DS_OK ){ ERR_RPT(("PortAudio: DirectSoundCaptureCreate() failed!\n")); return result; @@ -1554,18 +1554,18 @@ static HRESULT InitInputBuffer( PaWinDsStream *stream, PaWinDsDeviceInfo *device captureDesc.dwFlags = 0; captureDesc.dwBufferBytes = bytesPerBuffer; captureDesc.lpwfxFormat = (WAVEFORMATEX*)&waveFormat; - + // Create the capture buffer // first try WAVEFORMATEXTENSIBLE. if this fails, fall back to WAVEFORMATEX - PaWin_InitializeWaveFormatExtensible( &waveFormat, nChannels, + PaWin_InitializeWaveFormatExtensible( &waveFormat, nChannels, sampleFormat, PaWin_SampleFormatToLinearWaveFormatTag( sampleFormat ), nFrameRate, channelMask ); if( IDirectSoundCapture_CreateCaptureBuffer( stream->pDirectSoundCapture, &captureDesc, &stream->pDirectSoundInputBuffer, NULL) != DS_OK ) { - PaWin_InitializeWaveFormatEx( &waveFormat, nChannels, sampleFormat, + PaWin_InitializeWaveFormatEx( &waveFormat, nChannels, sampleFormat, PaWin_SampleFormatToLinearWaveFormatTag( sampleFormat ), nFrameRate ); if ((result = IDirectSoundCapture_CreateCaptureBuffer( stream->pDirectSoundCapture, @@ -1585,8 +1585,8 @@ static HRESULT InitOutputBuffer( PaWinDsStream *stream, PaWinDsDeviceInfo *devic PaWinWaveFormat waveFormat; DSBUFFERDESC primaryDesc; DSBUFFERDESC secondaryDesc; - - if( (hr = paWinDsDSoundEntryPoints.DirectSoundCreate( + + if( (hr = paWinDsDSoundEntryPoints.DirectSoundCreate( device->lpGUID, &stream->pDirectSound, NULL )) != DS_OK ){ ERR_RPT(("PortAudio: DirectSoundCreate() failed!\n")); return hr; @@ -1629,13 +1629,13 @@ static HRESULT InitOutputBuffer( PaWinDsStream *stream, PaWinDsDeviceInfo *devic // Set the primary buffer's format // first try WAVEFORMATEXTENSIBLE. if this fails, fall back to WAVEFORMATEX - PaWin_InitializeWaveFormatExtensible( &waveFormat, nChannels, + PaWin_InitializeWaveFormatExtensible( &waveFormat, nChannels, sampleFormat, PaWin_SampleFormatToLinearWaveFormatTag( sampleFormat ), nFrameRate, channelMask ); if( IDirectSoundBuffer_SetFormat( stream->pDirectSoundPrimaryBuffer, (WAVEFORMATEX*)&waveFormat) != DS_OK ) { - PaWin_InitializeWaveFormatEx( &waveFormat, nChannels, sampleFormat, + PaWin_InitializeWaveFormatEx( &waveFormat, nChannels, sampleFormat, PaWin_SampleFormatToLinearWaveFormatTag( sampleFormat ), nFrameRate ); if((result = IDirectSoundBuffer_SetFormat( stream->pDirectSoundPrimaryBuffer, (WAVEFORMATEX*)&waveFormat)) != DS_OK) @@ -1653,7 +1653,7 @@ static HRESULT InitOutputBuffer( PaWinDsStream *stream, PaWinDsDeviceInfo *devic if ((result = IDirectSound_CreateSoundBuffer( stream->pDirectSound, &secondaryDesc, &stream->pDirectSoundOutputBuffer, NULL)) != DS_OK) goto error; - + return DS_OK; error: @@ -1705,7 +1705,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, /* IDEA: the following 3 checks could be performed by default by pa_front unless some flag indicated otherwise */ - + /* unless alternate device specification is supported, reject the use of paUseHostApiSpecificDeviceSpecification */ if( inputParameters->device == paUseHostApiSpecificDeviceSpecification ) @@ -1715,7 +1715,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, if( inputWinDsDeviceInfo->deviceInputChannelCountIsKnown && inputChannelCount > inputDeviceInfo->maxInputChannels ) return paInvalidChannelCount; - + /* validate hostApiSpecificStreamInfo */ inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo; result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo ); @@ -1756,7 +1756,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, /* validate hostApiSpecificStreamInfo */ outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo; result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo ); - if( result != paNoError ) return result; + if( result != paNoError ) return result; if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseChannelMask ) outputChannelMask = outputStreamInfo->channelMask; @@ -1820,7 +1820,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, PaUtil_InitializeStreamRepresentation( &stream->streamRepresentation, &winDsHostApi->blockingStreamInterface, streamCallback, userData ); } - + streamRepresentationIsInitialized = 1; stream->streamFlags = streamFlags; @@ -1875,15 +1875,15 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor); /* FIXME: not initialised anywhere else */ stream->streamRepresentation.streamInfo.sampleRate = sampleRate; - -/* DirectSound specific initialization */ + +/* DirectSound specific initialization */ { HRESULT hr; int bytesPerDirectSoundInputBuffer, bytesPerDirectSoundOutputBuffer; int userLatencyFrames; int minLatencyFrames; unsigned long integerSampleRate = (unsigned long) (sampleRate + 0.5); - + stream->timerID = 0; stream->processingCompleted = CreateEvent( NULL, /* bManualReset = */ TRUE, /* bInitialState = */ FALSE, NULL ); @@ -1938,7 +1938,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, PaDeviceInfo *deviceInfo = hostApi->deviceInfos[ outputParameters->device ]; DBUG(("PaHost_OpenStream: deviceID = 0x%x\n", outputParameters->device)); */ - + int bytesPerSample = Pa_GetSampleSize(hostOutputSampleFormat); bytesPerDirectSoundOutputBuffer = stream->framesPerDSBuffer * outputParameters->channelCount * bytesPerSample; if( bytesPerDirectSoundOutputBuffer < DSBSIZE_MIN ) @@ -1980,7 +1980,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, PaDeviceInfo *deviceInfo = hostApi->deviceInfos[ inputParameters->device ]; DBUG(("PaHost_OpenStream: deviceID = 0x%x\n", inputParameters->device)); */ - + int bytesPerSample = Pa_GetSampleSize(hostInputSampleFormat); bytesPerDirectSoundInputBuffer = stream->framesPerDSBuffer * inputParameters->channelCount * bytesPerSample; if( bytesPerDirectSoundInputBuffer < DSBSIZE_MIN ) @@ -2007,7 +2007,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, assert( stream->pDirectSound == NULL ); assert( stream->pDirectSoundPrimaryBuffer == NULL ); assert( stream->pDirectSoundOutputBuffer == NULL ); - + if( inputParameters && outputParameters ) { @@ -2027,14 +2027,14 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, integerSampleRate ); DBUG(("InitFullDuplexInputOutputBuffers() returns %x\n", hr)); - /* ignore any error returned by InitFullDuplexInputOutputBuffers. + /* ignore any error returned by InitFullDuplexInputOutputBuffers. we retry opening the buffers below */ #endif /* PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE */ } - /* create half duplex buffers. also used for full-duplex streams which didn't + /* create half duplex buffers. also used for full-duplex streams which didn't succeed when using the full duplex API. that could happen because - DX8 or greater isnt installed, the i/o devices aren't the same + DX8 or greater isnt installed, the i/o devices aren't the same physical device. etc. */ @@ -2202,11 +2202,11 @@ static HRESULT QueryOutputSpace( PaWinDsStream *stream, long *bytesEmpty ) /* From MSDN: - The write cursor indicates the position at which it is safe + The write cursor indicates the position at which it is safe to write new data to the buffer. The write cursor always leads the play cursor, typically by about 15 milliseconds' worth of audio data. - It is always safe to change data that is behind the position + It is always safe to change data that is behind the position indicated by the lpdwCurrentPlayCursor parameter. */ @@ -2231,7 +2231,7 @@ static int TimeSlice( PaWinDsStream *stream ) HRESULT hresult; double outputLatency = 0; PaStreamCallbackTimeInfo timeInfo = {0,0,0}; /** @todo implement inputBufferAdcTime */ - + /* Input */ LPBYTE lpInBuf1 = NULL; LPBYTE lpInBuf2 = NULL; @@ -2262,7 +2262,7 @@ static int TimeSlice( PaWinDsStream *stream ) } // FIXME: what happens if IDirectSoundCaptureBuffer_GetCurrentPosition fails? - framesToXfer = numInFramesReady = bytesFilled / stream->bytesPerInputFrame; + framesToXfer = numInFramesReady = bytesFilled / stream->bytesPerInputFrame; outputLatency = ((double)bytesFilled) * stream->secondsPerHostByte; // FIXME: this doesn't look right. we're calculating output latency in input branch. also secondsPerHostByte is only initialized for the output stream /** @todo Check for overflow */ @@ -2298,7 +2298,7 @@ static int TimeSlice( PaWinDsStream *stream ) PaUtil_BeginBufferProcessing( &stream->bufferProcessor, &timeInfo, stream->callbackFlags ); stream->callbackFlags = 0; - + /* Input */ if( stream->bufferProcessor.inputChannelCount > 0 ) { @@ -2360,7 +2360,7 @@ static int TimeSlice( PaWinDsStream *stream ) numFrames = PaUtil_EndBufferProcessing( &stream->bufferProcessor, &stream->callbackResult ); stream->framesWritten += numFrames; - + if( stream->bufferProcessor.outputChannelCount > 0 ) { /* FIXME: an underflow could happen here */ @@ -2383,7 +2383,7 @@ error1: } error2: - PaUtil_EndCpuLoadMeasurement( &stream->cpuLoadMeasurer, numFrames ); + PaUtil_EndCpuLoadMeasurement( &stream->cpuLoadMeasurer, numFrames ); } if( stream->callbackResult == paComplete && !PaUtil_IsBufferProcessorOutputEmpty( &stream->bufferProcessor ) ) @@ -2441,7 +2441,7 @@ static void CALLBACK TimerCallback(UINT uID, UINT uMsg, DWORD_PTR dwUser, DWORD (void) uMsg; (void) dw1; (void) dw2; - + stream = (PaWinDsStream *) dwUser; if( stream == NULL ) return; @@ -2472,8 +2472,8 @@ static void CALLBACK TimerCallback(UINT uID, UINT uMsg, DWORD_PTR dwUser, DWORD int callbackResult = TimeSlice( stream ); if( callbackResult != paContinue ) { - /* FIXME implement handling of paComplete and paAbort if possible - At the moment this should behave as if paComplete was called and + /* FIXME implement handling of paComplete and paAbort if possible + At the moment this should behave as if paComplete was called and flush the buffer. */ @@ -2574,7 +2574,7 @@ static HRESULT ClearOutputBuffer( PaWinDsStream *stream ) // Unlock the DS buffer if ((hr = IDirectSoundBuffer_Unlock( stream->pDirectSoundOutputBuffer, pDSBuffData, dwDataLen, NULL, 0)) != DS_OK) return hr; - + // Let DSound set the starting write position because if we set it to zero, it looks like the // buffer is full to begin with. This causes a long pause before sound starts when using large buffers. if ((hr = IDirectSoundBuffer_GetCurrentPosition( stream->pDirectSoundOutputBuffer, @@ -2591,10 +2591,10 @@ static PaError StartStream( PaStream *s ) PaError result = paNoError; PaWinDsStream *stream = (PaWinDsStream*)s; HRESULT hr; - + stream->callbackResult = paContinue; PaUtil_ResetBufferProcessor( &stream->bufferProcessor ); - + ResetEvent( stream->processingCompleted ); if( stream->bufferProcessor.inputChannelCount > 0 ) @@ -2671,7 +2671,7 @@ static PaError StartStream( PaStream *s ) resolution = msecPerWakeup/4; stream->timerID = timeSetEvent( msecPerWakeup, resolution, (LPTIMECALLBACK) TimerCallback, (DWORD_PTR) stream, TIME_PERIODIC | TIME_KILL_SYNCHRONOUS ); - + if( stream->timerID == 0 ) { stream->isActive = 0; @@ -2851,7 +2851,7 @@ static signed long GetStreamWriteAvailable( PaStream* s ) /* suppress unused variable warnings */ (void) stream; - + /* IMPLEMENT ME, see portaudio.h for required behavior*/ return 0; diff --git a/3rdparty/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.c b/3rdparty/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.c index c4e3c4ecab..a545c6c9c0 100644 --- a/3rdparty/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.c +++ b/3rdparty/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.c @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -180,7 +180,7 @@ void PaWinDs_InitializeDSoundEntryPoints(void) #ifdef PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE paWinDsDSoundEntryPoints.DirectSoundFullDuplexCreate8 = (HRESULT (WINAPI *)(LPCGUID, LPCGUID, LPCDSCBUFFERDESC, LPCDSBUFFERDESC, - HWND, DWORD, LPDIRECTSOUNDFULLDUPLEX *, LPDIRECTSOUNDCAPTUREBUFFER8 *, + HWND, DWORD, LPDIRECTSOUNDFULLDUPLEX *, LPDIRECTSOUNDCAPTUREBUFFER8 *, LPDIRECTSOUNDBUFFER8 *, LPUNKNOWN)) GetProcAddress( paWinDsDSoundEntryPoints.hInstance_, "DirectSoundFullDuplexCreate" ); if( paWinDsDSoundEntryPoints.DirectSoundFullDuplexCreate8 == NULL ) @@ -221,4 +221,4 @@ void PaWinDs_TerminateDSoundEntryPoints(void) FreeLibrary( paWinDsDSoundEntryPoints.hInstance_ ); paWinDsDSoundEntryPoints.hInstance_ = NULL; } -} \ No newline at end of file +} diff --git a/3rdparty/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.h b/3rdparty/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.h index fd6d8feda6..dfb8a89832 100644 --- a/3rdparty/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.h +++ b/3rdparty/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.h @@ -29,13 +29,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -74,7 +74,7 @@ extern "C" typedef struct { HINSTANCE hInstance_; - + HRESULT (WINAPI *DllGetClassObject)(REFCLSID , REFIID , LPVOID *); HRESULT (WINAPI *DirectSoundCreate)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN); @@ -88,7 +88,7 @@ typedef struct #ifdef PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE HRESULT (WINAPI *DirectSoundFullDuplexCreate8)( LPCGUID, LPCGUID, LPCDSCBUFFERDESC, LPCDSBUFFERDESC, - HWND, DWORD, LPDIRECTSOUNDFULLDUPLEX *, LPDIRECTSOUNDCAPTUREBUFFER8 *, + HWND, DWORD, LPDIRECTSOUNDFULLDUPLEX *, LPDIRECTSOUNDCAPTUREBUFFER8 *, LPDIRECTSOUNDBUFFER8 *, LPUNKNOWN ); #endif }PaWinDsDSoundEntryPoints; diff --git a/3rdparty/portaudio/src/hostapi/oss/recplay.c b/3rdparty/portaudio/src/hostapi/oss/recplay.c index 9d4c78cfa3..fe6dfdb633 100644 --- a/3rdparty/portaudio/src/hostapi/oss/recplay.c +++ b/3rdparty/portaudio/src/hostapi/oss/recplay.c @@ -2,7 +2,7 @@ * recplay.c * Phil Burk * Minimal record and playback test. - * + * */ #include #include diff --git a/3rdparty/portaudio/src/hostapi/wasapi/pa_win_wasapi.c b/3rdparty/portaudio/src/hostapi/wasapi/pa_win_wasapi.c index b8e7b30730..95638be73e 100644 --- a/3rdparty/portaudio/src/hostapi/wasapi/pa_win_wasapi.c +++ b/3rdparty/portaudio/src/hostapi/wasapi/pa_win_wasapi.c @@ -859,7 +859,7 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd If COM is already initialized CoInitialize will either return FALSE, or RPC_E_CHANGED_MODE if it was initialised in a different threading mode. In either case we shouldn't consider it an error - but we need to be careful to not call CoUninitialize() if + but we need to be careful to not call CoUninitialize() if RPC_E_CHANGED_MODE was returned. */ hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); @@ -1360,8 +1360,8 @@ static PaSampleFormat waveformatToPaFormat(const WAVEFORMATEXTENSIBLE *in) } } break; } - - case WAVE_FORMAT_IEEE_FLOAT: + + case WAVE_FORMAT_IEEE_FLOAT: return paFloat32; case WAVE_FORMAT_PCM: { @@ -1808,7 +1808,7 @@ static HRESULT CreateAudioClient(PaWasapiSubStream *pSubStream, PaWasapiDeviceIn } // Issues with setting exclusive mode due to pSubStream->period beeing wrong somehow // Most likely reason is that framesPerLatency is hardcoded to 0. - else if (pSubStream->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE) + else if (pSubStream->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE) pSubStream->period = info->MinimumDevicePeriod; // Gives 3ms of latency // Open the stream and associate it with an audio session diff --git a/3rdparty/portaudio/src/hostapi/wdmks/pa_win_wdmks.c b/3rdparty/portaudio/src/hostapi/wdmks/pa_win_wdmks.c index caddfd52d6..eefb76f5ae 100644 --- a/3rdparty/portaudio/src/hostapi/wdmks/pa_win_wdmks.c +++ b/3rdparty/portaudio/src/hostapi/wdmks/pa_win_wdmks.c @@ -27,13 +27,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -1565,10 +1565,10 @@ static PaError FilterCanCreateCapturePin(PaWinWdmFilter* filter, /** * Build the list of available filters - * Use the SetupDi API to enumerate all devices in the KSCATEGORY_AUDIO which - * have a KSCATEGORY_RENDER or KSCATEGORY_CAPTURE alias. For each of these - * devices initialise a PaWinWdmFilter structure by calling our NewFilter() - * function. We enumerate devices twice, once to count how many there are, + * Use the SetupDi API to enumerate all devices in the KSCATEGORY_AUDIO which + * have a KSCATEGORY_RENDER or KSCATEGORY_CAPTURE alias. For each of these + * devices initialise a PaWinWdmFilter structure by calling our NewFilter() + * function. We enumerate devices twice, once to count how many there are, * and once to initialize the PaWinWdmFilter structures. */ static PaError BuildFilterList(PaWinWdmHostApiRepresentation* wdmHostApi) @@ -2255,7 +2255,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, stream->recordingPin = FilterCreateCapturePin(pFilter, (const WAVEFORMATEX*)&wfx, &result); stream->deviceInputChannels = stream->userInputChannels; } - + if(result != paNoError) { /* Search through all PaSampleFormats to find one that works */ hostInputSampleFormat = paFloat32; @@ -2265,7 +2265,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, stream->bytesPerInputFrame = wfx.Format.nBlockAlign; stream->recordingPin = FilterCreateCapturePin(pFilter, (const WAVEFORMATEX*)&wfx, &result); stream->deviceInputChannels = stream->userInputChannels; - + if(stream->recordingPin == NULL) result = paSampleFormatNotSupported; if(result != paNoError) hostInputSampleFormat <<= 1; } @@ -2374,7 +2374,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, { hostOutputSampleFormat = PaUtil_SelectClosestAvailableFormat( pFilter->formats, outputSampleFormat ); - + /* Try a WAVE_FORMAT_PCM instead */ wfx.Format.wFormatTag = WAVE_FORMAT_PCM; wfx.Format.cbSize = 0; @@ -2384,7 +2384,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, stream->playbackPin = FilterCreateRenderPin(pFilter,(WAVEFORMATEX*)&wfx,&result); if(stream->playbackPin == NULL) result = paSampleFormatNotSupported; } - + if( result != paNoError ) { /* Some or all KS devices can only handle the exact number of channels @@ -2543,7 +2543,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, p->Header.Size = sizeof(p->Header); p->Header.PresentationTime.Numerator = 1; p->Header.PresentationTime.Denominator = 1; - + p = &(stream->packets[3]); p->Signal.hEvent = stream->events[3]; p->Header.Data = stream->hostBuffer + 2*stream->framesPerHostIBuffer*stream->bytesPerInputFrame + stream->framesPerHostOBuffer*stream->bytesPerOutputFrame; @@ -2916,7 +2916,7 @@ static DWORD WINAPI ProcessingThread(LPVOID pParam) PaUtil_SetInputChannel(&stream->bufferProcessor,i,((unsigned char*)(stream->packets[inbuf].Header.Data))+(i*stream->inputSampleSize),stream->deviceInputChannels); } } - + if (stream->recordingPin && stream->playbackPin) /* full duplex */ { /* Only call the EndBufferProcessing function when the total input frames == total output frames */ @@ -2931,7 +2931,7 @@ static DWORD WINAPI ProcessingThread(LPVOID pParam) framesProcessed = 0; } } - else + else { framesProcessed = PaUtil_EndBufferProcessing(&stream->bufferProcessor,&cbResult); } @@ -2962,7 +2962,7 @@ static DWORD WINAPI ProcessingThread(LPVOID pParam) fillPlaybuf = 0; emptyRecordbuf = 0; } - + /* if(cbResult != paContinue) { @@ -3301,4 +3301,4 @@ static signed long GetStreamWriteAvailable( PaStream* s ) /* IMPLEMENT ME, see portaudio.h for required behavior*/ PA_LOGL_; return 0; -} \ No newline at end of file +} diff --git a/3rdparty/portaudio/src/hostapi/wmme/pa_win_wmme.c b/3rdparty/portaudio/src/hostapi/wmme/pa_win_wmme.c index 2436d8de1f..5d777ac528 100644 --- a/3rdparty/portaudio/src/hostapi/wmme/pa_win_wmme.c +++ b/3rdparty/portaudio/src/hostapi/wmme/pa_win_wmme.c @@ -1,8 +1,8 @@ /* * $Id: pa_win_wmme.c 1432 2009-12-09 01:31:44Z rossb $ * pa_win_wmme.c - * Implementation of PortAudio for Windows MultiMedia Extensions (WMME) - * + * Implementation of PortAudio for Windows MultiMedia Extensions (WMME) + * * PortAudio Portable Real-Time Audio Library * Latest Version at: http://www.portaudio.com * @@ -30,13 +30,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -87,7 +87,7 @@ Non-critical stuff for the future: @todo Investigate supporting host buffer formats > 16 bits - + @todo define UNICODE and _UNICODE in the project settings and see what breaks @todo refactor conversion of MMSYSTEM errors into PA arrors into a single function. @@ -236,7 +236,7 @@ size_t StrTLen(const TCHAR *str) #if !defined(_UNICODE) && !defined(UNICODE) return strlen(str); #else - return wcslen(str); + return wcslen(str); #endif } @@ -308,7 +308,7 @@ static signed long GetStreamWriteAvailable( PaStream* stream ); mmeErrorTextWide, -1, mmeErrorText, MAXERRORLENGTH, NULL, NULL ); \ PaUtil_SetLastHostErrorInfo( paMME, mmresult, mmeErrorText ); \ } - + #else /* !UNICODE */ #define PA_MME_SET_LAST_WAVEIN_ERROR( mmresult ) \ @@ -361,7 +361,7 @@ static PaError CreateEventWithPaError( HANDLE *handle, PaError result = paNoError; *handle = NULL; - + *handle = CreateEvent( lpEventAttributes, bManualReset, bInitialState, lpName ); if( *handle == NULL ) { @@ -393,7 +393,7 @@ static PaError ResetEventWithPaError( HANDLE handle ) static PaError CloseHandleWithPaError( HANDLE handle ) { PaError result = paNoError; - + if( handle ) { if( CloseHandle( handle ) == 0 ) @@ -402,7 +402,7 @@ static PaError CloseHandleWithPaError( HANDLE handle ) PA_MME_SET_LAST_SYSTEM_ERROR( GetLastError() ); } } - + return result; } @@ -416,14 +416,14 @@ typedef struct PaUtilStreamInterface blockingStreamInterface; PaUtilAllocationGroup *allocations; - + int inputDeviceCount, outputDeviceCount; /** winMmeDeviceIds is an array of WinMme device ids. fields in the range [0, inputDeviceCount) are input device ids, and [inputDeviceCount, inputDeviceCount + outputDeviceCount) are output device ids. - */ + */ UINT *winMmeDeviceIds; } PaWinMmeHostApiRepresentation; @@ -524,7 +524,7 @@ static int SampleFormatAndWinWmmeSpecificFlagsToLinearWaveFormatTag( PaSampleFor static PaError QueryInputWaveFormatEx( int deviceId, WAVEFORMATEX *waveFormatEx ) { MMRESULT mmresult; - + switch( mmresult = waveInOpen( NULL, deviceId, waveFormatEx, 0, 0, WAVE_FORMAT_QUERY ) ) { case MMSYSERR_NOERROR: @@ -537,7 +537,7 @@ static PaError QueryInputWaveFormatEx( int deviceId, WAVEFORMATEX *waveFormatEx return paInsufficientMemory; case WAVERR_BADFORMAT: /* Attempted to open with an unsupported waveform-audio format. */ return paSampleFormatNotSupported; - + case MMSYSERR_BADDEVICEID: /* Specified device identifier is out of range. */ /* falls through */ default: @@ -550,7 +550,7 @@ static PaError QueryInputWaveFormatEx( int deviceId, WAVEFORMATEX *waveFormatEx static PaError QueryOutputWaveFormatEx( int deviceId, WAVEFORMATEX *waveFormatEx ) { MMRESULT mmresult; - + switch( mmresult = waveOutOpen( NULL, deviceId, waveFormatEx, 0, 0, WAVE_FORMAT_QUERY ) ) { case MMSYSERR_NOERROR: @@ -563,7 +563,7 @@ static PaError QueryOutputWaveFormatEx( int deviceId, WAVEFORMATEX *waveFormatEx return paInsufficientMemory; case WAVERR_BADFORMAT: /* Attempted to open with an unsupported waveform-audio format. */ return paSampleFormatNotSupported; - + case MMSYSERR_BADDEVICEID: /* Specified device identifier is out of range. */ /* falls through */ default: @@ -581,14 +581,14 @@ static PaError QueryFormatSupported( PaDeviceInfo *deviceInfo, PaWinWaveFormat waveFormat; PaSampleFormat sampleFormat; int waveFormatTag; - + /* @todo at the moment we only query with 16 bit sample format and directout speaker config*/ sampleFormat = paInt16; waveFormatTag = SampleFormatAndWinWmmeSpecificFlagsToLinearWaveFormatTag( sampleFormat, winMmeSpecificFlags ); if( waveFormatTag == PaWin_SampleFormatToLinearWaveFormatTag( paInt16 ) ){ - + /* attempt bypass querying the device for linear formats */ if( sampleRate == 11025.0 @@ -614,7 +614,7 @@ static PaError QueryFormatSupported( PaDeviceInfo *deviceInfo, } - /* first, attempt to query the device using WAVEFORMATEXTENSIBLE, + /* first, attempt to query the device using WAVEFORMATEXTENSIBLE, if this fails we fall back to WAVEFORMATEX */ PaWin_InitializeWaveFormatExtensible( &waveFormat, channels, sampleFormat, waveFormatTag, @@ -639,12 +639,12 @@ static void DetectDefaultSampleRate( PaWinMmeDeviceInfo *winMmeDeviceInfo, int w { PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo; int i; - + deviceInfo->defaultSampleRate = 0.; for( i=0; i < PA_DEFAULTSAMPLERATESEARCHORDER_COUNT_; ++i ) { - double sampleRate = defaultSampleRateSearchOrder_[ i ]; + double sampleRate = defaultSampleRateSearchOrder_[ i ]; PaError paerror = QueryFormatSupported( deviceInfo, waveFormatExQueryFunction, winMmeDeviceId, maxChannels, sampleRate, 0 ); if( paerror == paNoError ) { @@ -697,7 +697,7 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH MMRESULT mmresult; WAVEINCAPS wic; PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo; - + *success = 0; mmresult = waveInGetDevCaps( winMmeInputDeviceId, &wic, sizeof( WAVEINCAPS ) ); @@ -714,7 +714,7 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH the entire initialisation process. */ return paNoError; - } + } if( winMmeInputDeviceId == WAVE_MAPPER ) { @@ -762,7 +762,7 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH } #ifdef PAWIN_USE_WDMKS_DEVICE_INFO - winMmeDeviceInfo->deviceInputChannelCountIsKnown = + winMmeDeviceInfo->deviceInputChannelCountIsKnown = QueryWaveInKSFilterMaxChannels( winMmeInputDeviceId, &deviceInfo->maxInputChannels ); #endif /* PAWIN_USE_WDMKS_DEVICE_INFO */ @@ -772,7 +772,7 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH QueryInputWaveFormatEx, deviceInfo->maxInputChannels ); *success = 1; - + error: return result; } @@ -886,7 +886,7 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme } #ifdef PAWIN_USE_WDMKS_DEVICE_INFO - wdmksDeviceOutputChannelCountIsKnown = QueryWaveOutKSFilterMaxChannels( + wdmksDeviceOutputChannelCountIsKnown = QueryWaveOutKSFilterMaxChannels( winMmeOutputDeviceId, &deviceInfo->maxOutputChannels ); if( wdmksDeviceOutputChannelCountIsKnown && !winMmeDeviceInfo->deviceOutputChannelCountIsKnown ) winMmeDeviceInfo->deviceOutputChannelCountIsKnown = 1; @@ -898,7 +898,7 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme QueryOutputWaveFormatEx, deviceInfo->maxOutputChannels ); *success = 1; - + error: return result; } @@ -922,7 +922,7 @@ static void GetDefaultLatencies( PaTime *defaultLowLatency, PaTime *defaultHighL else { *defaultLowLatency = PA_MME_WIN_9X_DEFAULT_LATENCY_; - } + } *defaultHighLatency = *defaultLowLatency * 2; } @@ -959,7 +959,7 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd (*hostApi)->info.type = paMME; (*hostApi)->info.name = "MME"; - + /* initialise device counts and default devices under the assumption that there are no devices. These values are incremented below if and when devices are successfully initialized. @@ -1052,7 +1052,7 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd if( (*hostApi)->info.defaultInputDevice == paNoDevice ){ /* if there is currently no default device, use the first one available */ (*hostApi)->info.defaultInputDevice = (*hostApi)->info.deviceCount; - + }else if( winMmeDeviceId == waveInPreferredDevice ){ /* set the default device to the system preferred device */ (*hostApi)->info.defaultInputDevice = (*hostApi)->info.deviceCount; @@ -1084,7 +1084,7 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd deviceInfo->defaultLowInputLatency = defaultLowLatency; deviceInfo->defaultLowOutputLatency = defaultLowLatency; deviceInfo->defaultHighInputLatency = defaultHighLatency; - deviceInfo->defaultHighOutputLatency = defaultHighLatency; + deviceInfo->defaultHighOutputLatency = defaultHighLatency; result = InitializeOutputDeviceInfo( winMmeHostApi, wmmeDeviceInfo, winMmeDeviceId, &deviceInfoInitializationSucceeded ); @@ -1110,7 +1110,7 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd } } } - + InitializeDefaultDeviceIdsFromEnv( winMmeHostApi ); (*hostApi)->Terminate = Terminate; @@ -1138,7 +1138,7 @@ error: PaUtil_FreeAllAllocations( winMmeHostApi->allocations ); PaUtil_DestroyAllocationGroup( winMmeHostApi->allocations ); } - + PaUtil_FreeMemory( winMmeHostApi ); } @@ -1168,7 +1168,7 @@ static PaError IsInputChannelCountSupported( PaWinMmeDeviceInfo* deviceInfo, int && deviceInfo->deviceInputChannelCountIsKnown && channelCount > deviceInfo->inheritedDeviceInfo.maxInputChannels ){ - result = paInvalidChannelCount; + result = paInvalidChannelCount; } return result; @@ -1182,7 +1182,7 @@ static PaError IsOutputChannelCountSupported( PaWinMmeDeviceInfo* deviceInfo, in && deviceInfo->deviceOutputChannelCountIsKnown && channelCount > deviceInfo->inheritedDeviceInfo.maxOutputChannels ){ - result = paInvalidChannelCount; + result = paInvalidChannelCount; } return result; @@ -1208,14 +1208,14 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, then the only thing that could fail is the sample rate. This isn't strictly true, but I can't think of a better way to test that the sample rate is valid. - */ - + */ + if( inputParameters ) { inputChannelCount = inputParameters->channelCount; inputSampleFormat = inputParameters->sampleFormat; inputStreamInfo = inputParameters->hostApiSpecificStreamInfo; - + /* all standard sample formats are supported by the buffer adapter, this implementation doesn't support any custom sample formats */ if( inputSampleFormat & paCustomFormat ) @@ -1228,29 +1228,29 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, for( i=0; i< inputStreamInfo->deviceCount; ++i ) { inputMultipleDeviceChannelCount += inputStreamInfo->devices[i].channelCount; - + inputDeviceInfo = hostApi->deviceInfos[ inputStreamInfo->devices[i].device ]; /* check that input device can support inputChannelCount */ if( inputStreamInfo->devices[i].channelCount < 1 ) return paInvalidChannelCount; - paerror = IsInputChannelCountSupported( (PaWinMmeDeviceInfo*)inputDeviceInfo, + paerror = IsInputChannelCountSupported( (PaWinMmeDeviceInfo*)inputDeviceInfo, inputStreamInfo->devices[i].channelCount ); if( paerror != paNoError ) return paerror; /* test for valid sample rate, see comment above */ winMmeInputDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, inputStreamInfo->devices[i].device ); - paerror = QueryFormatSupported( inputDeviceInfo, QueryInputWaveFormatEx, - winMmeInputDeviceId, inputStreamInfo->devices[i].channelCount, sampleRate, + paerror = QueryFormatSupported( inputDeviceInfo, QueryInputWaveFormatEx, + winMmeInputDeviceId, inputStreamInfo->devices[i].channelCount, sampleRate, ((inputStreamInfo) ? inputStreamInfo->flags : 0) ); if( paerror != paNoError ) return paInvalidSampleRate; } - + if( inputMultipleDeviceChannelCount != inputChannelCount ) - return paIncompatibleHostApiSpecificStreamInfo; + return paIncompatibleHostApiSpecificStreamInfo; } else { @@ -1266,7 +1266,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, /* test for valid sample rate, see comment above */ winMmeInputDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, inputParameters->device ); - paerror = QueryFormatSupported( inputDeviceInfo, QueryInputWaveFormatEx, + paerror = QueryFormatSupported( inputDeviceInfo, QueryInputWaveFormatEx, winMmeInputDeviceId, inputChannelCount, sampleRate, ((inputStreamInfo) ? inputStreamInfo->flags : 0) ); if( paerror != paNoError ) @@ -1292,29 +1292,29 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, for( i=0; i< outputStreamInfo->deviceCount; ++i ) { outputMultipleDeviceChannelCount += outputStreamInfo->devices[i].channelCount; - + outputDeviceInfo = hostApi->deviceInfos[ outputStreamInfo->devices[i].device ]; /* check that output device can support outputChannelCount */ if( outputStreamInfo->devices[i].channelCount < 1 ) return paInvalidChannelCount; - paerror = IsOutputChannelCountSupported( (PaWinMmeDeviceInfo*)outputDeviceInfo, + paerror = IsOutputChannelCountSupported( (PaWinMmeDeviceInfo*)outputDeviceInfo, outputStreamInfo->devices[i].channelCount ); if( paerror != paNoError ) return paerror; /* test for valid sample rate, see comment above */ winMmeOutputDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, outputStreamInfo->devices[i].device ); - paerror = QueryFormatSupported( outputDeviceInfo, QueryOutputWaveFormatEx, + paerror = QueryFormatSupported( outputDeviceInfo, QueryOutputWaveFormatEx, winMmeOutputDeviceId, outputStreamInfo->devices[i].channelCount, sampleRate, ((outputStreamInfo) ? outputStreamInfo->flags : 0) ); if( paerror != paNoError ) return paInvalidSampleRate; } - + if( outputMultipleDeviceChannelCount != outputChannelCount ) - return paIncompatibleHostApiSpecificStreamInfo; + return paIncompatibleHostApiSpecificStreamInfo; } else { @@ -1330,14 +1330,14 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, /* test for valid sample rate, see comment above */ winMmeOutputDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, outputParameters->device ); - paerror = QueryFormatSupported( outputDeviceInfo, QueryOutputWaveFormatEx, + paerror = QueryFormatSupported( outputDeviceInfo, QueryOutputWaveFormatEx, winMmeOutputDeviceId, outputChannelCount, sampleRate, ((outputStreamInfo) ? outputStreamInfo->flags : 0) ); if( paerror != paNoError ) return paInvalidSampleRate; } } - + /* - if a full duplex stream is requested, check that the combination of input and output parameters is supported @@ -1347,7 +1347,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi, for mme all we can do is test that the input and output devices support the requested sample rate and number of channels. we cannot test for full duplex compatibility. - */ + */ return paFormatIsSupported; } @@ -1363,7 +1363,7 @@ static void SelectBufferSizeAndCount( unsigned long baseBufferSize, unsigned long sizeMultiplier, bufferCount, latency; unsigned long nextLatency, nextBufferSize; int baseBufferSizeIsPowerOfTwo; - + sizeMultiplier = 1; bufferCount = baseBufferCount; @@ -1399,7 +1399,7 @@ static void SelectBufferSizeAndCount( unsigned long baseBufferSize, sizeMultiplier *= 2; nextBufferSize = (baseBufferSize * (sizeMultiplier*2)); nextLatency = nextBufferSize * (bufferCount-1); - } + } }else{ @@ -1416,7 +1416,7 @@ static void SelectBufferSizeAndCount( unsigned long baseBufferSize, } if( nextLatency < requestedLatency ) - ++sizeMultiplier; + ++sizeMultiplier; } /* increase number of buffers until requestedLatency is reached */ @@ -1469,7 +1469,7 @@ static void ReselectBufferCount( unsigned long bufferSize, { ++bufferCount; latency = bufferSize * (bufferCount-1); - } + } } *hostBufferCount = bufferCount; @@ -1494,7 +1494,7 @@ static PaError CalculateBufferSettings( int effectiveInputChannelCount, effectiveOutputChannelCount; int hostInputFrameSize = 0; unsigned int i; - + if( inputChannelCount > 0 ) { int hostInputSampleSize = Pa_GetSampleSize( hostInputSampleFormat ); @@ -1584,14 +1584,14 @@ static PaError CalculateBufferSettings( *framesPerHostOutputBuffer = outputStreamInfo->framesPerBuffer; *hostOutputBufferCount = outputStreamInfo->bufferCount; - + if( inputChannelCount > 0 ) /* full duplex */ { if( *framesPerHostInputBuffer != *framesPerHostOutputBuffer ) { if( inputStreamInfo && ( inputStreamInfo->flags & paWinMmeUseLowLevelLatencyParameters ) ) - { + { /* a custom StreamInfo was used for specifying both input and output buffer sizes, the larger buffer size must be a multiple of the smaller buffer size */ @@ -1612,7 +1612,7 @@ static PaError CalculateBufferSettings( result = paIncompatibleHostApiSpecificStreamInfo; goto error; } - } + } } else { @@ -1662,7 +1662,7 @@ static PaError CalculateBufferSettings( } hostOutputFrameSize = hostOutputSampleSize * effectiveOutputChannelCount; - + maximumBufferSize = (long) ((PA_MME_MAX_HOST_BUFFER_SECS_ * sampleRate) * hostOutputFrameSize); if( maximumBufferSize > PA_MME_MAX_HOST_BUFFER_BYTES_ ) maximumBufferSize = PA_MME_MAX_HOST_BUFFER_BYTES_; @@ -1696,7 +1696,7 @@ static PaError CalculateBufferSettings( if( framesPerHostInputBuffer < framesPerHostOutputBuffer ) { unsigned long framesPerHostBuffer = *framesPerHostInputBuffer; - + minimumBufferCount = PA_MME_MIN_HOST_OUTPUT_BUFFER_COUNT_; ReselectBufferCount( framesPerHostBuffer * hostOutputFrameSize, /* bufferSize */ @@ -1711,7 +1711,7 @@ static PaError CalculateBufferSettings( else { unsigned long framesPerHostBuffer = *framesPerHostOutputBuffer; - + minimumBufferCount = PA_MME_MIN_HOST_INPUT_BUFFER_COUNT_FULL_DUPLEX_; ReselectBufferCount( framesPerHostBuffer * hostInputFrameSize, /* bufferSize */ @@ -1723,7 +1723,7 @@ static PaError CalculateBufferSettings( *framesPerHostInputBuffer = framesPerHostBuffer; *hostInputBufferCount = hostBufferCount; } - } + } } } } @@ -1777,7 +1777,7 @@ static void InitializeSingleDirectionHandlesAndBuffers( PaWinMmeSingleDirectionH handlesAndBuffers->deviceCount = 0; handlesAndBuffers->waveHeaders = 0; handlesAndBuffers->bufferCount = 0; -} +} static PaError InitializeWaveHandles( PaWinMmeHostApiRepresentation *winMmeHostApi, PaWinMmeSingleDirectionHandlesAndBuffers *handlesAndBuffers, @@ -1793,7 +1793,7 @@ static PaError InitializeWaveHandles( PaWinMmeHostApiRepresentation *winMmeHostA int waveFormatTag; /* for error cleanup we expect that InitializeSingleDirectionHandlesAndBuffers() - has already been called to zero some fields */ + has already been called to zero some fields */ result = CreateEventWithPaError( &handlesAndBuffers->bufferEvent, NULL, FALSE, FALSE, NULL ); if( result != paNoError ) goto error; @@ -1826,18 +1826,18 @@ static PaError InitializeWaveHandles( PaWinMmeHostApiRepresentation *winMmeHostA { PaWinWaveFormat waveFormat; UINT winMmeDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, devices[i].device ); - - /* @todo: consider providing a flag or #define to not try waveformat extensible + + /* @todo: consider providing a flag or #define to not try waveformat extensible this could just initialize j to 1 the first time round. */ for( j = 0; j < 2; ++j ) { if( j == 0 ) - { - /* first, attempt to open the device using WAVEFORMATEXTENSIBLE, + { + /* first, attempt to open the device using WAVEFORMATEXTENSIBLE, if this fails we fall back to WAVEFORMATEX */ - PaWin_InitializeWaveFormatExtensible( &waveFormat, devices[i].channelCount, + PaWin_InitializeWaveFormatExtensible( &waveFormat, devices[i].channelCount, sampleFormat, waveFormatTag, sampleRate, channelMask ); } @@ -1845,7 +1845,7 @@ static PaError InitializeWaveHandles( PaWinMmeHostApiRepresentation *winMmeHostA { /* retry with WAVEFORMATEX */ - PaWin_InitializeWaveFormatEx( &waveFormat, devices[i].channelCount, + PaWin_InitializeWaveFormatEx( &waveFormat, devices[i].channelCount, sampleFormat, waveFormatTag, sampleRate ); } @@ -1855,13 +1855,13 @@ static PaError InitializeWaveHandles( PaWinMmeHostApiRepresentation *winMmeHostA if( isInput ) { - mmresult = waveInOpen( &((HWAVEIN*)handlesAndBuffers->waveHandles)[i], winMmeDeviceId, + mmresult = waveInOpen( &((HWAVEIN*)handlesAndBuffers->waveHandles)[i], winMmeDeviceId, (WAVEFORMATEX*)&waveFormat, (DWORD_PTR)handlesAndBuffers->bufferEvent, (DWORD_PTR)0, CALLBACK_EVENT ); } else { - mmresult = waveOutOpen( &((HWAVEOUT*)handlesAndBuffers->waveHandles)[i], winMmeDeviceId, + mmresult = waveOutOpen( &((HWAVEOUT*)handlesAndBuffers->waveHandles)[i], winMmeDeviceId, (WAVEFORMATEX*)&waveFormat, (DWORD_PTR)handlesAndBuffers->bufferEvent, (DWORD_PTR)0, CALLBACK_EVENT ); } @@ -1894,7 +1894,7 @@ static PaError InitializeWaveHandles( PaWinMmeHostApiRepresentation *winMmeHostA case WAVERR_BADFORMAT: /* Attempted to open with an unsupported waveform-audio format. */ /* This can also occur if we try to open the device with an unsupported * number of channels. This is attempted when device*ChannelCountIsKnown is - * set to 0. + * set to 0. */ /* falls through */ default: @@ -1927,7 +1927,7 @@ static PaError TerminateWaveHandles( PaWinMmeSingleDirectionHandlesAndBuffers *h PaError result = paNoError; MMRESULT mmresult; signed int i; - + if( handlesAndBuffers->waveHandles ) { for( i = handlesAndBuffers->deviceCount-1; i >= 0; --i ) @@ -1972,7 +1972,7 @@ static PaError TerminateWaveHandles( PaWinMmeSingleDirectionHandlesAndBuffers *h result = CloseHandleWithPaError( handlesAndBuffers->bufferEvent ); handlesAndBuffers->bufferEvent = 0; } - + return result; } @@ -1991,7 +1991,7 @@ static PaError InitializeWaveHeaders( PaWinMmeSingleDirectionHandlesAndBuffers * /* for error cleanup we expect that InitializeSingleDirectionHandlesAndBuffers() has already been called to zero some fields */ - + /* allocate an array of pointers to arrays of wave headers, one array of wave headers per device */ @@ -2001,7 +2001,7 @@ static PaError InitializeWaveHeaders( PaWinMmeSingleDirectionHandlesAndBuffers * result = paInsufficientMemory; goto error; } - + for( i = 0; i < (signed int)handlesAndBuffers->deviceCount; ++i ) handlesAndBuffers->waveHeaders[i] = 0; @@ -2070,7 +2070,7 @@ static PaError InitializeWaveHeaders( PaWinMmeSingleDirectionHandlesAndBuffers * error: TerminateWaveHeaders( handlesAndBuffers, isInput ); - + return result; } @@ -2079,7 +2079,7 @@ static void TerminateWaveHeaders( PaWinMmeSingleDirectionHandlesAndBuffers *hand { signed int i, j; WAVEHDR *deviceWaveHeaders; - + if( handlesAndBuffers->waveHeaders ) { for( i = handlesAndBuffers->deviceCount-1; i >= 0 ; --i ) @@ -2167,14 +2167,14 @@ static PaError ValidateWinMmeSpecificStreamInfo( if( streamInfo->flags & paWinMmeDontThrottleOverloadedProcessingThread ) *throttleProcessingThreadOnOverload = 0; - + if( streamInfo->flags & paWinMmeUseMultipleDevices ) { if( streamParameters->device != paUseHostApiSpecificDeviceSpecification ) return paInvalidDevice; - + *deviceCount = streamInfo->deviceCount; - } + } } return paNoError; @@ -2191,7 +2191,7 @@ static PaError RetrieveDevicesFromStreamParameters( unsigned int i; int totalChannelCount; PaDeviceIndex hostApiDevice; - + if( streamInfo && streamInfo->flags & paWinMmeUseMultipleDevices ) { totalChannelCount = 0; @@ -2202,21 +2202,21 @@ static PaError RetrieveDevicesFromStreamParameters( streamInfo->devices[i].device, hostApi ); if( result != paNoError ) return result; - + devices[i].device = hostApiDevice; devices[i].channelCount = streamInfo->devices[i].channelCount; - + totalChannelCount += devices[i].channelCount; } - + if( totalChannelCount != streamParameters->channelCount ) { /* channelCount must match total channels specified by multiple devices */ return paInvalidChannelCount; /* REVIEW use of this error code */ } - } + } else - { + { devices[0].device = streamParameters->device; devices[0].channelCount = streamParameters->channelCount; } @@ -2238,7 +2238,7 @@ static PaError ValidateInputChannelCounts( if( devices[i].channelCount < 1 ) return paInvalidChannelCount; - inputDeviceInfo = + inputDeviceInfo = (PaWinMmeDeviceInfo*)hostApi->deviceInfos[ devices[i].device ]; paerror = IsInputChannelCountSupported( inputDeviceInfo, devices[i].channelCount ); @@ -2263,7 +2263,7 @@ static PaError ValidateOutputChannelCounts( if( devices[i].channelCount < 1 ) return paInvalidChannelCount; - outputDeviceInfo = + outputDeviceInfo = (PaWinMmeDeviceInfo*)hostApi->deviceInfos[ devices[i].device ]; paerror = IsOutputChannelCountSupported( outputDeviceInfo, devices[i].channelCount ); @@ -2309,13 +2309,13 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, unsigned long framesPerBufferProcessorCall; PaWinMmeDeviceAndChannelCount *inputDevices = 0; /* contains all devices and channel counts as local host api ids, even when PaWinMmeUseMultipleDevices is not used */ unsigned long winMmeSpecificInputFlags = 0; - unsigned long inputDeviceCount = 0; + unsigned long inputDeviceCount = 0; PaWinMmeDeviceAndChannelCount *outputDevices = 0; unsigned long winMmeSpecificOutputFlags = 0; unsigned long outputDeviceCount = 0; /* contains all devices and channel counts as local host api ids, even when PaWinMmeUseMultipleDevices is not used */ char throttleProcessingThreadOnOverload = 1; - + if( inputParameters ) { inputChannelCount = inputParameters->channelCount; @@ -2346,7 +2346,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, if( inputDeviceCount != 1 ){ /* always use direct speakers when using multi-device multichannel mode */ - inputChannelMask = PAWIN_SPEAKER_DIRECTOUT; + inputChannelMask = PAWIN_SPEAKER_DIRECTOUT; } else { @@ -2396,7 +2396,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, if( outputDeviceCount != 1 ){ /* always use direct speakers when using multi-device multichannel mode */ - outputChannelMask = PAWIN_SPEAKER_DIRECTOUT; + outputChannelMask = PAWIN_SPEAKER_DIRECTOUT; } else { @@ -2479,7 +2479,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, else { assert( (framesPerHostInputBuffer % framesPerHostOutputBuffer) == 0 ); /* CalculateBufferSettings() should guarantee this condition */ - + framesPerBufferProcessorCall = framesPerHostOutputBuffer; } } @@ -2502,7 +2502,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, framesPerBufferProcessorCall, paUtilFixedHostBufferSize, streamCallback, userData ); if( result != paNoError ) goto error; - + bufferProcessorIsInitialized = 1; stream->streamRepresentation.streamInfo.inputLatency = @@ -2538,7 +2538,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, inputDevices, inputDeviceCount, inputChannelMask, 1 /* isInput */ ); if( result != paNoError ) goto error; } - + if( outputParameters ) { result = InitializeWaveHandles( winMmeHostApi, &stream->output, @@ -2568,7 +2568,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, stream->allBuffersDurationMs = (DWORD) (1000.0 * (framesPerHostInputBuffer * stream->input.bufferCount) / sampleRate); } - + if( streamCallback ) { /* abort event is only needed for callback streams */ @@ -2586,7 +2586,7 @@ error: { if( stream->abortEvent ) CloseHandle( stream->abortEvent ); - + TerminateWaveHeaders( &stream->output, 0 /* not isInput */ ); TerminateWaveHeaders( &stream->input, 1 /* isInput */ ); @@ -2610,13 +2610,13 @@ error: static int BuffersAreDone( WAVEHDR **waveHeaders, unsigned int deviceCount, int bufferIndex ) { unsigned int i; - + for( i=0; i < deviceCount; ++i ) { if( !(waveHeaders[i][ bufferIndex ].dwFlags & WHDR_DONE) ) { return 0; - } + } } return 1; @@ -2661,13 +2661,13 @@ static int NoBuffersAreQueued( PaWinMmeSingleDirectionHandlesAndBuffers *handles #define PA_CIRCULAR_DECREMENT_( current, max )\ ( ((current) == 0) ? ((max)-1) : (current-1) ) - + static signed long GetAvailableFrames( PaWinMmeSingleDirectionHandlesAndBuffers *handlesAndBuffers ) { signed long result = 0; unsigned int i; - + if( BuffersAreDone( handlesAndBuffers->waveHeaders, handlesAndBuffers->deviceCount, handlesAndBuffers->currentBufferIndex ) ) { /* we could calculate the following in O(1) if we kept track of the @@ -2741,7 +2741,7 @@ static PaError AdvanceToNextOutputBuffer( PaWinMmeStream *stream ) PA_CIRCULAR_INCREMENT_( stream->output.currentBufferIndex, stream->output.bufferCount ); stream->output.framesUsedInCurrentBuffer = 0; - + return result; } @@ -2752,7 +2752,7 @@ static PaError CatchUpInputBuffers( PaWinMmeStream *stream ) { PaError result = paNoError; unsigned int i; - + for( i=0; i < stream->input.bufferCount - 1; ++i ) { result = AdvanceToNextInputBuffer( stream ); @@ -2811,7 +2811,7 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) int done = 0; unsigned int channel, i; unsigned long framesProcessed; - + /* prepare event array for call to WaitForMultipleObjects() */ if( stream->input.bufferEvent ) events[eventCount++] = stream->input.bufferEvent; @@ -2820,7 +2820,7 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) events[eventCount++] = stream->abortEvent; statusFlags = 0; /** @todo support paInputUnderflow, paOutputOverflow and paNeverDropInput */ - + /* loop until something causes us to stop */ do{ /* wait for MME to signal that a buffer is available, or for @@ -2880,7 +2880,7 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) { hostInputBufferIndex = -1; hostOutputBufferIndex = -1; - + if( PA_IS_INPUT_STREAM_(stream) ) { if( CurrentInputBuffersAreDone( stream ) ) @@ -2914,7 +2914,7 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) if( CurrentOutputBuffersAreDone( stream ) ) { /* ok, we have an output buffer */ - + if( NoBuffersAreQueued( &stream->output ) ) { /* @@ -2941,7 +2941,7 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) } } - + if( (PA_IS_FULL_DUPLEX_STREAM_(stream) && hostInputBufferIndex != -1 && hostOutputBufferIndex != -1) || (PA_IS_HALF_DUPLEX_STREAM_(stream) && ( hostInputBufferIndex != -1 || hostOutputBufferIndex != -1 ) ) ) { @@ -2955,11 +2955,11 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) MMTIME mmtime; double timeBeforeGetPosition, timeAfterGetPosition; double time; - long framesInBufferRing; + long framesInBufferRing; long writePosition; long playbackPosition; HWAVEOUT firstWaveOutDevice = ((HWAVEOUT*)stream->output.waveHandles)[0]; - + mmtime.wType = TIME_SAMPLES; timeBeforeGetPosition = PaUtil_GetTime(); waveOutGetPosition( firstWaveOutDevice, &mmtime, sizeof(MMTIME) ); @@ -2970,13 +2970,13 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) /* approximate time at which wave out position was measured as half way between timeBeforeGetPosition and timeAfterGetPosition */ time = timeBeforeGetPosition + (timeAfterGetPosition - timeBeforeGetPosition) * .5; - + framesInBufferRing = stream->output.bufferCount * stream->bufferProcessor.framesPerHostBuffer; playbackPosition = mmtime.u.sample % framesInBufferRing; writePosition = stream->output.currentBufferIndex * stream->bufferProcessor.framesPerHostBuffer + stream->output.framesUsedInCurrentBuffer; - + if( playbackPosition >= writePosition ){ timeInfo.outputBufferDacTime = time + ((double)( writePosition + (framesInBufferRing - playbackPosition) ) * stream->bufferProcessor.samplePeriod ); @@ -3003,13 +3003,13 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) { /* we have stored the number of channels in the buffer in dwUser */ int channelCount = (int)stream->input.waveHeaders[i][ hostInputBufferIndex ].dwUser; - + PaUtil_SetInterleavedInputChannels( &stream->bufferProcessor, channel, stream->input.waveHeaders[i][ hostInputBufferIndex ].lpData + stream->input.framesUsedInCurrentBuffer * channelCount * stream->bufferProcessor.bytesPerHostInputSample, channelCount ); - + channel += channelCount; } @@ -3018,7 +3018,7 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) if( PA_IS_OUTPUT_STREAM_(stream) ) { PaUtil_SetOutputFrameCount( &stream->bufferProcessor, 0 /* default to host buffer size */ ); - + channel = 0; for( i=0; ioutput.deviceCount; ++i ) { @@ -3081,7 +3081,7 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) done = 1; } - + if( PA_IS_OUTPUT_STREAM_(stream) && !stream->abortProcessing ) { if( stream->stopProcessing && @@ -3123,7 +3123,7 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) } } } - + if( stream->throttleProcessingThreadOnOverload != 0 ) { if( stream->stopProcessing || stream->abortProcessing ) @@ -3174,7 +3174,7 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg ) stream->streamRepresentation.streamFinishedCallback( stream->streamRepresentation.userData ); PaUtil_ResetCpuLoadMeasurer( &stream->cpuLoadMeasurer ); - + return result; } @@ -3190,13 +3190,13 @@ static PaError CloseStream( PaStream* s ) result = CloseHandleWithPaError( stream->abortEvent ); if( result != paNoError ) goto error; - + TerminateWaveHeaders( &stream->output, 0 /* not isInput */ ); TerminateWaveHeaders( &stream->input, 1 /* isInput */ ); TerminateWaveHandles( &stream->output, 0 /* not isInput */, 0 /* not currentlyProcessingAnError */ ); TerminateWaveHandles( &stream->input, 1 /* isInput */, 0 /* not currentlyProcessingAnError */ ); - + PaUtil_TerminateBufferProcessor( &stream->bufferProcessor ); PaUtil_TerminateStreamRepresentation( &stream->streamRepresentation ); PaUtil_FreeMemory( stream ); @@ -3217,9 +3217,9 @@ static PaError StartStream( PaStream *s ) unsigned int channel; unsigned long framesProcessed; PaStreamCallbackTimeInfo timeInfo = {0,0,0}; /** @todo implement this for stream priming */ - + PaUtil_ResetBufferProcessor( &stream->bufferProcessor ); - + if( PA_IS_INPUT_STREAM_(stream) ) { for( i=0; iinput.bufferCount; ++i ) @@ -3308,7 +3308,7 @@ static PaError StartStream( PaStream *s ) { ZeroMemory( stream->output.waveHeaders[j][i].lpData, stream->output.waveHeaders[j][i].dwBufferLength ); } - } + } /* we queue all channels of a single buffer frame (accross all devices, because some multidevice multichannel drivers work @@ -3339,8 +3339,8 @@ static PaError StartStream( PaStream *s ) result = ResetEventWithPaError( stream->output.bufferEvent ); if( result != paNoError ) goto error; - - + + if( stream->streamRepresentation.streamCallback ) { /* callback stream */ @@ -3422,8 +3422,8 @@ static PaError StopStream( PaStream *s ) DWORD waitResult; MMRESULT mmresult; signed int hostOutputBufferIndex; - unsigned int channel, waitCount, i; - + unsigned int channel, waitCount, i; + /** @todo REVIEW: the error checking in this function needs review. the basic idea is to return from this function in a known state - for example @@ -3476,7 +3476,7 @@ static PaError StopStream( PaStream *s ) PaUtil_SetOutputFrameCount( &stream->bufferProcessor, stream->output.framesPerBuffer - stream->output.framesUsedInCurrentBuffer ); - + channel = 0; for( i=0; ioutput.deviceCount; ++i ) { @@ -3501,7 +3501,7 @@ static PaError StopStream( PaStream *s ) */ AdvanceToNextOutputBuffer( stream ); } - + timeout = (stream->allBuffersDurationMs / stream->output.bufferCount) + 1; if( timeout < PA_MME_MIN_TIMEOUT_MSEC_ ) @@ -3567,7 +3567,7 @@ static PaError AbortStream( PaStream *s ) DWORD waitResult; MMRESULT mmresult; unsigned int i; - + /** @todo REVIEW: the error checking in this function needs review. the basic idea is to return from this function in a known state - for example @@ -3578,7 +3578,7 @@ static PaError AbortStream( PaStream *s ) if( stream->processingThread ) { /* callback stream */ - + /* Tell processing thread to abort immediately */ stream->abortProcessing = 1; SetEvent( stream->abortEvent ); @@ -3615,14 +3615,14 @@ static PaError AbortStream( PaStream *s ) if( stream->processingThread ) { /* callback stream */ - + PA_DEBUG(("WinMME AbortStream: waiting for background thread.\n")); /* Calculate timeOut longer than longest time it could take to return all buffers. */ timeout = (int)(stream->allBuffersDurationMs * 1.5); if( timeout < PA_MME_MIN_TIMEOUT_MSEC_ ) timeout = PA_MME_MIN_TIMEOUT_MSEC_; - + waitResult = WaitForSingleObject( stream->processingThread, timeout ); if( waitResult == WAIT_TIMEOUT ) { @@ -3660,7 +3660,7 @@ static PaError IsStreamActive( PaStream *s ) static PaTime GetStreamTime( PaStream *s ) { (void) s; /* unused parameter */ - + return PaUtil_GetTime(); } @@ -3692,7 +3692,7 @@ static PaError ReadStream( PaStream* s, DWORD waitResult; DWORD timeout = (unsigned long)(stream->allBuffersDurationMs * 0.5); unsigned int channel, i; - + if( PA_IS_INPUT_STREAM_(stream) ) { /* make a local copy of the user buffer pointer(s). this is necessary @@ -3711,7 +3711,7 @@ static PaError ReadStream( PaStream* s, for( i = 0; ibufferProcessor.inputChannelCount; ++i ) ((void**)userBuffer)[i] = ((void**)buffer)[i]; } - + do{ if( CurrentInputBuffersAreDone( stream ) ) { @@ -3728,7 +3728,7 @@ static PaError ReadStream( PaStream* s, PaUtil_SetInputFrameCount( &stream->bufferProcessor, stream->input.framesPerBuffer - stream->input.framesUsedInCurrentBuffer ); - + channel = 0; for( i=0; iinput.deviceCount; ++i ) { @@ -3743,7 +3743,7 @@ static PaError ReadStream( PaStream* s, channel += channelCount; } - + framesProcessed = PaUtil_CopyInput( &stream->bufferProcessor, &userBuffer, frames - framesRead ); stream->input.framesUsedInCurrentBuffer += framesProcessed; @@ -3754,7 +3754,7 @@ static PaError ReadStream( PaStream* s, break; } - framesRead += framesProcessed; + framesRead += framesProcessed; }else{ /* wait for MME to signal that a buffer is available */ @@ -3769,7 +3769,7 @@ static PaError ReadStream( PaStream* s, /* if a timeout is encountered, continue, perhaps we should give up eventually */ - } + } } }while( framesRead < frames ); } @@ -3796,7 +3796,7 @@ static PaError WriteStream( PaStream* s, DWORD timeout = (unsigned long)(stream->allBuffersDurationMs * 0.5); unsigned int channel, i; - + if( PA_IS_OUTPUT_STREAM_(stream) ) { /* make a local copy of the user buffer pointer(s). this is necessary @@ -3833,7 +3833,7 @@ static PaError WriteStream( PaStream* s, PaUtil_SetOutputFrameCount( &stream->bufferProcessor, stream->output.framesPerBuffer - stream->output.framesUsedInCurrentBuffer ); - + channel = 0; for( i=0; ioutput.deviceCount; ++i ) { @@ -3848,7 +3848,7 @@ static PaError WriteStream( PaStream* s, channel += channelCount; } - + framesProcessed = PaUtil_CopyOutput( &stream->bufferProcessor, &userBuffer, frames - framesWritten ); stream->output.framesUsedInCurrentBuffer += framesProcessed; @@ -3875,15 +3875,15 @@ static PaError WriteStream( PaStream* s, /* if a timeout is encountered, continue, perhaps we should give up eventually */ - } - } + } + } }while( framesWritten < frames ); } else { result = paCanNotWriteToAnInputOnlyStream; } - + return result; } @@ -3891,7 +3891,7 @@ static PaError WriteStream( PaStream* s, static signed long GetStreamReadAvailable( PaStream* s ) { PaWinMmeStream *stream = (PaWinMmeStream*)s; - + if( PA_IS_INPUT_STREAM_(stream) ) return GetAvailableFrames( &stream->input ); else @@ -3902,7 +3902,7 @@ static signed long GetStreamReadAvailable( PaStream* s ) static signed long GetStreamWriteAvailable( PaStream* s ) { PaWinMmeStream *stream = (PaWinMmeStream*)s; - + if( PA_IS_OUTPUT_STREAM_(stream) ) return GetAvailableFrames( &stream->output ); else @@ -3920,7 +3920,7 @@ static PaError GetWinMMEStreamPointer( PaWinMmeStream **stream, PaStream *s ) PaError result; PaUtilHostApiRepresentation *hostApi; PaWinMmeHostApiRepresentation *winMmeHostApi; - + result = PaUtil_ValidateStreamPointer( s ); if( result != paNoError ) return result; @@ -3930,10 +3930,10 @@ static PaError GetWinMMEStreamPointer( PaWinMmeStream **stream, PaStream *s ) return result; winMmeHostApi = (PaWinMmeHostApiRepresentation*)hostApi; - + /* note, the following would be easier if there was a generic way of testing that a stream belongs to a specific host API */ - + if( PA_STREAM_REP( s )->streamInterface == &winMmeHostApi->callbackStreamInterface || PA_STREAM_REP( s )->streamInterface == &winMmeHostApi->blockingStreamInterface ) { diff --git a/3rdparty/portaudio/src/os/unix/pa_unix_hostapis.c b/3rdparty/portaudio/src/os/unix/pa_unix_hostapis.c index 339e1b148d..c8303443de 100644 --- a/3rdparty/portaudio/src/os/unix/pa_unix_hostapis.c +++ b/3rdparty/portaudio/src/os/unix/pa_unix_hostapis.c @@ -26,13 +26,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -83,7 +83,7 @@ PaUtilHostApiInitializer *paHostApiInitializers[] = PaJack_Initialize, #endif /* Added for IRIX, Pieter, oct 2, 2003: */ -#ifdef PA_USE_SGI +#ifdef PA_USE_SGI PaSGI_Initialize, #endif diff --git a/3rdparty/portaudio/src/os/unix/pa_unix_util.c b/3rdparty/portaudio/src/os/unix/pa_unix_util.c index de54e51ddb..75c0d574e8 100644 --- a/3rdparty/portaudio/src/os/unix/pa_unix_util.c +++ b/3rdparty/portaudio/src/os/unix/pa_unix_util.c @@ -27,20 +27,20 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup unix_src */ - + #include #include #include @@ -129,7 +129,7 @@ void Pa_Sleep( long msec ) /* Discussion on the CoreAudio mailing list suggests that calling gettimeofday (or anything else in the BSD layer) is not real-time - safe, so we use mach_absolute_time on OSX. This implementation is + safe, so we use mach_absolute_time on OSX. This implementation is based on these two links: Technical Q&A QA1398 - Mach Absolute Time Units @@ -140,7 +140,7 @@ void Pa_Sleep( long msec ) */ /* Scaler to convert the result of mach_absolute_time to seconds */ -static double machSecondsConversionScaler_ = 0.0; +static double machSecondsConversionScaler_ = 0.0; #endif void PaUtil_InitializeClock( void ) @@ -214,7 +214,7 @@ PaError PaUtil_CancelThreading( PaUtilThreading *threading, int wait, PaError *e } /* Threading */ -/* paUnixMainThread +/* paUnixMainThread * We have to be a bit careful with defining this global variable, * as explained below. */ #ifdef __APPLE__ @@ -294,7 +294,7 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void PA_UNLESS( !pthread_attr_init( &attr ), paInternalError ); /* Priority relative to other processes */ - PA_UNLESS( !pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ), paInternalError ); + PA_UNLESS( !pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ), paInternalError ); PA_UNLESS( !pthread_create( &self->thread, &attr, threadFunc, threadArg ), paInternalError ); started = 1; @@ -344,7 +344,7 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void pthread_getschedparam(self->thread, &policy, &spm); } } - + if( self->parentWaiting ) { PaTime till; @@ -500,14 +500,14 @@ PaError PaUnixMutex_Terminate( PaUnixMutex* self ) /** Lock mutex. * - * We're disabling thread cancellation while the thread is holding a lock, so mutexes are + * We're disabling thread cancellation while the thread is holding a lock, so mutexes are * properly unlocked at termination time. */ PaError PaUnixMutex_Lock( PaUnixMutex* self ) { PaError result = paNoError; int oldState; - + PA_ENSURE_SYSTEM( pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &oldState ), 0 ); PA_ENSURE_SYSTEM( pthread_mutex_lock( &self->mtx ), 0 ); @@ -578,7 +578,7 @@ static void *WatchdogFunc( void *userData ) while( 1 ) { double lowpassCoeff = 0.9, lowpassCoeff1 = 0.99999 - lowpassCoeff; - + /* Test before and after in case whatever underlying sleep call isn't interrupted by pthread_cancel */ pthread_testcancel(); Pa_Sleep( intervalMsec ); @@ -663,7 +663,7 @@ error: /* Pass on error code */ pres = malloc( sizeof (PaError) ); *pres = result; - + pthread_exit( pres ); } diff --git a/3rdparty/portaudio/src/os/unix/pa_unix_util.h b/3rdparty/portaudio/src/os/unix/pa_unix_util.h index e900f87726..1dab518543 100644 --- a/3rdparty/portaudio/src/os/unix/pa_unix_util.h +++ b/3rdparty/portaudio/src/os/unix/pa_unix_util.h @@ -27,13 +27,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/os/win/pa_win_hostapis.c b/3rdparty/portaudio/src/os/win/pa_win_hostapis.c index df084cbfaf..f0fc7ae970 100644 --- a/3rdparty/portaudio/src/os/win/pa_win_hostapis.c +++ b/3rdparty/portaudio/src/os/win/pa_win_hostapis.c @@ -26,13 +26,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/portaudio/src/os/win/pa_win_util.c b/3rdparty/portaudio/src/os/win/pa_win_util.c index 45eb26867e..5513addadb 100644 --- a/3rdparty/portaudio/src/os/win/pa_win_util.c +++ b/3rdparty/portaudio/src/os/win/pa_win_util.c @@ -27,13 +27,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -45,7 +45,7 @@ @todo Implement workaround for QueryPerformanceCounter() skipping forward bug. (see msdn kb Q274323). */ - + #include #include /* for timeGetTime() */ @@ -142,10 +142,10 @@ double PaUtil_GetTime( void ) } else { -#ifndef UNDER_CE +#ifndef UNDER_CE return timeGetTime() * .001; #else return GetTickCount() * .001; -#endif +#endif } } diff --git a/3rdparty/portaudio/src/os/win/pa_win_waveformat.c b/3rdparty/portaudio/src/os/win/pa_win_waveformat.c index beae5825e4..654d1e1572 100644 --- a/3rdparty/portaudio/src/os/win/pa_win_waveformat.c +++ b/3rdparty/portaudio/src/os/win/pa_win_waveformat.c @@ -26,13 +26,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -47,7 +47,7 @@ #define WAVE_FORMAT_EXTENSIBLE 0xFFFE #endif -static GUID pawin_ksDataFormatSubtypeGuidBase = +static GUID pawin_ksDataFormatSubtypeGuidBase = { (USHORT)(WAVE_FORMAT_PCM), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }; @@ -55,18 +55,18 @@ int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat ) { if( sampleFormat == paFloat32 ) return PAWIN_WAVE_FORMAT_IEEE_FLOAT; - + return PAWIN_WAVE_FORMAT_PCM; } -void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat, +void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat, int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate ) { WAVEFORMATEX *waveFormatEx = (WAVEFORMATEX*)waveFormat; int bytesPerSample = Pa_GetSampleSize(sampleFormat); unsigned long bytesPerFrame = numChannels * bytesPerSample; - + waveFormatEx->wFormatTag = waveFormatTag; waveFormatEx->nChannels = (WORD)numChannels; waveFormatEx->nSamplesPerSec = (DWORD)sampleRate; @@ -77,7 +77,7 @@ void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat, } -void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat, +void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat, int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate, PaWinWaveFormatChannelMask channelMask ) { @@ -98,7 +98,7 @@ void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat, waveFormatEx->wBitsPerSample; *((DWORD*)&waveFormat->fields[PAWIN_INDEXOF_DWCHANNELMASK]) = channelMask; - + guid = pawin_ksDataFormatSubtypeGuidBase; guid.Data1 = (USHORT)waveFormatTag; *((GUID*)&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT]) = guid; @@ -111,7 +111,7 @@ PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels ) case 1: return PAWIN_SPEAKER_MONO; case 2: - return PAWIN_SPEAKER_STEREO; + return PAWIN_SPEAKER_STEREO; case 3: return PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_FRONT_RIGHT; case 4: @@ -122,22 +122,22 @@ PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels ) /* The meaning of the PAWIN_SPEAKER_5POINT1 flag has changed over time: http://msdn2.microsoft.com/en-us/library/aa474707.aspx We use PAWIN_SPEAKER_5POINT1 (not PAWIN_SPEAKER_5POINT1_SURROUND) - because on some cards (eg Audigy) PAWIN_SPEAKER_5POINT1_SURROUND - results in a virtual mixdown placing the rear output in the + because on some cards (eg Audigy) PAWIN_SPEAKER_5POINT1_SURROUND + results in a virtual mixdown placing the rear output in the front _and_ rear speakers. */ - return PAWIN_SPEAKER_5POINT1; + return PAWIN_SPEAKER_5POINT1; /* case 7: */ case 8: return PAWIN_SPEAKER_7POINT1; } - /* Apparently some Audigy drivers will output silence - if the direct-out constant (0) is used. So this is not ideal. + /* Apparently some Audigy drivers will output silence + if the direct-out constant (0) is used. So this is not ideal. */ return PAWIN_SPEAKER_DIRECTOUT; - /* Note that Alec Rogers proposed the following as an alternate method to + /* Note that Alec Rogers proposed the following as an alternate method to generate the default channel mask, however it doesn't seem to be an improvement over the above, since some drivers will matrix outputs mapping to non-present speakers accross multiple physical speakers. diff --git a/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.c b/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.c index 824ebdac40..f6717082d2 100644 --- a/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.c +++ b/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.c @@ -25,13 +25,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -182,7 +182,7 @@ static KSPIN_DATAFLOW GetKSFilterPinPropertyDataflow( HANDLE deviceHandle, int p } -static int KSFilterPinPropertyIdentifiersInclude( +static int KSFilterPinPropertyIdentifiersInclude( HANDLE deviceHandle, int pinId, unsigned long property, const GUID *identifierSet, unsigned long identifierId ) { KSMULTIPLE_ITEM* item = NULL; @@ -192,7 +192,7 @@ static int KSFilterPinPropertyIdentifiersInclude( if( WdmGetPinPropertyMulti( deviceHandle, pinId, property, &item) != paNoError ) return 0; - + identifier = (KSIDENTIFIER*)(item+1); for( i = 0; i < (int)item->Count; i++ ) @@ -211,7 +211,7 @@ static int KSFilterPinPropertyIdentifiersInclude( } -/* return the maximum channel count supported by any pin on the device. +/* return the maximum channel count supported by any pin on the device. if isInput is non-zero we query input pins, otherwise output pins. */ int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInput ) @@ -221,7 +221,7 @@ int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInp int pinCount, pinId; int result = 0; KSPIN_DATAFLOW requiredDataflowDirection = (isInput ? KSPIN_DATAFLOW_OUT : KSPIN_DATAFLOW_IN ); - + if( !wcharDevicePath ) return 0; @@ -236,12 +236,12 @@ int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInp KSPIN_DATAFLOW dataflow = GetKSFilterPinPropertyDataflow( deviceHandle, pinId ); if( ( dataflow == requiredDataflowDirection ) && (( communication == KSPIN_COMMUNICATION_SINK) || - ( communication == KSPIN_COMMUNICATION_BOTH)) - && ( KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, + ( communication == KSPIN_COMMUNICATION_BOTH)) + && ( KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, KSPROPERTY_PIN_INTERFACES, &pa_KSINTERFACESETID_Standard, KSINTERFACE_STANDARD_STREAMING ) - || KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, + || KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, KSPROPERTY_PIN_INTERFACES, &pa_KSINTERFACESETID_Standard, KSINTERFACE_STANDARD_LOOPED_STREAMING ) ) - && KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, + && KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, KSPROPERTY_PIN_MEDIUMS, &pa_KSMEDIUMSETID_Standard, KSMEDIUM_STANDARD_DEVIO ) ) { KSMULTIPLE_ITEM* item = NULL; @@ -258,10 +258,10 @@ int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInp && ( memcmp( (void*)&dataRange->SubFormat, (void*)&KSDATAFORMAT_SUBTYPE_WILDCARD, sizeof(GUID) ) == 0 ) ) ) { KSDATARANGE_AUDIO *dataRangeAudio = (KSDATARANGE_AUDIO*)dataRange; - + /* printf( ">>> %d %d %d %d %S\n", isInput, dataflow, communication, dataRangeAudio->MaximumChannels, devicePath ); - + if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_WAVEFORMATEX, sizeof(GUID) ) == 0 ) printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_WAVEFORMATEX\n" ); else if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_DSOUND, sizeof(GUID) ) == 0 ) @@ -279,7 +279,7 @@ int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInp if( dataRangeAudio->MaximumChannels < 0xFFFFUL && (int)dataRangeAudio->MaximumChannels > result ) result = (int)dataRangeAudio->MaximumChannels; } - + dataRange = (KSDATARANGE*)( ((char*)dataRange) + dataRange->FormatSize); } @@ -287,7 +287,7 @@ int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInp } } } - + CloseHandle( deviceHandle ); return result; } diff --git a/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.h b/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.h index b8e923a615..5458e71db9 100644 --- a/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.h +++ b/3rdparty/portaudio/src/os/win/pa_win_wdmks_utils.h @@ -28,13 +28,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -62,4 +62,4 @@ int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInp } #endif /* __cplusplus */ -#endif /* PA_WIN_WDMKS_UTILS_H */ \ No newline at end of file +#endif /* PA_WIN_WDMKS_UTILS_H */ diff --git a/3rdparty/portaudio/src/os/win/pa_x86_plain_converters.c b/3rdparty/portaudio/src/os/win/pa_x86_plain_converters.c index 4fcde40cb0..30443aac70 100644 --- a/3rdparty/portaudio/src/os/win/pa_x86_plain_converters.c +++ b/3rdparty/portaudio/src/os/win/pa_x86_plain_converters.c @@ -23,13 +23,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -186,9 +186,9 @@ static void Float32_To_Int32( mov ecx, count imul ecx, eax add ecx, esi - + mov edi, destinationBuffer - + mov ebx, destinationStride imul ebx, edx @@ -273,9 +273,9 @@ static void Float32_To_Int32_Clip( mov ecx, count imul ecx, eax add ecx, esi - + mov edi, destinationBuffer - + mov ebx, destinationStride imul ebx, edx @@ -301,7 +301,7 @@ static void Float32_To_Int32_Clip( fmul st(0), st(1) // st(0) *= st(1), stack: value*0x7FFFFFFF, (int)0x7FFFFFFF fistp dword ptr [edi] // pop st(0) into dest, stack: (int)0x7FFFFFFF jmp Float32_To_Int32_Clip_stored - + Float32_To_Int32_Clip_clamp: mov edx, dword ptr [esi] // load floating point value into integer register shr edx, 31 // move sign bit into bit 0 @@ -363,7 +363,7 @@ static void Float32_To_Int32_DitherClip( unsigned long ditherPrevious = ditherGenerator->previous; unsigned long ditherRandSeed1 = ditherGenerator->randSeed1; unsigned long ditherRandSeed2 = ditherGenerator->randSeed2; - + __asm{ // esi -> source ptr // eax -> source byte stride @@ -381,9 +381,9 @@ static void Float32_To_Int32_DitherClip( mov ecx, count imul ecx, eax add ecx, esi - + mov edi, destinationBuffer - + mov ebx, destinationStride imul ebx, edx @@ -447,11 +447,11 @@ static void Float32_To_Int32_DitherClip( fild highpassedDither fmul const_float_dither_scale_ // end generate dither, dither signal in st(0) - + faddp st(1), st(0) // stack: dither + value*(int scaler), int scaler fistp dword ptr [edi] // pop st(0) into dest, stack: int scaler jmp Float32_To_Int32_DitherClip_stored - + Float32_To_Int32_DitherClip_clamp: mov edx, dword ptr [esi] // load floating point value into integer register shr edx, 31 // move sign bit into bit 0 @@ -494,7 +494,7 @@ static void Float32_To_Int24( signed long temp; (void) ditherGenerator; // unused parameter - + while( count-- ) { // convert to 32 bit and drop the low 8 bits @@ -511,11 +511,11 @@ static void Float32_To_Int24( */ short savedFpuControlWord; - + signed long tempInt32; (void) ditherGenerator; /* unused parameter */ - + __asm{ // esi -> source ptr // eax -> source byte stride @@ -590,7 +590,7 @@ static void Float32_To_Int24_Clip( signed long temp; (void) ditherGenerator; // unused parameter - + while( count-- ) { // convert to 32 bit and drop the low 8 bits @@ -608,11 +608,11 @@ static void Float32_To_Int24_Clip( */ short savedFpuControlWord; - + signed long tempInt32; (void) ditherGenerator; /* unused parameter */ - + __asm{ // esi -> source ptr // eax -> source byte stride @@ -660,7 +660,7 @@ static void Float32_To_Int24_Clip( fistp tempInt32 // pop st(0) into tempInt32, stack: (int)0x7FFFFF mov edx, tempInt32 jmp Float32_To_Int24_Clip_store - + Float32_To_Int24_Clip_clamp: mov edx, dword ptr [esi] // load floating point value into integer register shr edx, 31 // move sign bit into bit 0 @@ -702,7 +702,7 @@ static void Float32_To_Int24_DitherClip( float *src = (float*)sourceBuffer; unsigned char *dest = (unsigned char*)destinationBuffer; signed long temp; - + while( count-- ) { // convert to 32 bit and drop the low 8 bits @@ -712,7 +712,7 @@ static void Float32_To_Int24_DitherClip( // use smaller scaler to prevent overflow when we add the dither double dithered = ((double)*src * (2147483646.0)) + dither; PA_CLIP_( dithered, -2147483648., 2147483647. ); - + temp = (signed long) dithered; dest[0] = (unsigned char)(temp >> 8); @@ -734,9 +734,9 @@ static void Float32_To_Int24_DitherClip( unsigned long ditherPrevious = ditherGenerator->previous; unsigned long ditherRandSeed1 = ditherGenerator->randSeed1; unsigned long ditherRandSeed2 = ditherGenerator->randSeed2; - + signed long tempInt32; - + __asm{ // esi -> source ptr // eax -> source byte stride @@ -792,7 +792,7 @@ static void Float32_To_Int24_DitherClip( mov ecx, sourceEnd // restore ecx mov eax, sourceByteStride // restore eax */ - + // generate dither mov sourceByteStride, eax // save eax mov edx, 196314165 @@ -826,7 +826,7 @@ static void Float32_To_Int24_DitherClip( fistp tempInt32 // pop st(0) into tempInt32, stack: int scaler mov edx, tempInt32 jmp Float32_To_Int24_DitherClip_store - + Float32_To_Int24_DitherClip_clamp: mov edx, dword ptr [esi] // load floating point value into integer register shr edx, 31 // move sign bit into bit 0 @@ -885,7 +885,7 @@ static void Float32_To_Int16( */ short savedFpuControlWord; - + (void) ditherGenerator; /* unused parameter */ __asm{ @@ -929,7 +929,7 @@ static void Float32_To_Int16( add edi, ebx // increment destination ptr //lea edi, [edi+ebx] - + cmp esi, ecx // has src ptr reached end? jne Float32_To_Int16_loop @@ -966,7 +966,7 @@ static void Float32_To_Int16_Clip( */ short savedFpuControlWord; - + (void) ditherGenerator; /* unused parameter */ __asm{ @@ -1015,7 +1015,7 @@ static void Float32_To_Int16_Clip( fmul st(0), st(1) // st(0) *= st(1), stack: value*0x7FFF, (int)0x7FFF fistp word ptr [edi] // store scaled int into dest, stack: (int)0x7FFF jmp Float32_To_Int16_Clip_stored - + Float32_To_Int16_Clip_clamp: mov edx, dword ptr [esi] // load floating point value into integer register shr edx, 31 // move sign bit into bit 0 @@ -1028,7 +1028,7 @@ static void Float32_To_Int16_Clip( add edi, ebx // increment destination ptr //lea edi, [edi+ebx] - + cmp esi, ecx // has src ptr reached end? jne Float32_To_Int16_Clip_loop @@ -1057,7 +1057,7 @@ static void Float32_To_Int16_DitherClip( { float dither = PaUtil_GenerateFloatTriangularDither( ditherGenerator ); - // use smaller scaler to prevent overflow when we add the dither + // use smaller scaler to prevent overflow when we add the dither float dithered = (*src * (32766.0f)) + dither; signed long samp = (signed long) dithered; PA_CLIP_( samp, -0x8000, 0x7FFF ); @@ -1163,11 +1163,11 @@ static void Float32_To_Int16_DitherClip( fild highpassedDither fmul const_float_dither_scale_ // end generate dither, dither signal in st(0) - + faddp st(1), st(0) // stack: dither * value*(int scaler), int scaler fistp word ptr [edi] // store scaled int into dest, stack: int scaler jmp Float32_To_Int16_DitherClip_stored - + Float32_To_Int16_DitherClip_clamp: mov edx, dword ptr [esi] // load floating point value into integer register shr edx, 31 // move sign bit into bit 0 @@ -1180,7 +1180,7 @@ static void Float32_To_Int16_DitherClip( add edi, ebx // increment destination ptr //lea edi, [edi+ebx] - + cmp esi, ecx // has src ptr reached end? jne Float32_To_Int16_DitherClip_loop @@ -1208,7 +1208,7 @@ void PaUtil_InitializeX86PlainConverters( void ) paConverters.Float32_To_Int24 = Float32_To_Int24; paConverters.Float32_To_Int24_Clip = Float32_To_Int24_Clip; paConverters.Float32_To_Int24_DitherClip = Float32_To_Int24_DitherClip; - + paConverters.Float32_To_Int16 = Float32_To_Int16; paConverters.Float32_To_Int16_Clip = Float32_To_Int16_Clip; paConverters.Float32_To_Int16_DitherClip = Float32_To_Int16_DitherClip; diff --git a/3rdparty/portaudio/src/os/win/pa_x86_plain_converters.h b/3rdparty/portaudio/src/os/win/pa_x86_plain_converters.h index 96b41b8570..bc0331082d 100644 --- a/3rdparty/portaudio/src/os/win/pa_x86_plain_converters.h +++ b/3rdparty/portaudio/src/os/win/pa_x86_plain_converters.h @@ -23,13 +23,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/3rdparty/tinyxml/tinystr.h b/3rdparty/tinyxml/tinystr.h index 3c2aa9d54d..d4fc3d765e 100644 --- a/3rdparty/tinyxml/tinystr.h +++ b/3rdparty/tinyxml/tinystr.h @@ -238,7 +238,7 @@ class TiXmlString // to the normal allocation, although use an 'int' for systems // that are overly picky about structure alignment. const size_type bytesNeeded = sizeof(Rep) + cap; - const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); + const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); rep_ = reinterpret_cast( new int[ intsNeeded ] ); rep_->str[ rep_->size = sz ] = '\0'; diff --git a/3rdparty/tinyxml/tinyxml.cpp b/3rdparty/tinyxml/tinyxml.cpp index 1bd61cd6c9..4ffe152e8d 100644 --- a/3rdparty/tinyxml/tinyxml.cpp +++ b/3rdparty/tinyxml/tinyxml.cpp @@ -42,7 +42,7 @@ void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString ) { unsigned char c = (unsigned char) str[i]; - if ( c == '&' + if ( c == '&' && i < ( (int)str.length() - 2 ) && str[i+1] == '#' && str[i+2] == 'x' ) @@ -95,12 +95,12 @@ void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString ) // Easy pass at non-alpha/numeric/symbol // Below 32 is symbolic. char buf[ 32 ]; - - #if defined(TIXML_SNPRINTF) + + #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); #else sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); - #endif + #endif //*ME: warning C4267: convert 'size_t' to 'int' //*ME: Int-Cast to make compiler happy ... @@ -139,14 +139,14 @@ TiXmlNode::~TiXmlNode() temp = node; node = node->next; delete temp; - } + } } void TiXmlNode::CopyTo( TiXmlNode* target ) const { target->SetValue (value.c_str() ); - target->userData = userData; + target->userData = userData; } @@ -160,7 +160,7 @@ void TiXmlNode::Clear() temp = node; node = node->next; delete temp; - } + } firstChild = 0; lastChild = 0; @@ -210,7 +210,7 @@ TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) -{ +{ if ( !beforeThis || beforeThis->parent != this ) { return 0; } @@ -304,7 +304,7 @@ TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& wit bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) { if ( removeThis->parent != this ) - { + { assert( 0 ); return false; } @@ -375,7 +375,7 @@ const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* } -const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const +const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const { const TiXmlNode* node; for ( node = next; node; node = node->next ) @@ -496,7 +496,7 @@ TiXmlElement::TiXmlElement (const char * _value) #ifdef TIXML_USE_STL -TiXmlElement::TiXmlElement( const std::string& _value ) +TiXmlElement::TiXmlElement( const std::string& _value ) : TiXmlNode( TiXmlNode::ELEMENT ) { firstChild = lastChild = 0; @@ -509,7 +509,7 @@ TiXmlElement::TiXmlElement( const TiXmlElement& copy) : TiXmlNode( TiXmlNode::ELEMENT ) { firstChild = lastChild = 0; - copy.CopyTo( this ); + copy.CopyTo( this ); } @@ -667,9 +667,9 @@ int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) void TiXmlElement::SetAttribute( const char * name, int val ) -{ +{ char buf[64]; - #if defined(TIXML_SNPRINTF) + #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF( buf, sizeof(buf), "%d", val ); #else sprintf( buf, "%d", val ); @@ -680,7 +680,7 @@ void TiXmlElement::SetAttribute( const char * name, int val ) #ifdef TIXML_USE_STL void TiXmlElement::SetAttribute( const std::string& name, int val ) -{ +{ std::ostringstream oss; oss << val; SetAttribute( name, oss.str() ); @@ -689,9 +689,9 @@ void TiXmlElement::SetAttribute( const std::string& name, int val ) void TiXmlElement::SetDoubleAttribute( const char * name, double val ) -{ +{ char buf[256]; - #if defined(TIXML_SNPRINTF) + #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF( buf, sizeof(buf), "%f", val ); #else sprintf( buf, "%f", val ); @@ -812,7 +812,7 @@ void TiXmlElement::CopyTo( TiXmlElement* target ) const // superclass: TiXmlNode::CopyTo( target ); - // Element class: + // Element class: // Clone the attributes, then clone the children. const TiXmlAttribute* attribute = 0; for( attribute = attributeSet.First(); @@ -831,7 +831,7 @@ void TiXmlElement::CopyTo( TiXmlElement* target ) const bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const { - if ( visitor->VisitEnter( *this, attributeSet.First() ) ) + if ( visitor->VisitEnter( *this, attributeSet.First() ) ) { for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) { @@ -941,7 +941,7 @@ bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) value = filename; // reading in binary mode so that tinyxml can normalize the EOL - FILE* file = fopen( value.c_str (), "rb" ); + FILE* file = fopen( value.c_str (), "rb" ); if ( file ) { @@ -958,7 +958,7 @@ bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) { - if ( !file ) + if ( !file ) { SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); return false; @@ -990,13 +990,13 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) // 2.11 End-of-Line Handling // // - // ...the XML processor MUST behave as if it normalized all line breaks in external - // parsed entities (including the document entity) on input, before parsing, by translating - // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to + // ...the XML processor MUST behave as if it normalized all line breaks in external + // parsed entities (including the document entity) on input, before parsing, by translating + // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to // a single #xA character. // // - // It is not clear fgets does that, and certainly isn't clear it works cross platform. + // It is not clear fgets does that, and certainly isn't clear it works cross platform. // Generally, you expect fgets to translate from the convention of the OS to the c/unix // convention, and not work generally. @@ -1058,7 +1058,7 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) // Handle any left over characters. if ( p-lastPos ) { data.append( lastPos, p-lastPos ); - } + } delete [] buf; buf = 0; @@ -1087,7 +1087,7 @@ bool TiXmlDocument::SaveFile( const char * filename ) const bool TiXmlDocument::SaveFile( FILE* fp ) const { - if ( useMicrosoftBOM ) + if ( useMicrosoftBOM ) { const unsigned char TIXML_UTF_LEAD_0 = 0xefU; const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; @@ -1113,7 +1113,7 @@ void TiXmlDocument::CopyTo( TiXmlDocument* target ) const for ( node = firstChild; node; node = node->NextSibling() ) { target->LinkEndChild( node->Clone() ); - } + } } @@ -1236,7 +1236,7 @@ int TiXmlAttribute::QueryDoubleValue( double* dval ) const void TiXmlAttribute::SetIntValue( int _value ) { char buf [64]; - #if defined(TIXML_SNPRINTF) + #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); #else sprintf (buf, "%d", _value); @@ -1247,7 +1247,7 @@ void TiXmlAttribute::SetIntValue( int _value ) void TiXmlAttribute::SetDoubleValue( double _value ) { char buf [256]; - #if defined(TIXML_SNPRINTF) + #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value); #else sprintf (buf, "%lf", _value); @@ -1349,7 +1349,7 @@ bool TiXmlText::Accept( TiXmlVisitor* visitor ) const TiXmlNode* TiXmlText::Clone() const -{ +{ TiXmlText* clone = 0; clone = new TiXmlText( "" ); @@ -1388,7 +1388,7 @@ TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) : TiXmlNode( TiXmlNode::DECLARATION ) { - copy.CopyTo( this ); + copy.CopyTo( this ); } @@ -1438,7 +1438,7 @@ bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const TiXmlNode* TiXmlDeclaration::Clone() const -{ +{ TiXmlDeclaration* clone = new TiXmlDeclaration(); if ( !clone ) @@ -1576,7 +1576,7 @@ TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) } */ -#ifdef TIXML_USE_STL +#ifdef TIXML_USE_STL std::istream& operator>> (std::istream & in, TiXmlNode & base) { TIXML_STRING tag; @@ -1589,7 +1589,7 @@ std::istream& operator>> (std::istream & in, TiXmlNode & base) #endif -#ifdef TIXML_USE_STL +#ifdef TIXML_USE_STL std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) { TiXmlPrinter printer; @@ -1759,12 +1759,12 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute attrib->Print( 0, 0, &buffer ); } - if ( !element.FirstChild() ) + if ( !element.FirstChild() ) { buffer += " />"; DoLineBreak(); } - else + else { buffer += ">"; if ( element.FirstChild()->ToText() @@ -1779,7 +1779,7 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute DoLineBreak(); } } - ++depth; + ++depth; return true; } @@ -1787,11 +1787,11 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) { --depth; - if ( !element.FirstChild() ) + if ( !element.FirstChild() ) { // nothing. } - else + else { if ( simpleTextPrint ) { diff --git a/3rdparty/tinyxml/tinyxml.h b/3rdparty/tinyxml/tinyxml.h index cdec7f3cf5..fac6ddbc4e 100644 --- a/3rdparty/tinyxml/tinyxml.h +++ b/3rdparty/tinyxml/tinyxml.h @@ -75,7 +75,7 @@ distribution. #define TIXML_SNPRINTF snprintf #define TIXML_SNSCANF snscanf #endif -#endif +#endif class TiXmlDocument; class TiXmlElement; @@ -90,7 +90,7 @@ const int TIXML_MAJOR_VERSION = 2; const int TIXML_MINOR_VERSION = 5; const int TIXML_PATCH_VERSION = 2; -/* Internal structure for tracking location of items +/* Internal structure for tracking location of items in the XML file. */ struct TiXmlCursor @@ -112,7 +112,7 @@ struct TiXmlCursor If you return 'true' from a Visit method, recursive parsing will continue. If you return false, no children of this node or its sibilings will be Visited. - All flavors of Visit methods have a default implementation that returns 'true' (continue + All flavors of Visit methods have a default implementation that returns 'true' (continue visiting). You need to only override methods that are interesting to you. Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. @@ -147,8 +147,8 @@ public: }; // Only used by Attribute::Query functions -enum -{ +enum +{ TIXML_SUCCESS, TIXML_NO_ATTRIBUTE, TIXML_WRONG_TYPE @@ -200,10 +200,10 @@ public: /** All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode.) Either or both cfile and str can be null. - - This is a formatted print, and will insert + + This is a formatted print, and will insert tabs and newlines. - + (For an unformatted stream, use the << operator.) */ virtual void Print( FILE* cfile, int depth ) const = 0; @@ -248,8 +248,8 @@ public: // in the UTF-8 sequence. static const int utf8ByteTable[256]; - virtual const char* Parse( const char* p, - TiXmlParsingData* data, + virtual const char* Parse( const char* p, + TiXmlParsingData* data, TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; enum @@ -278,9 +278,9 @@ public: protected: static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); - inline static bool IsWhiteSpace( char c ) - { - return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); + inline static bool IsWhiteSpace( char c ) + { + return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); } inline static bool IsWhiteSpace( int c ) { @@ -369,7 +369,7 @@ protected: /// Field containing a generic user pointer void* userData; - + // None of these methods are reliable for any language except English. // Good for approximation, not great for accuracy. static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); @@ -421,7 +421,7 @@ class TiXmlNode : public TiXmlBase friend class TiXmlElement; public: - #ifdef TIXML_USE_STL + #ifdef TIXML_USE_STL /** An input stream operator, for every class. Tolerant of newlines and formatting, but doesn't expect them. @@ -435,7 +435,7 @@ public: The operator<< and operator>> are not completely symmetric. Writing a node to a stream is very well defined. You'll get a nice stream of output, without any extra whitespace or newlines. - + But reading is not as well defined. (As it always is.) If you create a TiXmlElement (for example) and read that from an input stream, the text needs to define an element or junk will result. This is @@ -443,7 +443,7 @@ public: A TiXmlDocument will read nodes until it reads a root element, and all the children of that root element. - */ + */ friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); /// Appends the XML node or attribute to a std::string. @@ -523,7 +523,7 @@ public: } const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. TiXmlNode* LastChild() { return lastChild; } - + const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. TiXmlNode* LastChild( const char * _value ) { return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); @@ -702,11 +702,11 @@ public: virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. /** Create an exact duplicate of this node and return it. The memory must be deleted - by the caller. + by the caller. */ virtual TiXmlNode* Clone() const = 0; - /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the + /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the TiXmlVisitor interface. @@ -717,7 +717,7 @@ public: The interface has been based on ideas from: - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern Which are both good references for "visiting". @@ -814,7 +814,7 @@ public: /** QueryIntValue examines the value string. It is an alternative to the IntValue() method with richer error checking. - If the value is an integer, it is stored in 'value' and + If the value is an integer, it is stored in 'value' and the call returns TIXML_SUCCESS. If it is not an integer, it returns TIXML_WRONG_TYPE. @@ -833,21 +833,21 @@ public: #ifdef TIXML_USE_STL /// STL std::string form. - void SetName( const std::string& _name ) { name = _name; } - /// STL std::string form. + void SetName( const std::string& _name ) { name = _name; } + /// STL std::string form. void SetValue( const std::string& _value ) { value = _value; } #endif /// Get the next sibling attribute in the DOM. Returns null at end. const TiXmlAttribute* Next() const; TiXmlAttribute* Next() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); } /// Get the previous sibling attribute in the DOM. Returns null at beginning. const TiXmlAttribute* Previous() const; TiXmlAttribute* Previous() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); } bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } @@ -883,7 +883,7 @@ private: /* A class used to manage a group of attributes. It is only used internally, both by the ELEMENT and the DECLARATION. - + The set can be changed transparent to the Element and Declaration classes that use it, but NOT transparent to the Attribute which has to implement a next() and previous() method. Which makes @@ -973,11 +973,11 @@ public: /** QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer error checking. - If the attribute is an integer, it is stored in 'value' and + If the attribute is an integer, it is stored in 'value' and the call returns TIXML_SUCCESS. If it is not an integer, it returns TIXML_WRONG_TYPE. If the attribute does not exist, then TIXML_NO_ATTRIBUTE is returned. - */ + */ int QueryIntAttribute( const char* name, int* _value ) const; /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). int QueryDoubleAttribute( const char* name, double* _value ) const; @@ -1054,7 +1054,7 @@ public: /** Convenience function for easy access to the text inside an element. Although easy and concise, GetText() is limited compared to getting the TiXmlText child and accessing it directly. - + If the first child of 'this' is a TiXmlText, the GetText() returns the character string of the Text node, else null is returned. @@ -1064,23 +1064,23 @@ public: const char* str = fooElement->GetText(); @endverbatim - 'str' will be a pointer to "This is text". - + 'str' will be a pointer to "This is text". + Note that this function can be misleading. If the element foo was created from this XML: @verbatim - This is text + This is text @endverbatim then the value of str would be null. The first child node isn't a text node, it is another element. From this XML: @verbatim - This is text + This is text @endverbatim GetText() will return "This is ". - WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are + WARNING: GetText() accesses a child node - don't become confused with the + similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are safe type casts on the referenced node. */ const char* GetText() const; @@ -1098,7 +1098,7 @@ public: virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. + /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* visitor ) const; @@ -1152,7 +1152,7 @@ public: virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. + /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* visitor ) const; @@ -1170,16 +1170,16 @@ private: }; -/** XML text. A text node can have 2 ways to output the next. "normal" output +/** XML text. A text node can have 2 ways to output the next. "normal" output and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with + you generally want to leave it alone, but you can change the output mode with SetCDATA() and query it with CDATA(). */ class TiXmlText : public TiXmlNode { friend class TiXmlElement; public: - /** Constructor for text element. By default, it is treated as + /** Constructor for text element. By default, it is treated as normal, encoded text. If you want it be output as a CDATA text element, set the parameter _cdata to 'true' */ @@ -1215,7 +1215,7 @@ public: virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. + /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* content ) const; @@ -1291,7 +1291,7 @@ public: virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. + /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* visitor ) const; @@ -1336,7 +1336,7 @@ public: virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. + /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* content ) const; @@ -1426,7 +1426,7 @@ public: - The ErrorId() will contain the integer identifier of the error (not generally useful) - The ErrorDesc() method will return the name of the error. (very useful) - The ErrorRow() and ErrorCol() will return the location of the error (if known) - */ + */ bool Error() const { return error; } /// Contains a textual (english) description of the error if one occurs. @@ -1437,7 +1437,7 @@ public: */ int ErrorId() const { return errorId; } - /** Returns the location (if known) of the error. The first column is column 1, + /** Returns the location (if known) of the error. The first column is column 1, and the first row is row 1. A value of 0 means the row and column wasn't applicable (memory errors, for example, have no row/column) or the parser lost the error. (An error in the error reporting, in that case.) @@ -1450,7 +1450,7 @@ public: /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) to report the correct values for row and column. It does not change the output or input in any way. - + By calling this method, with a tab size greater than 0, the row and column of each node and attribute is stored when the file is loaded. Very useful for tracking the DOM back in to @@ -1478,11 +1478,11 @@ public: /** If you have handled the error, it can be reset with this call. The error state is automatically cleared if you Parse a new XML block. */ - void ClearError() { error = false; - errorId = 0; - errorDesc = ""; - errorLocation.row = errorLocation.col = 0; - //errorLocation.last = 0; + void ClearError() { error = false; + errorId = 0; + errorDesc = ""; + errorLocation.row = errorLocation.col = 0; + //errorLocation.last = 0; } /** Write the document to standard out using formatted printing ("pretty print"). */ @@ -1492,7 +1492,7 @@ public: will allocate a character array (new char[]) and return it as a pointer. The calling code pust call delete[] on the return char* to avoid a memory leak. */ - //char* PrintToMemory() const; + //char* PrintToMemory() const; /// Print this Document to a FILE stream. virtual void Print( FILE* cfile, int depth = 0 ) const; @@ -1502,7 +1502,7 @@ public: virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. + /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* content ) const; @@ -1540,7 +1540,7 @@ private: @endverbatim - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very easy to write a *lot* of code that looks like: @verbatim @@ -1560,7 +1560,7 @@ private: @endverbatim And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe + of such code. A TiXmlHandle checks for null pointers so it is perfectly safe and correct to use: @verbatim @@ -1581,7 +1581,7 @@ private: What they should not be used for is iteration: @verbatim - int i=0; + int i=0; while ( true ) { TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); @@ -1592,8 +1592,8 @@ private: } @endverbatim - It seems reasonable, but it is in fact two embedded while loops. The Child method is - a linear walk to find the element, so this code would iterate much more than it needs + It seems reasonable, but it is in fact two embedded while loops. The Child method is + a linear walk to find the element, so this code would iterate much more than it needs to. Instead, prefer: @verbatim @@ -1623,20 +1623,20 @@ public: /// Return a handle to the first child element with the given name. TiXmlHandle FirstChildElement( const char * value ) const; - /** Return a handle to the "index" child with the given name. + /** Return a handle to the "index" child with the given name. The first child is 0, the second 1, etc. */ TiXmlHandle Child( const char* value, int index ) const; - /** Return a handle to the "index" child. + /** Return a handle to the "index" child. The first child is 0, the second 1, etc. */ TiXmlHandle Child( int index ) const; - /** Return a handle to the "index" child element with the given name. + /** Return a handle to the "index" child element with the given name. The first child element is 0, the second 1, etc. Note that only TiXmlElements are indexed: other types are not counted. */ TiXmlHandle ChildElement( const char* value, int index ) const; - /** Return a handle to the "index" child element. + /** Return a handle to the "index" child element. The first child element is 0, the second 1, etc. Note that only TiXmlElements are indexed: other types are not counted. */ @@ -1652,7 +1652,7 @@ public: /** Return the handle as a TiXmlNode. This may return null. */ - TiXmlNode* ToNode() const { return node; } + TiXmlNode* ToNode() const { return node; } /** Return the handle as a TiXmlElement. This may return null. */ TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } @@ -1663,11 +1663,11 @@ public: */ TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } - /** @deprecated use ToNode. + /** @deprecated use ToNode. Return the handle as a TiXmlNode. This may return null. */ - TiXmlNode* Node() const { return ToNode(); } - /** @deprecated use ToElement. + TiXmlNode* Node() const { return ToNode(); } + /** @deprecated use ToElement. Return the handle as a TiXmlElement. This may return null. */ TiXmlElement* Element() const { return ToElement(); } @@ -1727,7 +1727,7 @@ public: void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } /// Query the indention string. const char* Indent() { return indent.c_str(); } - /** Set the line breaking string. By default set to newline (\n). + /** Set the line breaking string. By default set to newline (\n). Some operating systems prefer other characters, or can be set to the null/empty string for no indenation. */ @@ -1735,12 +1735,12 @@ public: /// Query the current line breaking string. const char* LineBreak() { return lineBreak.c_str(); } - /** Switch over to "stream printing" which is the most dense formatting without + /** Switch over to "stream printing" which is the most dense formatting without linebreaks. Common when the XML is needed for network transmission. */ void SetStreamPrinting() { indent = ""; lineBreak = ""; - } + } /// Return the result. const char* CStr() { return buffer.c_str(); } /// Return the length of the result string. diff --git a/3rdparty/tinyxml/tinyxmlerror.cpp b/3rdparty/tinyxml/tinyxmlerror.cpp index d24f63b2e5..ce82a863ae 100644 --- a/3rdparty/tinyxml/tinyxmlerror.cpp +++ b/3rdparty/tinyxml/tinyxmlerror.cpp @@ -2,12 +2,12 @@ www.sourceforge.net/projects/tinyxml Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any +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 +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 diff --git a/3rdparty/tinyxml/tinyxmlparser.cpp b/3rdparty/tinyxml/tinyxmlparser.cpp index c73609e100..040d9b1353 100644 --- a/3rdparty/tinyxml/tinyxmlparser.cpp +++ b/3rdparty/tinyxml/tinyxmlparser.cpp @@ -2,23 +2,23 @@ www.sourceforge.net/projects/tinyxml Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com) -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any +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 +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 +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 +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 +3. This notice may not be removed or altered from any source distribution. */ @@ -39,8 +39,8 @@ distribution. // Note tha "PutString" hardcodes the same list. This // is less flexible than it appears. Changing the entries -// or order will break putstring. -TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] = +// or order will break putstring. +TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] = { { "&", 5, '&' }, { "<", 4, '<' }, @@ -54,16 +54,16 @@ TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] = // Including the basic of this table, which determines the #bytes in the // sequence from the lead byte. 1 placed for invalid sequences -- // although the result will be junk, pass it through as much as possible. -// Beware of the non-characters in UTF-8: +// Beware of the non-characters in UTF-8: // ef bb bf (Microsoft "lead bytes") // ef bf be -// ef bf bf +// ef bf bf const unsigned char TIXML_UTF_LEAD_0 = 0xefU; const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; -const int TiXmlBase::utf8ByteTable[256] = +const int TiXmlBase::utf8ByteTable[256] = { // 0 1 2 3 4 5 6 7 8 9 a b c d e f 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 @@ -75,9 +75,9 @@ const int TiXmlBase::utf8ByteTable[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte @@ -91,7 +91,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng const unsigned long BYTE_MARK = 0x80; const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - if (input < 0x80) + if (input < 0x80) *length = 1; else if ( input < 0x800 ) *length = 2; @@ -105,22 +105,22 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng output += *length; // Scary scary fall throughs. - switch (*length) + switch (*length) { case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; case 1: - --output; + --output; *output = (char)(input | FIRST_BYTE_MARK[*length]); } } @@ -130,7 +130,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng { // This will only work for low-ascii, everything else is assumed to be a valid // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very + // to figure out alhabetical vs. not across encoding. So take a very // conservative approach. // if ( encoding == TIXML_ENCODING_UTF8 ) @@ -151,7 +151,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng { // This will only work for low-ascii, everything else is assumed to be a valid // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very + // to figure out alhabetical vs. not across encoding. So take a very // conservative approach. // if ( encoding == TIXML_ENCODING_UTF8 ) @@ -224,7 +224,7 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) case '\r': // bump down to the next line ++row; - col = 0; + col = 0; // Eat the character ++p; @@ -266,11 +266,11 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) // In these cases, don't advance the column. These are // 0-width spaces. if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) - p += 3; + p += 3; else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) - p += 3; + p += 3; else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - p += 3; + p += 3; else { p +=3; ++col; } // A normal character. } @@ -322,10 +322,10 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) while ( *p ) { const unsigned char* pU = (const unsigned char*)p; - + // Skip the stupid Microsoft UTF-8 Byte order marks if ( *(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==TIXML_UTF_LEAD_1 + && *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) { p += 3; @@ -413,12 +413,12 @@ const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncodi // After that, they can be letters, underscores, numbers, // hyphens, or colons. (Colons are valid ony for namespaces, // but tinyxml can't tell namespaces from names.) - if ( p && *p + if ( p && *p && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) { const char* start = p; while( p && *p - && ( IsAlphaNum( (unsigned char ) *p, encoding ) + && ( IsAlphaNum( (unsigned char ) *p, encoding ) || *p == '_' || *p == '-' || *p == '.' @@ -469,7 +469,7 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml ucs += mult * (*q - 'a' + 10); else if ( *q >= 'A' && *q <= 'F' ) ucs += mult * (*q - 'A' + 10 ); - else + else return 0; mult *= 16; --q; @@ -492,7 +492,7 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml { if ( *q >= '0' && *q <= '9' ) ucs += mult * (*q - '0'); - else + else return 0; mult *= 10; --q; @@ -571,10 +571,10 @@ bool TiXmlBase::StringEqual( const char* p, return false; } -const char* TiXmlBase::ReadText( const char* p, - TIXML_STRING * text, - bool trimWhiteSpace, - const char* endTag, +const char* TiXmlBase::ReadText( const char* p, + TIXML_STRING * text, + bool trimWhiteSpace, + const char* endTag, bool caseInsensitive, TiXmlEncoding encoding ) { @@ -631,7 +631,7 @@ const char* TiXmlBase::ReadText( const char* p, } } } - if ( p ) + if ( p ) p += strlen( endTag ); return p; } @@ -647,7 +647,7 @@ void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) // This "pre-streaming" will never read the closing ">" so the // sub-tag can orient itself. - if ( !StreamTo( in, '<', tag ) ) + if ( !StreamTo( in, '<', tag ) ) { SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); return; @@ -669,7 +669,7 @@ void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) if ( in->good() ) { - // We now have something we presume to be a node of + // We now have something we presume to be a node of // some sort. Identify it, and call the node to // continue streaming. TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); @@ -778,7 +778,7 @@ const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiX encoding = TIXML_ENCODING_UTF8; else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice - else + else encoding = TIXML_ENCODING_LEGACY; } @@ -796,7 +796,7 @@ const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiX } void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ +{ // The first error in a chain is more accurate - don't set again! if ( error ) return; @@ -833,7 +833,7 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) return 0; } - // What is this thing? + // What is this thing? // - Elements start with a letter or underscore, but xml is reserved. // - Comments: wow, byte is ok } } - free(pB); + free(pB); } ///////////////////////////////////////////////////////// @@ -291,7 +291,7 @@ int OpenGenCD(int iA,int iT,int iL) if(iInterfaceMode==3) // special ioctl RAW mode? { // -> get special reading funcs (non-scsi!) - if(iUseSubReading==1) + if(iUseSubReading==1) pReadFunc = ReadIOCTL_Raw_Sub; else pReadFunc = ReadIOCTL_Raw; @@ -307,7 +307,7 @@ int OpenGenCD(int iA,int iT,int iL) if(CheckSCSIReadMode()==SS_COMP) WaitUntilDriveIsReady(); - else + else { CloseIOCTLHandle(); return -3; @@ -322,7 +322,7 @@ void CloseGenCD(void) { iCDROK=0; // no more cd available if(pDeInitFunc) pDeInitFunc(); // deinit, if needed - pDeInitFunc = NULL; + pDeInitFunc = NULL; pReadFunc = ReadSCSI_Dummy; CloseIOCTLHandle(); // close ioctl drive file (if used) } diff --git a/plugins/CDVDpeops/libiso.c b/plugins/CDVDpeops/libiso.c index 899a8c98c6..205eec2c9b 100644 --- a/plugins/CDVDpeops/libiso.c +++ b/plugins/CDVDpeops/libiso.c @@ -270,7 +270,7 @@ int _isoReadZ2table(isoFile *iso) { ofs+= Ztable[i]; } free(Ztable); - + return 0; } @@ -398,7 +398,7 @@ isoFile *isoOpen(const char *filename) { if (iso->flags & (ISOFLAGS_Z | ISOFLAGS_Z2 | ISOFLAGS_BLOCKDUMP)) { } else { _seekfile(iso->handle, 0, SEEK_END); - iso->blocks = (u32)((_tellfile(iso->handle) - iso->offset) / + iso->blocks = (u32)((_tellfile(iso->handle) - iso->offset) / (iso->blocksize)); } /* @@ -482,13 +482,13 @@ int isoSetFormat(isoFile *iso, int blockofs, int blocksize, int blocks) { printf("blocksize = %d\n", iso->blocksize); printf("blocks = %d\n", iso->blocks); if (iso->flags & ISOFLAGS_Z2) { - if (_writefile(iso->handle, "Z V2", 4) < 4) return -1; + if (_writefile(iso->handle, "Z V2", 4) < 4) return -1; if (_writefile(iso->handle, &blocksize, 4) < 4) return -1; if (_writefile(iso->handle, &blocks, 4) < 4) return -1; if (_writefile(iso->handle, &blockofs, 4) < 4) return -1; } if (iso->flags & ISOFLAGS_BLOCKDUMP) { - if (_writefile(iso->handle, "BDV2", 4) < 4) return -1; + if (_writefile(iso->handle, "BDV2", 4) < 4) return -1; if (_writefile(iso->handle, &blocksize, 4) < 4) return -1; if (_writefile(iso->handle, &blocks, 4) < 4) return -1; if (_writefile(iso->handle, &blockofs, 4) < 4) return -1; diff --git a/plugins/CDVDpeops/ppf.c b/plugins/CDVDpeops/ppf.c index 3a2637e5c3..c9e92da9c0 100644 --- a/plugins/CDVDpeops/ppf.c +++ b/plugins/CDVDpeops/ppf.c @@ -48,7 +48,7 @@ void FillPPFCache(void) { PPF_DATA * p;PPF_CACHE * pc; long lastaddr; - + p=ppfHead; lastaddr=-1; iPPFNum=0; @@ -63,14 +63,14 @@ void FillPPFCache(void) if(!iPPFNum) return; pc=ppfCache=(PPF_CACHE *)malloc(iPPFNum*sizeof(PPF_CACHE)); - + iPPFNum--; p=ppfHead; lastaddr=-1; while(p) { - if(p->addr!=lastaddr) + if(p->addr!=lastaddr) { pc->addr=p->addr; pc->pNext=(void *)p; @@ -145,7 +145,7 @@ void CheckPPFCache(long addr,unsigned char * pB) void AddToPPF(long ladr,long pos,long anz,char * ppfmem) { - if(!ppfHead) + if(!ppfHead) { ppfHead=(PPF_DATA *)malloc(sizeof(PPF_DATA)+anz); ppfHead->addr=ladr; @@ -252,7 +252,7 @@ void BuildPPFCache(void) dizyn=1; dizlensave=dizlen; } - + fseek(ppffile, 56, SEEK_SET); fread(&dizlen, 4, 1,ppffile); fseek(ppffile, 0, SEEK_END); @@ -296,13 +296,13 @@ void BuildPPFCache(void) { seekpos=1084; count-=1084; - } - else + } + else { seekpos=60; count-=60; } - + break; default: @@ -312,15 +312,15 @@ void BuildPPFCache(void) } do // now do the data reading - { - fseek(ppffile, seekpos, SEEK_SET); - fread(&pos, 4, 1, ppffile); + { + fseek(ppffile, seekpos, SEEK_SET); + fread(&pos, 4, 1, ppffile); if(method==2) fread(buffer, 4, 1, ppffile); // skip 4 bytes on ppf3 (no int64 support here) anz=0; // new! init anz (since it's no unsigned char anymore) - fread(&anz, 1, 1, ppffile); - fread(ppfmem, anz, 1, ppffile); + fread(&anz, 1, 1, ppffile); + fread(ppfmem, anz, 1, ppffile); ladr=pos/2352; off=pos%2352; @@ -340,8 +340,8 @@ void BuildPPFCache(void) anz+=4; } - seekpos=seekpos+5+anz; - count=count-5-anz; + seekpos=seekpos+5+anz; + count=count-5-anz; } while(count!=0); // loop til end diff --git a/plugins/CDVDpeops/read.c b/plugins/CDVDpeops/read.c index 1f8e374e3d..e295731e1d 100644 --- a/plugins/CDVDpeops/read.c +++ b/plugins/CDVDpeops/read.c @@ -66,19 +66,19 @@ int iQLockPos=-1; ///////////////////////////////////////////////////////// // thread helper vars -HANDLE hReadThread = NULL; +HANDLE hReadThread = NULL; BOOL bThreadEnded = FALSE; HANDLE hThreadEvent[3]; HANDLE hThreadMutex[2]; ///////////////////////////////////////////////////////// -// internal MAXDATACACHE*64KB (4MB) data cache +// internal MAXDATACACHE*64KB (4MB) data cache #define MAXDATACACHE 64 unsigned long lDataCacheAddr[MAXDATACACHE]; unsigned char * pDataCacheBuf[MAXDATACACHE]; BOOL bDataCacheHit=FALSE; -int iUseDataCache=0; +int iUseDataCache=0; ///////////////////////////////////////////////////////// // main init func @@ -86,15 +86,15 @@ int iUseDataCache=0; void CreateREADBufs(void) { switch(iUseCaching) - { + { case 4: iUseDataCache = 2; // use a special data cache on threadex reading - pReadTrackFunc = DoReadThreadEx; + pReadTrackFunc = DoReadThreadEx; pGetPtrFunc = GetREADThreadExPtr; break; case 3: pReadTrackFunc = DoReadThread; pGetPtrFunc = GetREADThreadPtr; break; - case 2: pReadTrackFunc = DoReadAsync; + case 2: pReadTrackFunc = DoReadAsync; pGetPtrFunc = NULL; break; - default: pReadTrackFunc = DoRead; + default: pReadTrackFunc = DoRead; pGetPtrFunc = NULL; break; } @@ -187,7 +187,7 @@ BOOL bReadRetry(FRAMEBUF * f) { int iRetry=0; - while (iRetrydwFrameCnt = 1; + f->dwFrameCnt = 1; f->dwBufLen = iUsedBlockSize; - f->dwFrame = addr; + f->dwFrame = addr; pCurrReadBuf=pFirstReadBuf; @@ -253,7 +253,7 @@ BOOL DoRead(unsigned long addr) { if((addr+MAXCACHEBLOCK)dwFrameCnt = MAXCACHEBLOCK+1; // -> set bigger read + f->dwFrameCnt = MAXCACHEBLOCK+1; // -> set bigger read f->dwBufLen = (MAXCACHEBLOCK+1)*iUsedBlockSize; lLastAddr = addr; // -> store addr of block } @@ -284,7 +284,7 @@ BOOL DoRead(unsigned long addr) // async mode (caching 2) // this mode works fine with ASPI... // the first read will be done sync, though, only the -// additional pre-fetching will be done async... +// additional pre-fetching will be done async... // well, with mdecs most reads will be prefetched, so // speed is good... with IOCTL this mode is more like // a 'double sync' reading, since IOCTL seems always @@ -299,7 +299,7 @@ BOOL DoReadAsync(unsigned long addr) // 1. check if data is in already filled buffer if(lLastAddr!=0xFFFFFFFF && - addr>=lLastAddr && + addr>=lLastAddr && addr<=(lLastAddr+MAXCACHEBLOCK)) { pCurrReadBuf=pAsyncFirstReadBuf[iBufSel]+ @@ -328,9 +328,9 @@ BOOL DoReadAsync(unsigned long addr) //////////////////////////////////////////////////////// // 3. check in asyncbuffer. if yes, swap buffers and do next async read - + if(lLastAsyncAddr!=0xFFFFFFFF && - addr>=lLastAsyncAddr && + addr>=lLastAsyncAddr && addr<=(lLastAsyncAddr+MAXCACHEBLOCK)) { int iAsyncSel=iBufSel; // store old buf num @@ -351,9 +351,9 @@ BOOL DoReadAsync(unsigned long addr) {lLastAsyncAddr=0xFFFFFFFF;return TRUE;} f=(FRAMEBUF *)ptrBuffer[iAsyncSel]; // setup prefetch addr - f->dwFrameCnt = MAXCACHEBLOCK+1; + f->dwFrameCnt = MAXCACHEBLOCK+1; f->dwBufLen = (MAXCACHEBLOCK+1)*iUsedBlockSize; - f->dwFrame = addr; + f->dwFrame = addr; lLastAsyncAddr=addr; // store prefetch addr @@ -369,7 +369,7 @@ BOOL DoReadAsync(unsigned long addr) iBufSel=0; // read in buf 0 f=(FRAMEBUF *)ptrBuffer[0]; - f->dwFrame = addr; + f->dwFrame = addr; pCurrReadBuf=pFirstReadBuf; @@ -378,13 +378,13 @@ BOOL DoReadAsync(unsigned long addr) if((addr+MAXCACHEBLOCK)dwFrameCnt = MAXCACHEBLOCK+1; + f->dwFrameCnt = MAXCACHEBLOCK+1; f->dwBufLen = (MAXCACHEBLOCK+1)*iUsedBlockSize; lLastAddr = addr; } else { - f->dwFrameCnt = 1; + f->dwFrameCnt = 1; f->dwBufLen = iUsedBlockSize; lLastAddr = 0xFFFFFFFF; } @@ -392,7 +392,7 @@ BOOL DoReadAsync(unsigned long addr) //////////////////////////////////////////////////////// // start read, wait til finished - if(pReadFunc(TRUE,f)!=SS_COMP) + if(pReadFunc(TRUE,f)!=SS_COMP) { if(!bReadRetry(f)) return FALSE; } @@ -413,9 +413,9 @@ BOOL DoReadAsync(unsigned long addr) {lLastAsyncAddr=0xFFFFFFFF;return TRUE;} f=(FRAMEBUF *)ptrBuffer[1]; // setup prefetch into buf 1 - f->dwFrameCnt = MAXCACHEBLOCK+1; + f->dwFrameCnt = MAXCACHEBLOCK+1; f->dwBufLen = (MAXCACHEBLOCK+1)*iUsedBlockSize; - f->dwFrame = addr; + f->dwFrame = addr; lLastAsyncAddr= addr; @@ -429,12 +429,12 @@ BOOL DoReadAsync(unsigned long addr) ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// // thread mode (caching 3) -// this mode helps with slower drives using the IOCTL +// this mode helps with slower drives using the IOCTL // interface (since that one seems to do always blocking // reads, even when they are done overlapped). // With ASPI, the thread mode performance will be more or less // the same as with async caching mode 2... -// thread reading would be much more powerful, if the main +// thread reading would be much more powerful, if the main // emu would do: // ... // CDRreadTrack() @@ -467,7 +467,7 @@ DWORD WINAPI READThread(LPVOID lpParameter) lLastAsyncAddr = lNeededAddr; // setup read and vars f=(FRAMEBUF *)ptrBuffer[!iBufSel]; // !iSel = async buffer - f->dwFrame = lNeededAddr; + f->dwFrame = lNeededAddr; f->dwFrameCnt = min((lMaxAddr-lNeededAddr+1),(MAXCACHEBLOCK+1)); f->dwBufLen = f->dwFrameCnt*iUsedBlockSize; @@ -497,7 +497,7 @@ BOOL DoReadThread(unsigned long addr) bDataCacheHit=FALSE; // init data cache hit flag (even if no cache is used...) if(lLastAddr!=0xFFFFFFFF && // data is in curr data buffer? - addr>=lLastAddr && + addr>=lLastAddr && addr<=(lLastAddr+MAXCACHEBLOCK)) return TRUE; // -> fine @@ -507,7 +507,7 @@ BOOL DoReadThread(unsigned long addr) WaitForSingleObject(hThreadMutex[1],INFINITE); // wait to access 'buffer 1 vars' if(lLastAsyncAddr!=0xFFFFFFFF && // data is (or will be soon if reading is going on in thread now) in async buffer? - addr>=lLastAsyncAddr && + addr>=lLastAsyncAddr && addr<=(lLastAsyncAddr+MAXCACHEBLOCK)) { ReleaseMutex(hThreadMutex[1]); // -> fine @@ -522,7 +522,7 @@ BOOL DoReadThread(unsigned long addr) } ///////////////////////////////////////////////////////// -// emu says: gimme ptr to needed data... this will +// emu says: gimme ptr to needed data... this will // automatically do an async data prefetch read as well // ... called on CDRgetBuffer() @@ -533,7 +533,7 @@ void GetREADThreadPtr(void) if(bDataCacheHit) return; // if we had a data cache hit, the readbuf ptr is already fine, nothing else to do if(lLastAddr!=0xFFFFFFFF && // data is in buffer 0? - addr>=lLastAddr && + addr>=lLastAddr && addr<=(lLastAddr+MAXCACHEBLOCK)) { pCurrReadBuf=pAsyncFirstReadBuf[iBufSel]+ // -> ok, return curr data buffer ptr @@ -557,8 +557,8 @@ void GetREADThreadPtr(void) if(iUseDataCache) // data cache used? can be less then 64 kb with thread reading, but that doesn't matter here... will be either 64 k or (max-addr) sectors AddToDataCache(lLastAddr, pAsyncFirstReadBuf[iBufSel]); // -> add the complete data to cache - - pCurrReadBuf=pAsyncFirstReadBuf[iBufSel]+ // -> return the curr data buffer ptr + + pCurrReadBuf=pAsyncFirstReadBuf[iBufSel]+ // -> return the curr data buffer ptr ((addr-lLastAddr)*iUsedBlockSize); if(ppfHead) CheckPPFCache(addr,pCurrReadBuf); } @@ -567,7 +567,7 @@ void GetREADThreadPtr(void) ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// // special thread mode (caching 4) -// this mode helps with certain drives +// this mode helps with certain drives // basically it does the following: // It has a queue for n prefetch reads. If the main emu is // asking for an addr, the mode will check, if @@ -581,7 +581,7 @@ void GetREADThreadPtr(void) // do the needed reading as soon as possible :) ///////////////////////////////////////////////////////// -// reading thread... +// reading thread... DWORD WINAPI READThreadEx(LPVOID lpParameter) { @@ -599,35 +599,35 @@ DWORD WINAPI READThreadEx(LPVOID lpParameter) if(lAddrQ[iQPos]==0xFFFFFFFF) // nothing to do? strange :) {ReleaseMutex(hThreadMutex[1]);break;} - f=(FRAMEBUF *)ptrBuffer[0]; + f=(FRAMEBUF *)ptrBuffer[0]; lNeededAddr = lAddrQ[iQPos]; // store it in 'Neededaddr' for checks outside the thread - f->dwFrame = lNeededAddr; + f->dwFrame = lNeededAddr; f->dwFrameCnt = min((lMaxAddr-f->dwFrame+1),(MAXCACHEBLOCK+1)); f->dwBufLen = f->dwFrameCnt*iUsedBlockSize; - + lAddrQ[iQPos++]=0xFFFFFFFF; // set this slot as 'done' if(iQPos>=MAXQSIZE) iQPos=0; // amnd inc the head pos ReleaseMutex(hThreadMutex[1]); // ok, vars have been changed, now that vars are again available for all //------------------------------------------------// WaitForSingleObject(hThreadMutex[0],INFINITE); // read mutex: nobody else is allowed to read now - if(!iCDROK) + if(!iCDROK) { ReleaseMutex(hThreadMutex[0]); break; } - if(bCDDAPlay) // some cdda security... + if(bCDDAPlay) // some cdda security... { // it should just prevent prefetch reads happening in cdda mode, if this one breaks a 'needed' read, we are lost... lNeededAddr=0xFFFFFFFF; // so maybe we should remove this check? mmm, we will see ReleaseMutex(hThreadMutex[0]); break; - } + } if(pReadFunc(TRUE,f)!=SS_COMP) // do a blocking (sync) read { // mmm... if reading fails a number of times, we don't have a chance to return 'bad' to emu with thread reading... life is hard :) bReadRetry(f); // but at least our 'wait for data in cache' getptr will not wait forever (just returning wrong data, ehehe) - } + } ReleaseMutex(hThreadMutex[0]); // ok, read has done //------------------------------------------------// @@ -672,11 +672,11 @@ BOOL DoReadThreadEx(unsigned long addr) #ifdef THREADEX_STRAIGHT - if(addr>=lNeededAddr && + if(addr>=lNeededAddr && addr<=(lNeededAddr+MAXCACHEBLOCK)) { - ReleaseMutex(hThreadMutex[1]); - return TRUE; + ReleaseMutex(hThreadMutex[1]); + return TRUE; } for(k=0;k=lMaxAddr) // check, if addr too big { - ReleaseMutex(hThreadMutex[1]); + ReleaseMutex(hThreadMutex[1]); if(k==0) return FALSE; // -> if it's the main addr, there is an error return TRUE; // -> otherwise we can't simply cache that addr } @@ -732,7 +732,7 @@ BOOL DoReadThreadEx(unsigned long addr) //-----------------------------------------------------// // ok, here is the current ReadThreadEx mode: more -// complex, and it doesn't arrange the prefetch sectors +// complex, and it doesn't arrange the prefetch sectors // as straight as the type above, but the final result is // still smoother (no more pauses on the tested LG drive) @@ -806,13 +806,13 @@ BOOL DoReadThreadEx(unsigned long addr) #endif - ReleaseMutex(hThreadMutex[1]); + ReleaseMutex(hThreadMutex[1]); return TRUE; } ///////////////////////////////////////////////////////// -// emu says: gimme ptr to needed data... this will +// emu says: gimme ptr to needed data... this will // automatically do an async data prefetch read as well // ... called on CDRgetBuffer() @@ -845,12 +845,12 @@ void AllocDataCache(void) { bDataCacheHit=FALSE; // init thread cache hit flag if(!iUseCaching) iUseDataCache=0; // security: no additinal data cache, if no caching active - if(iUseDataCache) + if(iUseDataCache) { int i; for(i=0;i=MAXDATACACHE) iPos=0;} // -> don't use that pos, use next one lDataCacheAddr[iPos]=addr; - memcpy(pDataCacheBuf[iPos],pB, + memcpy(pDataCacheBuf[iPos],pB, MAXCDBUFFER-FRAMEBUFEXTRA); iPos++; if(iPos>=MAXDATACACHE) iPos=0; } @@ -894,10 +894,10 @@ BOOL CheckDataCache(unsigned long addr) for(i=0;i=lDataCacheAddr[i] && + if(addr>=lDataCacheAddr[i] && addr<=(lDataCacheAddr[i]+MAXCACHEBLOCK)) { - pCurrReadBuf=pDataCacheBuf[i]+ + pCurrReadBuf=pDataCacheBuf[i]+ ((addr-lDataCacheAddr[i])*iUsedBlockSize); if(ppfHead) CheckPPFCache(addr,pCurrReadBuf); return TRUE; diff --git a/plugins/CDVDpeops/resource.h b/plugins/CDVDpeops/resource.h index 48e1c78359..360e2bd070 100644 --- a/plugins/CDVDpeops/resource.h +++ b/plugins/CDVDpeops/resource.h @@ -45,7 +45,7 @@ #define IDC_SFSTATIC 1035 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 107 diff --git a/plugins/CDVDpeops/sub.c b/plugins/CDVDpeops/sub.c index e7a7b7b444..5cdc420588 100644 --- a/plugins/CDVDpeops/sub.c +++ b/plugins/CDVDpeops/sub.c @@ -33,7 +33,7 @@ /* TODO (#1#): SUB CHANNEL STUFF */ ///////////////////////////////////////////////////////// - + unsigned char * pCurrSubBuf=NULL; // ptr to emu sub data (or NULL) int iUseSubReading=0; // subdata support (by file or directly) char szSUBF[260]; // sub file name @@ -115,15 +115,15 @@ void BuildSUBCache(void) { fread(&px->subq[7],3, 1, subfile); } - + if(plast==NULL) // add new cache block to linked list { plast=subHead=px; - } + } else { plast->pNext=px;plast=px; - } + } } } else // M3S file? @@ -131,10 +131,10 @@ void BuildSUBCache(void) unsigned char min,sec,frame,xmin,xsec,xframe; // -> subs which are different from BOOL b1,b2,goon=TRUE;int iNum=0; // -> the expected calculated values - xmin=2; + xmin=2; xsec=58; xframe=0; - min=3; + min=3; sec=0; frame=0; @@ -167,8 +167,8 @@ void BuildSUBCache(void) px->addr=time2addrB(&buffer[7]); if(plast==NULL) - {plast=subHead=px;} - else {plast->pNext=px;plast=px;} + {plast=subHead=px;} + else {plast->pNext=px;plast=px;} } xframe=xframe+1; @@ -180,13 +180,13 @@ void BuildSUBCache(void) { xmin+=1; xsec-=60; - if(xmin>99) + if(xmin>99) { goon=FALSE; } } } - + frame=frame+1; if(frame>74) { @@ -196,7 +196,7 @@ void BuildSUBCache(void) { min+=1; sec-=60; - if(min>99) + if(min>99) { goon=FALSE; } @@ -206,7 +206,7 @@ void BuildSUBCache(void) if(iNum>(60*75)) goon=FALSE; } while(goon && (fread(buffer, 16, 1, subfile)==1)); - + if(iNum!=(60*75)) goon=FALSE; else if(iSUBNum==(60*75)) goon=FALSE; @@ -220,7 +220,7 @@ void BuildSUBCache(void) } } - subCache=NULL; + subCache=NULL; if(iSUBNum) // something in cache? { // -> create an array with the used addresses, for fast searching access SUB_CACHE * psc;int i; @@ -245,12 +245,12 @@ void FakeSubData(unsigned long adr) SubCData[12]=0x41; SubCData[13]=0x01; SubCData[14]=0x01; - + /* TODO (#1#): addr2time fake sub data */ - - -//!!!!!!!!!!!!!!!!!!!!!!!???? + + +//!!!!!!!!!!!!!!!!!!!!!!!???? addr2timeB(adr, &SubCData[15]); // SubCData[18]=0x00; addr2timeB(adr+150,&SubCData[19]); diff --git a/plugins/CDVDpeops/toc.c b/plugins/CDVDpeops/toc.c index 03dfb23a97..fd1ed82725 100644 --- a/plugins/CDVDpeops/toc.c +++ b/plugins/CDVDpeops/toc.c @@ -52,17 +52,17 @@ void ReadTOC(void) if(dwStatus!=SS_COMP) return; -#ifdef DBGOUT +#ifdef DBGOUT auxprintf("TOC Last %d, max %08x,%08x\n",sTOC.cLastTrack,sTOC.tracks[sTOC.cLastTrack].lAddr,reOrder(sTOC.tracks[sTOC.cLastTrack].lAddr)); -#endif +#endif // re-order it to psemu pro standards addr2time(reOrder(sTOC.tracks[sTOC.cLastTrack].lAddr),xbuffer); -#ifdef DBGOUT +#ifdef DBGOUT auxprintf("TOC %d, %d, %d, %d\n", xbuffer[0],xbuffer[1],xbuffer[2],xbuffer[3] ); #endif - + xbuffer[0]=itob(xbuffer[0]); xbuffer[1]=itob(xbuffer[1]); xbuffer[2]=itob(xbuffer[2]); diff --git a/plugins/CDVDpeops/wnaspi32.h b/plugins/CDVDpeops/wnaspi32.h index bbb919c0dd..b6fb376b52 100644 --- a/plugins/CDVDpeops/wnaspi32.h +++ b/plugins/CDVDpeops/wnaspi32.h @@ -299,7 +299,7 @@ typedef struct // %%% PROTOTYPES - User Callable ASPI for Win32 Functions %%% //***************************************************************************** -typedef struct +typedef struct { BYTE SRB_Cmd; BYTE SRB_Status; diff --git a/plugins/FWnull/Config.cpp b/plugins/FWnull/Config.cpp index e2ebeb5586..cabcd071f7 100644 --- a/plugins/FWnull/Config.cpp +++ b/plugins/FWnull/Config.cpp @@ -40,19 +40,19 @@ void setLoggingState() } } -EXPORT_C_(void) FWabout() +EXPORT_C_(void) FWabout() { SysMessage("FWnull: A simple null plugin."); } -EXPORT_C_(void) FWconfigure() +EXPORT_C_(void) FWconfigure() { LoadConfig(); PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log); SaveConfig(); } -void LoadConfig() +void LoadConfig() { string IniPath = s_strIniPath + "/FWnull.ini"; if (!Ini.Open(IniPath, READ_FILE)) @@ -61,13 +61,13 @@ void LoadConfig() SaveConfig(); return; } - + conf.Log = Ini.ReadInt("logging", 0); setLoggingState(); Ini.Close(); } -void SaveConfig() +void SaveConfig() { string IniPath = s_strIniPath + "/FWnull.ini"; if (!Ini.Open(IniPath, WRITE_FILE)) @@ -75,7 +75,7 @@ void SaveConfig() FWLog.WriteLn("Failed to open %s\n", IniPath.c_str()); return; } - + Ini.WriteInt("logging", conf.Log); Ini.Close(); } diff --git a/plugins/FWnull/FW.cpp b/plugins/FWnull/FW.cpp index 3fa7667e5b..9ac26f97a0 100644 --- a/plugins/FWnull/FW.cpp +++ b/plugins/FWnull/FW.cpp @@ -36,22 +36,22 @@ PluginLog FWLog; void (*FWirq)(); -EXPORT_C_(u32) PS2EgetLibType() +EXPORT_C_(u32) PS2EgetLibType() { return PS2E_LT_FW; } -EXPORT_C_(char*) PS2EgetLibName() +EXPORT_C_(char*) PS2EgetLibName() { return libraryName; } -EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) +EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) { return (version<<16) | (revision<<8) | build; } -EXPORT_C_(s32) FWinit() +EXPORT_C_(s32) FWinit() { LoadConfig(); setLoggingState(); @@ -61,61 +61,61 @@ EXPORT_C_(s32) FWinit() // Initializing our registers. fwregs = (s8*)malloc(0x10000); - if (fwregs == NULL) + if (fwregs == NULL) { - FWLog.Message("Error allocating Memory"); + FWLog.Message("Error allocating Memory"); return -1; } memset(fwregs, 0, 0x10000); return 0; } -EXPORT_C_(void) FWshutdown() +EXPORT_C_(void) FWshutdown() { // Freeing the registers. free(fwregs); FWLog.Close(); } -EXPORT_C_(s32) FWopen(void *pDsp) +EXPORT_C_(s32) FWopen(void *pDsp) { FWLog.WriteLn("Opening FWnull."); return 0; } -EXPORT_C_(void) FWclose() +EXPORT_C_(void) FWclose() { // Close the plugin. FWLog.WriteLn("Closing FWnull."); } -EXPORT_C_(u32) FWread32(u32 addr) +EXPORT_C_(u32) FWread32(u32 addr) { u32 ret = 0; - switch (addr) + switch (addr) { // We should document what this location is. case 0x1f808410: ret = 0x8; break; - + // Include other relevant 32 bit addresses we need to catch here. default: // By default, read fwregs. ret = fwRu32(addr); break; } - + FWLog.WriteLn("FW read mem 0x%x: 0x%x", addr, ret); return ret; } -EXPORT_C_(void) FWwrite32(u32 addr, u32 value) +EXPORT_C_(void) FWwrite32(u32 addr, u32 value) { - switch (addr) + switch (addr) { // Include other memory locations we want to catch here. // For example: @@ -125,7 +125,7 @@ EXPORT_C_(void) FWwrite32(u32 addr, u32 value) // case 0x1f808420: // case 0x1f808428: // case 0x1f808430: -// +// // Are addresses to look at. case 0x1f808410: fwRu32(addr) = value; break; default: @@ -136,7 +136,7 @@ EXPORT_C_(void) FWwrite32(u32 addr, u32 value) FWLog.WriteLn("FW write mem 0x%x: 0x%x", addr, value); } -EXPORT_C_(void) FWirqCallback(void (*callback)()) +EXPORT_C_(void) FWirqCallback(void (*callback)()) { // Register FWirq, so we can trigger an interrupt with it later. FWirq = callback; @@ -148,9 +148,9 @@ EXPORT_C_(void) FWsetSettingsDir(const char* dir) s_strIniPath = (dir == NULL) ? "inis/" : dir; } -EXPORT_C_(s32) FWfreeze(int mode, freezeData *data) +EXPORT_C_(s32) FWfreeze(int mode, freezeData *data) { - // This should store or retrieve any information, for if emulation + // This should store or retrieve any information, for if emulation // gets suspended, or for savestates. switch(mode) { @@ -167,7 +167,7 @@ EXPORT_C_(s32) FWfreeze(int mode, freezeData *data) return 0; } -EXPORT_C_(s32) FWtest() +EXPORT_C_(s32) FWtest() { // 0 if the plugin works, non-0 if it doesn't. return 0; diff --git a/plugins/FWnull/FW.h b/plugins/FWnull/FW.h index b8788eceac..5ed3e39051 100644 --- a/plugins/FWnull/FW.h +++ b/plugins/FWnull/FW.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef __FW_H__ #define __FW_H__ @@ -30,7 +30,7 @@ extern s8 *fwregs; #define fwRs32(mem) (*(s32*)&fwregs[(mem) & 0xffff]) #define fwRu32(mem) (*(u32*)&fwregs[(mem) & 0xffff]) -typedef struct +typedef struct { s32 Log; } Config; diff --git a/plugins/FWnull/Windows/Config.cpp b/plugins/FWnull/Windows/Config.cpp index aee13009b9..dd3d1e09b8 100644 --- a/plugins/FWnull/Windows/Config.cpp +++ b/plugins/FWnull/Windows/Config.cpp @@ -3,7 +3,7 @@ #include "../FW.h" extern HINSTANCE hInst; -void SaveConfig() +void SaveConfig() { Config *Conf1 = &conf; @@ -27,7 +27,7 @@ void LoadConfig() { Config *Conf1 = &conf; char *szTemp; char szIniFile[256], szValue[256]; - + GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); szTemp = strrchr(szIniFile, '\\'); @@ -36,7 +36,7 @@ void LoadConfig() { fp=fopen("inis\\fwnull.ini","rt");//check if firewirenull.ini really exists if (!fp) { - CreateDirectory("inis",NULL); + CreateDirectory("inis",NULL); memset(&conf, 0, sizeof(conf)); conf.Log = 0;//default value SaveConfig();//save and return diff --git a/plugins/FWnull/Windows/Win32.cpp b/plugins/FWnull/Windows/Win32.cpp index 3506132300..2b77b4f65a 100644 --- a/plugins/FWnull/Windows/Win32.cpp +++ b/plugins/FWnull/Windows/Win32.cpp @@ -19,7 +19,7 @@ void SysMessage(char *fmt, ...) { } BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { - + switch(uMsg) { case WM_INITDIALOG: LoadConfig(); @@ -61,19 +61,19 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { void CALLBACK FWconfigure() { DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), - GetActiveWindow(), - (DLGPROC)ConfigureDlgProc); + GetActiveWindow(), + (DLGPROC)ConfigureDlgProc); } void CALLBACK FWabout() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)AboutDlgProc); } BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT - DWORD dwReason, + DWORD dwReason, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; return TRUE; // very quick :) diff --git a/plugins/FWnull/Windows/resource.h b/plugins/FWnull/Windows/resource.h index 6ea8fead11..21d4221a1e 100644 --- a/plugins/FWnull/Windows/resource.h +++ b/plugins/FWnull/Windows/resource.h @@ -10,7 +10,7 @@ #define IDC_LOGGING 1007 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 105 diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index de5c33b2a4..830411807b 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -114,7 +114,7 @@ EXPORT_C_(INT32) GSinit() EXPORT_C GSshutdown() { - delete s_gs; + delete s_gs; s_gs = NULL; s_renderer = -1; @@ -168,7 +168,7 @@ static INT32 _GSopen(void* dsp, char* title, int renderer) switch(renderer) { - default: + default: case 0: case 1: case 2: dev = new GSDevice9(); break; case 3: case 4: case 5: dev = new GSDevice11(); break; case 12: case 13: new GSDeviceNull(); break; @@ -180,7 +180,7 @@ static INT32 _GSopen(void* dsp, char* title, int renderer) { switch(renderer) { - default: + default: case 0: s_gs = new GSRendererDX9(); break; case 3: s_gs = new GSRendererDX11(); break; case 2: case 5: case 8: case 11: case 13: @@ -211,7 +211,7 @@ static INT32 _GSopen(void* dsp, char* title, int renderer) if( *(HWND*)dsp == NULL ) { // old-style API expects us to create and manage our own window: - + int w = theApp.GetConfig("ModeWidth", 0); int h = theApp.GetConfig("ModeHeight", 0); @@ -270,9 +270,9 @@ EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt) static bool isdx11avail = GSUtil::IsDirect3D11Available(); if (isdx11avail) renderer = 4; //dx11 sw else renderer = 1; //dx9 sw - mt = 1; + mt = 1; } - else + else { // normal init renderer = theApp.GetConfig("renderer", 0); @@ -286,7 +286,7 @@ EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt) { s_gs->SetMultithreaded( !!mt ); } - + return retval; } @@ -448,7 +448,7 @@ EXPORT_C_(int) GSsetupRecording(int start, void* data) e.key = VK_F12; s_gs->KeyEvent(&e, start & 1); - + return 1; } @@ -521,13 +521,13 @@ static __forceinline bool LoopDatPacket_Thingamajig(HWND hWnd, uint8 (®s)[0x2 GSgifTransfer1(&buff[0], addr); } break; - + case 1: if(buff.size() < size) buff.resize(size); fread(&buff[0], size, 1, fp); GSgifTransfer2(&buff[0], size / 16); break; - + case 2: if(buff.size() < size) buff.resize(size); fread(&buff[0], size, 1, fp); @@ -631,7 +631,7 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow { GSLocalMemory mem; - static struct {int psm; const char* name;} s_format[] = + static struct {int psm; const char* name;} s_format[] = { {PSM_PSMCT32, "32"}, {PSM_PSMCT24, "24"}, @@ -652,7 +652,7 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow for(int i = 0; i < 1024 * 1024 * 4; i++) ptr[i] = (uint8)i; - // + // for(int tbw = 5; tbw <= 10; tbw++) { @@ -680,7 +680,7 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow BITBLTBUF.DBP = 0; BITBLTBUF.DBW = w / 64; BITBLTBUF.DPSM = s_format[i].psm; - + GIFRegTRXPOS TRXPOS; TRXPOS.SSAX = 0; @@ -798,7 +798,7 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow BITBLTBUF.DBP = 0; BITBLTBUF.DBW = 32; BITBLTBUF.DPSM = PSM_PSMCT32; - + GIFRegTRXPOS TRXPOS; TRXPOS.DSAX = 0; diff --git a/plugins/GSdx/GS.h b/plugins/GSdx/GS.h index 536b93f629..872e4272d9 100644 --- a/plugins/GSdx/GS.h +++ b/plugins/GSdx/GS.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,18 +6,18 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * - * Special Notes: + * Special Notes: * * Register definitions and most of the enums originate from sps2dev-0.4.0 * Copyright (C) 2002 Terratron Technologies Inc. All Rights Reserved. @@ -151,12 +151,12 @@ enum GIF_FLG enum GS_PSM { - PSM_PSMCT32 = 0, // 0000-0000 - PSM_PSMCT24 = 1, // 0000-0001 - PSM_PSMCT16 = 2, // 0000-0010 - PSM_PSMCT16S = 10, // 0000-1010 - PSM_PSMT8 = 19, // 0001-0011 - PSM_PSMT4 = 20, // 0001-0100 + PSM_PSMCT32 = 0, // 0000-0000 + PSM_PSMCT24 = 1, // 0000-0001 + PSM_PSMCT16 = 2, // 0000-0010 + PSM_PSMCT16S = 10, // 0000-1010 + PSM_PSMT8 = 19, // 0001-0011 + PSM_PSMT4 = 20, // 0001-0100 PSM_PSMT8H = 27, // 0001-1011 PSM_PSMT4HL = 36, // 0010-0100 PSM_PSMT4HH = 44, // 0010-1100 @@ -490,8 +490,8 @@ REG64_SET(GSReg) GSRegIMR IMR; GSRegPMODE PMODE; GSRegSIGLBLID SIGLBLID; - GSRegSMODE1 SMODE1; - GSRegSMODE2 SMODE2; + GSRegSMODE1 SMODE1; + GSRegSMODE2 SMODE2; REG_SET_END // @@ -786,7 +786,7 @@ REG64_(GIFReg, TEST) uint32 _PAD2:32; REG_END2 __forceinline bool DoFirstPass() {return !ATE || ATST != ATST_NEVER;} // not all pixels fail automatically - __forceinline bool DoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL != AFAIL_KEEP;} // pixels may fail, write fb/z + __forceinline bool DoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL != AFAIL_KEEP;} // pixels may fail, write fb/z __forceinline bool NoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL == AFAIL_KEEP;} // pixels may fail, no output REG_END2 @@ -1085,7 +1085,7 @@ REG_SET_END __aligned16 struct GIFPath { - GIFTag tag; + GIFTag tag; uint32 reg; uint32 nreg; uint32 nloop; @@ -1103,14 +1103,14 @@ __aligned16 struct GIFPath adonly = nreg == 1 && regs.u8[0] == GIF_REG_A_D; } - __forceinline uint8 GetReg() + __forceinline uint8 GetReg() { return regs.u8[reg]; // GET_GIF_REG(tag, reg); } __forceinline bool StepReg() { - if((++reg & 0xf) == nreg) + if((++reg & 0xf) == nreg) { reg = 0; if(--nloop == 0) @@ -1188,4 +1188,4 @@ struct GSKeyEventData {uint32 key, type;}; enum {FREEZE_LOAD=0, FREEZE_SAVE=1, FREEZE_SIZE=2}; struct GSFreezeData {int size; uint8* data;}; -enum stateType {ST_WRITE, ST_TRANSFER, ST_VSYNC}; +enum stateType {ST_WRITE, ST_TRANSFER, ST_VSYNC}; diff --git a/plugins/GSdx/GSAlignedClass.cpp b/plugins/GSdx/GSAlignedClass.cpp index ac15a82f96..eef644764d 100644 --- a/plugins/GSdx/GSAlignedClass.cpp +++ b/plugins/GSdx/GSAlignedClass.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSAlignedClass.h b/plugins/GSdx/GSAlignedClass.h index d684e6d79c..2813982e10 100644 --- a/plugins/GSdx/GSAlignedClass.h +++ b/plugins/GSdx/GSAlignedClass.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -26,7 +26,7 @@ template class GSAlignedClass public: GSAlignedClass() {} virtual ~GSAlignedClass() {} - + void* operator new (size_t size) { return _aligned_malloc(size, i); diff --git a/plugins/GSdx/GSBlock.cpp b/plugins/GSdx/GSBlock.cpp index 86ef7c428d..172afce3b4 100644 --- a/plugins/GSdx/GSBlock.cpp +++ b/plugins/GSdx/GSBlock.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSBlock.h b/plugins/GSdx/GSBlock.h index e637f70f63..7c9b9496bf 100644 --- a/plugins/GSdx/GSBlock.h +++ b/plugins/GSdx/GSBlock.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -78,14 +78,14 @@ public: { #endif - + ((GSVector4i*)dst)[i * 4 + 0] = ((GSVector4i*)dst)[i * 4 + 0].blend(v0, v4); ((GSVector4i*)dst)[i * 4 + 1] = ((GSVector4i*)dst)[i * 4 + 1].blend(v1, v4); ((GSVector4i*)dst)[i * 4 + 2] = ((GSVector4i*)dst)[i * 4 + 2].blend(v2, v4); ((GSVector4i*)dst)[i * 4 + 3] = ((GSVector4i*)dst)[i * 4 + 3].blend(v3, v4); #if _M_SSE >= 0x401 - + } #endif @@ -266,9 +266,9 @@ public: { const GSVector4i* s = (const GSVector4i*)src; - GSVector4i v0 = s[i * 4 + 0]; - GSVector4i v1 = s[i * 4 + 1]; - GSVector4i v2 = s[i * 4 + 2]; + GSVector4i v0 = s[i * 4 + 0]; + GSVector4i v1 = s[i * 4 + 1]; + GSVector4i v2 = s[i * 4 + 2]; GSVector4i v3 = s[i * 4 + 3]; GSVector4i::sw64(v0, v1, v2, v3); @@ -308,9 +308,9 @@ public: const GSVector4i* s = (const GSVector4i*)src; - GSVector4i v0 = s[i * 4 + 0]; - GSVector4i v1 = s[i * 4 + 1]; - GSVector4i v2 = s[i * 4 + 2]; + GSVector4i v0 = s[i * 4 + 0]; + GSVector4i v1 = s[i * 4 + 1]; + GSVector4i v2 = s[i * 4 + 2]; GSVector4i v3 = s[i * 4 + 3]; GSVector4i::sw16(v0, v1, v2, v3); @@ -338,16 +338,16 @@ public: if((i & 1) == 0) { - v0 = s[i * 4 + 0]; - v1 = s[i * 4 + 1]; - v2 = s[i * 4 + 2]; + v0 = s[i * 4 + 0]; + v1 = s[i * 4 + 1]; + v2 = s[i * 4 + 2]; v3 = s[i * 4 + 3]; } else { - v2 = s[i * 4 + 0]; - v3 = s[i * 4 + 1]; - v0 = s[i * 4 + 2]; + v2 = s[i * 4 + 0]; + v3 = s[i * 4 + 1]; + v0 = s[i * 4 + 2]; v1 = s[i * 4 + 3]; } @@ -368,9 +368,9 @@ public: const GSVector4i* s = (const GSVector4i*)src; - GSVector4i v0 = s[i * 4 + 0]; - GSVector4i v1 = s[i * 4 + 1]; - GSVector4i v2 = s[i * 4 + 2]; + GSVector4i v0 = s[i * 4 + 0]; + GSVector4i v1 = s[i * 4 + 1]; + GSVector4i v2 = s[i * 4 + 2]; GSVector4i v3 = s[i * 4 + 3]; GSVector4i::sw8(v0, v1, v2, v3); @@ -387,7 +387,7 @@ public: { v0 = v0.yxwz(); v1 = v1.yxwz(); - } + } GSVector4i::store(&dst[dstpitch * 0], v0); GSVector4i::store(&dst[dstpitch * 1], v1); @@ -396,16 +396,16 @@ public: #endif } - + template __forceinline static void ReadColumn4(const uint8* RESTRICT src, uint8* RESTRICT dst, int dstpitch) { #if _M_SSE >= 0x301 const GSVector4i* s = (const GSVector4i*)src; - GSVector4i v0 = s[i * 4 + 0].xzyw(); - GSVector4i v1 = s[i * 4 + 1].xzyw(); - GSVector4i v2 = s[i * 4 + 2].xzyw(); + GSVector4i v0 = s[i * 4 + 0].xzyw(); + GSVector4i v1 = s[i * 4 + 1].xzyw(); + GSVector4i v2 = s[i * 4 + 2].xzyw(); GSVector4i v3 = s[i * 4 + 3].xzyw(); GSVector4i::sw64(v0, v1, v2, v3); @@ -435,9 +435,9 @@ public: const GSVector4i* s = (const GSVector4i*)src; - GSVector4i v0 = s[i * 4 + 0]; - GSVector4i v1 = s[i * 4 + 1]; - GSVector4i v2 = s[i * 4 + 2]; + GSVector4i v0 = s[i * 4 + 0]; + GSVector4i v1 = s[i * 4 + 1]; + GSVector4i v2 = s[i * 4 + 2]; GSVector4i v3 = s[i * 4 + 3]; GSVector4i::sw32(v0, v1, v2, v3); @@ -576,9 +576,9 @@ public: { // col 0, 2 - v0 = s[i * 8 + 0]; - v1 = s[i * 8 + 1]; - v2 = s[i * 8 + 2]; + v0 = s[i * 8 + 0]; + v1 = s[i * 8 + 1]; + v2 = s[i * 8 + 2]; v3 = s[i * 8 + 3]; GSVector4i::sw8(v0, v1, v2, v3); @@ -601,9 +601,9 @@ public: // col 1, 3 - v0 = s[i * 8 + 4]; - v1 = s[i * 8 + 5]; - v2 = s[i * 8 + 6]; + v0 = s[i * 8 + 4]; + v1 = s[i * 8 + 5]; + v2 = s[i * 8 + 6]; v3 = s[i * 8 + 7]; GSVector4i::sw8(v0, v1, v2, v3); @@ -634,9 +634,9 @@ public: for(int i = 0; i < 4; i++) { - v0 = s[i * 4 + 0]; - v1 = s[i * 4 + 1]; - v2 = s[i * 4 + 2]; + v0 = s[i * 4 + 0]; + v1 = s[i * 4 + 1]; + v2 = s[i * 4 + 2]; v3 = s[i * 4 + 3]; GSVector4i::sw64(v0, v1, v2, v3); @@ -644,11 +644,11 @@ public: v0 = ((v0 >> 24).ps32(v1 >> 24)).pu16((v2 >> 24).ps32(v3 >> 24)); GSVector4i::storel(dst, v0); - + dst += dstpitch; GSVector4i::storeh(dst, v0); - + dst += dstpitch; } } @@ -663,9 +663,9 @@ public: for(int i = 0; i < 4; i++) { - v0 = s[i * 4 + 0]; - v1 = s[i * 4 + 1]; - v2 = s[i * 4 + 2]; + v0 = s[i * 4 + 0]; + v1 = s[i * 4 + 1]; + v2 = s[i * 4 + 2]; v3 = s[i * 4 + 3]; GSVector4i::sw64(v0, v1, v2, v3); @@ -673,11 +673,11 @@ public: v0 = ((v0 >> 24).ps32(v1 >> 24)).pu16((v2 >> 24).ps32(v3 >> 24)) & mask; GSVector4i::storel(dst, v0); - + dst += dstpitch; GSVector4i::storeh(dst, v0); - + dst += dstpitch; } } @@ -690,9 +690,9 @@ public: for(int i = 0; i < 4; i++) { - v0 = s[i * 4 + 0]; - v1 = s[i * 4 + 1]; - v2 = s[i * 4 + 2]; + v0 = s[i * 4 + 0]; + v1 = s[i * 4 + 1]; + v2 = s[i * 4 + 2]; v3 = s[i * 4 + 3]; GSVector4i::sw64(v0, v1, v2, v3); @@ -700,11 +700,11 @@ public: v0 = ((v0 >> 28).ps32(v1 >> 28)).pu16((v2 >> 28).ps32(v3 >> 28)); GSVector4i::storel(dst, v0); - + dst += dstpitch; GSVector4i::storeh(dst, v0); - + dst += dstpitch; } } @@ -761,9 +761,9 @@ public: for(int i = 0; i < 2; i++, src += srcpitch * 4) { GSVector4i v( - *(uint32*)&src[srcpitch * 0], - *(uint32*)&src[srcpitch * 1], - *(uint32*)&src[srcpitch * 2], + *(uint32*)&src[srcpitch * 0], + *(uint32*)&src[srcpitch * 1], + *(uint32*)&src[srcpitch * 2], *(uint32*)&src[srcpitch * 3]); GSVector4i lo = v & mask; @@ -796,9 +796,9 @@ public: for(int i = 0; i < 2; i++, src += srcpitch * 4) { GSVector4i v( - *(uint32*)&src[srcpitch * 0], - *(uint32*)&src[srcpitch * 1], - *(uint32*)&src[srcpitch * 2], + *(uint32*)&src[srcpitch * 0], + *(uint32*)&src[srcpitch * 1], + *(uint32*)&src[srcpitch * 2], *(uint32*)&src[srcpitch * 3]); GSVector4i lo = (v << 4) & mask; @@ -1077,7 +1077,7 @@ public: #ifdef _M_AMD64 - ((GSVector4i*)dst)[i * 4 + 0] = ((GSVector4i*)dst)[i * 4 + 0].blend8(v0, mask); + ((GSVector4i*)dst)[i * 4 + 0] = ((GSVector4i*)dst)[i * 4 + 0].blend8(v0, mask); ((GSVector4i*)dst)[i * 4 + 1] = ((GSVector4i*)dst)[i * 4 + 1].blend8(v1, mask); ((GSVector4i*)dst)[i * 4 + 2] = ((GSVector4i*)dst)[i * 4 + 2].blend8(v2, mask); ((GSVector4i*)dst)[i * 4 + 3] = ((GSVector4i*)dst)[i * 4 + 3].blend8(v3, mask); @@ -1086,7 +1086,7 @@ public: // here blend is faster than blend8 because vc8 has a little problem optimizing register usage for pblendvb (3rd op must be xmm0) - ((GSVector4i*)dst)[i * 4 + 0] = ((GSVector4i*)dst)[i * 4 + 0].blend(v0, mask); + ((GSVector4i*)dst)[i * 4 + 0] = ((GSVector4i*)dst)[i * 4 + 0].blend(v0, mask); ((GSVector4i*)dst)[i * 4 + 1] = ((GSVector4i*)dst)[i * 4 + 1].blend(v1, mask); ((GSVector4i*)dst)[i * 4 + 2] = ((GSVector4i*)dst)[i * 4 + 2].blend(v2, mask); ((GSVector4i*)dst)[i * 4 + 3] = ((GSVector4i*)dst)[i * 4 + 3].blend(v3, mask); @@ -1162,9 +1162,9 @@ public: for(int i = 0; i < 2; i++, src += srcpitch * 4) { GSVector4i v( - *(uint32*)&src[srcpitch * 0], - *(uint32*)&src[srcpitch * 1], - *(uint32*)&src[srcpitch * 2], + *(uint32*)&src[srcpitch * 0], + *(uint32*)&src[srcpitch * 1], + *(uint32*)&src[srcpitch * 2], *(uint32*)&src[srcpitch * 3]); GSVector4i lo = v & mask; @@ -1213,9 +1213,9 @@ public: for(int i = 0; i < 2; i++, src += srcpitch * 4) { GSVector4i v( - *(uint32*)&src[srcpitch * 0], - *(uint32*)&src[srcpitch * 1], - *(uint32*)&src[srcpitch * 2], + *(uint32*)&src[srcpitch * 0], + *(uint32*)&src[srcpitch * 1], + *(uint32*)&src[srcpitch * 2], *(uint32*)&src[srcpitch * 3]); GSVector4i lo = v & mask; @@ -1277,9 +1277,9 @@ public: for(int i = 0; i < 2; i++, src += srcpitch * 4) { GSVector4i v( - *(uint32*)&src[srcpitch * 0], - *(uint32*)&src[srcpitch * 1], - *(uint32*)&src[srcpitch * 2], + *(uint32*)&src[srcpitch * 0], + *(uint32*)&src[srcpitch * 1], + *(uint32*)&src[srcpitch * 2], *(uint32*)&src[srcpitch * 3]); GSVector4i lo = (v << 4) & mask; @@ -1328,9 +1328,9 @@ public: for(int i = 0; i < 2; i++, src += srcpitch * 4) { GSVector4i v( - *(uint32*)&src[srcpitch * 0], - *(uint32*)&src[srcpitch * 1], - *(uint32*)&src[srcpitch * 2], + *(uint32*)&src[srcpitch * 0], + *(uint32*)&src[srcpitch * 1], + *(uint32*)&src[srcpitch * 2], *(uint32*)&src[srcpitch * 3]); GSVector4i lo = (v << 4) & mask; @@ -1430,9 +1430,9 @@ public: for(int i = 0; i < 2; i++) { - v0 = s[i * 8 + 0].shuffle8(mask); - v1 = s[i * 8 + 1].shuffle8(mask); - v2 = s[i * 8 + 2].shuffle8(mask); + v0 = s[i * 8 + 0].shuffle8(mask); + v1 = s[i * 8 + 1].shuffle8(mask); + v2 = s[i * 8 + 2].shuffle8(mask); v3 = s[i * 8 + 3].shuffle8(mask); GSVector4i::sw16(v0, v1, v2, v3); @@ -1447,9 +1447,9 @@ public: v2.gather32_8<>(pal, (GSVector4i*)dst); dst += dstpitch; - v2 = s[i * 8 + 4].shuffle8(mask); - v3 = s[i * 8 + 5].shuffle8(mask); - v0 = s[i * 8 + 6].shuffle8(mask); + v2 = s[i * 8 + 4].shuffle8(mask); + v3 = s[i * 8 + 5].shuffle8(mask); + v0 = s[i * 8 + 6].shuffle8(mask); v1 = s[i * 8 + 7].shuffle8(mask); GSVector4i::sw16(v0, v1, v2, v3); @@ -1489,9 +1489,9 @@ public: for(int i = 0; i < 2; i++) { - v0 = s[i * 8 + 0].xzyw(); - v1 = s[i * 8 + 1].xzyw(); - v2 = s[i * 8 + 2].xzyw(); + v0 = s[i * 8 + 0].xzyw(); + v1 = s[i * 8 + 1].xzyw(); + v2 = s[i * 8 + 2].xzyw(); v3 = s[i * 8 + 3].xzyw(); GSVector4i::sw64(v0, v1, v2, v3); @@ -1514,9 +1514,9 @@ public: v3.gather64_8<>(pal, (GSVector4i*)dst); dst += dstpitch; - v0 = s[i * 8 + 4].xzyw(); - v1 = s[i * 8 + 5].xzyw(); - v2 = s[i * 8 + 6].xzyw(); + v0 = s[i * 8 + 4].xzyw(); + v1 = s[i * 8 + 5].xzyw(); + v2 = s[i * 8 + 6].xzyw(); v3 = s[i * 8 + 7].xzyw(); GSVector4i::sw64(v0, v1, v2, v3); @@ -1563,21 +1563,21 @@ public: for(int i = 0; i < 4; i++) { - v0 = s[i * 4 + 0]; - v1 = s[i * 4 + 1]; - v2 = s[i * 4 + 2]; + v0 = s[i * 4 + 0]; + v1 = s[i * 4 + 1]; + v2 = s[i * 4 + 2]; v3 = s[i * 4 + 3]; GSVector4i::sw64(v0, v1, v2, v3); (v0 >> 24).gather32_32<>(pal, (GSVector4i*)&dst[0]); (v1 >> 24).gather32_32<>(pal, (GSVector4i*)&dst[16]); - + dst += dstpitch; (v2 >> 24).gather32_32<>(pal, (GSVector4i*)&dst[0]); (v3 >> 24).gather32_32<>(pal, (GSVector4i*)&dst[16]); - + dst += dstpitch; } @@ -1604,21 +1604,21 @@ public: for(int i = 0; i < 4; i++) { - v0 = s[i * 4 + 0]; - v1 = s[i * 4 + 1]; - v2 = s[i * 4 + 2]; + v0 = s[i * 4 + 0]; + v1 = s[i * 4 + 1]; + v2 = s[i * 4 + 2]; v3 = s[i * 4 + 3]; GSVector4i::sw64(v0, v1, v2, v3); ((v0 >> 24) & 0xf).gather32_32<>(pal, (GSVector4i*)&dst[0]); ((v1 >> 24) & 0xf).gather32_32<>(pal, (GSVector4i*)&dst[16]); - + dst += dstpitch; ((v2 >> 24) & 0xf).gather32_32<>(pal, (GSVector4i*)&dst[0]); ((v3 >> 24) & 0xf).gather32_32<>(pal, (GSVector4i*)&dst[16]); - + dst += dstpitch; } @@ -1634,7 +1634,7 @@ public: } // TODO: ReadAndExpandBlock4HL_16 - + __forceinline static void ReadAndExpandBlock4HH_32(const uint8* RESTRICT src, uint8* RESTRICT dst, int dstpitch, const uint32* RESTRICT pal) { #if _M_SSE >= 0x401 @@ -1645,21 +1645,21 @@ public: for(int i = 0; i < 4; i++) { - v0 = s[i * 4 + 0]; - v1 = s[i * 4 + 1]; - v2 = s[i * 4 + 2]; + v0 = s[i * 4 + 0]; + v1 = s[i * 4 + 1]; + v2 = s[i * 4 + 2]; v3 = s[i * 4 + 3]; GSVector4i::sw64(v0, v1, v2, v3); (v0 >> 28).gather32_32<>(pal, (GSVector4i*)&dst[0]); (v1 >> 28).gather32_32<>(pal, (GSVector4i*)&dst[16]); - + dst += dstpitch; (v2 >> 28).gather32_32<>(pal, (GSVector4i*)&dst[0]); (v3 >> 28).gather32_32<>(pal, (GSVector4i*)&dst[16]); - + dst += dstpitch; } diff --git a/plugins/GSdx/GSCapture.cpp b/plugins/GSdx/GSCapture.cpp index 79f76fa9d9..b2207e09fb 100644 --- a/plugins/GSdx/GSCapture.cpp +++ b/plugins/GSdx/GSCapture.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -28,7 +28,7 @@ // #ifdef __INTEL_COMPILER -interface __declspec(uuid("59C193BB-C520-41F3-BC1D-E245B80A86FA")) +interface __declspec(uuid("59C193BB-C520-41F3-BC1D-E245B80A86FA")) #else [uuid("59C193BB-C520-41F3-BC1D-E245B80A86FA")] interface #endif @@ -42,7 +42,7 @@ IGSSource : public IUnknown #ifdef __INTEL_COMPILER class __declspec(uuid("F8BB6F4F-0965-4ED4-BA74-C6A01E6E6C77")) #else -[uuid("F8BB6F4F-0965-4ED4-BA74-C6A01E6E6C77")] class +[uuid("F8BB6F4F-0965-4ED4-BA74-C6A01E6E6C77")] class #endif GSSource : public CBaseFilter, private CCritSec, public IGSSource { @@ -52,7 +52,7 @@ GSSource : public CBaseFilter, private CCritSec, public IGSSource STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) { - return + return riid == __uuidof(IGSSource) ? GetInterface((IGSSource*)this, ppv) : __super::NonDelegatingQueryInterface(riid, ppv); } @@ -115,7 +115,7 @@ GSSource : public CBaseFilter, private CCritSec, public IGSSource pProperties->cbBuffer = m_mt.lSampleSize; ALLOCATOR_PROPERTIES Actual; - + if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) { return hr; @@ -196,7 +196,7 @@ public: return 1; } - CBasePin* GetPin(int n) + CBasePin* GetPin(int n) { return n == 0 ? m_output : NULL; } @@ -413,7 +413,7 @@ bool GSCapture::BeginCapture(int fps) if(IDOK != dlg.DoModal()) return false; m_size.x = (dlg.m_width + 7) & ~7; - m_size.y = (dlg.m_height + 7) & ~7; + m_size.y = (dlg.m_height + 7) & ~7; wstring fn(dlg.m_filename.begin(), dlg.m_filename.end()); @@ -472,7 +472,7 @@ bool GSCapture::BeginCapture(int fps) pPin->QueryPinInfo(&pi); wstring s(pi.achName); printf("- Pin [%p - %p]: %s (%s)\n", pPin.p, pPinTo.p, string(s.begin(), s.end()).c_str(), pi.dir ? "out" : "in"); - + BeginEnumMediaTypes(pPin, pEMT, pmt) { } @@ -495,9 +495,9 @@ bool GSCapture::DeliverFrame(const void* bits, int pitch, bool rgba) { CAutoLock cAutoLock(this); - if(bits == NULL || pitch == 0) + if(bits == NULL || pitch == 0) { - ASSERT(0); + ASSERT(0); return false; } diff --git a/plugins/GSdx/GSCapture.h b/plugins/GSdx/GSCapture.h index c6b71a2f12..c9e2f4f6d1 100644 --- a/plugins/GSdx/GSCapture.h +++ b/plugins/GSdx/GSCapture.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSCaptureDlg.cpp b/plugins/GSdx/GSCaptureDlg.cpp index 0e63d1c6d1..faa7c5f366 100644 --- a/plugins/GSdx/GSCaptureDlg.cpp +++ b/plugins/GSdx/GSCaptureDlg.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -99,7 +99,7 @@ void GSCaptureDlg::OnInit() if(FAILED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL))) continue; - + c.FriendlyName = prefix + var.bstrVal; m_codecs.push_back(c); @@ -204,4 +204,4 @@ bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code) } return __super::OnCommand(hWnd, id, code); -} \ No newline at end of file +} diff --git a/plugins/GSdx/GSCaptureDlg.h b/plugins/GSdx/GSCaptureDlg.h index ceb0b04f64..25500036e1 100644 --- a/plugins/GSdx/GSCaptureDlg.h +++ b/plugins/GSdx/GSCaptureDlg.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSClut.cpp b/plugins/GSdx/GSClut.cpp index 426e8ba153..79d68bd27b 100644 --- a/plugins/GSdx/GSClut.cpp +++ b/plugins/GSdx/GSClut.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -91,7 +91,7 @@ GSClut::~GSClut() VirtualFree(m_clut, 0, MEM_RELEASE); } -void GSClut::Invalidate() +void GSClut::Invalidate() { m_write.dirty = true; } @@ -429,7 +429,7 @@ void GSClut::WriteCLUT_T16_I8_CSM1(const uint16* RESTRICT src, uint16* RESTRICT __forceinline void GSClut::WriteCLUT_T16_I4_CSM1(const uint16* RESTRICT src, uint16* RESTRICT clut) { - for(int i = 0; i < 16; i++) + for(int i = 0; i < 16; i++) { clut[i] = src[clutTableT16I4[i]]; } @@ -677,4 +677,4 @@ bool GSClut::ReadState::IsDirty(const GIFRegTEX0& TEX0) bool GSClut::ReadState::IsDirty(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA) { return dirty || !GSVector4i::load(this).eq(GSVector4i::load(&TEX0, &TEXA)); -} \ No newline at end of file +} diff --git a/plugins/GSdx/GSClut.h b/plugins/GSdx/GSClut.h index 9c658fad96..ba344a4672 100644 --- a/plugins/GSdx/GSClut.h +++ b/plugins/GSdx/GSClut.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSCodeBuffer.cpp b/plugins/GSdx/GSCodeBuffer.cpp index 78e08da67e..0b27c77270 100644 --- a/plugins/GSdx/GSCodeBuffer.cpp +++ b/plugins/GSdx/GSCodeBuffer.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -68,4 +68,4 @@ void GSCodeBuffer::ReleaseBuffer(size_t size) m_pos = ((m_pos + size) + 15) & ~15; m_reserved = 0; -} \ No newline at end of file +} diff --git a/plugins/GSdx/GSCodeBuffer.h b/plugins/GSdx/GSCodeBuffer.h index ed1a197e9a..7a77e06911 100644 --- a/plugins/GSdx/GSCodeBuffer.h +++ b/plugins/GSdx/GSCodeBuffer.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -34,4 +34,4 @@ public: void* GetBuffer(size_t size); void ReleaseBuffer(size_t size); -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSCrc.cpp b/plugins/GSdx/GSCrc.cpp index ce02d40e82..2fe8a37d46 100644 --- a/plugins/GSdx/GSCrc.cpp +++ b/plugins/GSdx/GSCrc.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -22,7 +22,7 @@ #include "StdAfx.h" #include "GSCrc.h" -CRC::Game CRC::m_games[] = +CRC::Game CRC::m_games[] = { {0x00000000, None, Unknown, 0}, {0x2113EA2E, MetalSlug6, Unknown, 0}, @@ -76,11 +76,11 @@ CRC::Game CRC::m_games[] = {0xFE961D28, DBZBT2, US, 0}, {0x0393B6BE, DBZBT2, EU, 0}, {0xE2F289ED, DBZBT2, JP, 0}, // Sparking Neo! - {0x35AA84D1, DBZBT2, Unknown, 0}, + {0x35AA84D1, DBZBT2, Unknown, 0}, {0x428113C2, DBZBT3, US, 0}, {0xA422BB13, DBZBT3, EU, 0}, - {0x983C53D2, DBZBT3, Unknown, 0}, - {0x983C53D3, DBZBT3, Unknown, 0}, + {0x983C53D2, DBZBT3, Unknown, 0}, + {0x983C53D3, DBZBT3, Unknown, 0}, {0x72B3802A, SFEX3, US, 0}, {0x71521863, SFEX3, US, 0}, {0x28703748, Bully, US, 0}, @@ -102,7 +102,7 @@ CRC::Game CRC::m_games[] = {0xC164550A, WildArms5, JPUNDUB, 0}, {0xC1640D2C, WildArms5, US, 0}, {0x0FCF8FE4, WildArms5, EU, 0}, - {0x2294D322, WildArms5, JP, 0}, + {0x2294D322, WildArms5, JP, 0}, {0x565B6170, WildArms5, JP, 0}, {0x8B029334, Manhunt2, Unknown, 0}, {0x09F49E37, CrashBandicootWoC, Unknown, 0}, @@ -115,7 +115,7 @@ CRC::Game CRC::m_games[] = {0xEC432B24, Drakengard2, Unknown, 0}, {0xFC46EA61, Tekken5, JP, 0}, {0x1F88EE37, Tekken5, Unknown, 0}, - {0x652050D2, Tekken5, Unknown, 0}, + {0x652050D2, Tekken5, Unknown, 0}, {0x9E98B8AE, IkkiTousen, JP, 0}, {0xD6385328, GodOfWar, US, 0}, {0xFB0E6D72, GodOfWar, EU, 0}, @@ -123,7 +123,7 @@ CRC::Game CRC::m_games[] = {0xA61A4C6D, GodOfWar, Unknown, 0}, {0xE23D532B, GodOfWar, Unknown, 0}, {0xDF1AF973, GodOfWar, Unknown, 0}, - {0xD6385328, GodOfWar, Unknown, 0}, + {0xD6385328, GodOfWar, Unknown, 0}, {0x2F123FD8, GodOfWar2, RU, 0}, {0x2F123FD8, GodOfWar2, US, 0}, {0x44A8A22A, GodOfWar2, EU, 0}, @@ -135,11 +135,11 @@ CRC::Game CRC::m_games[] = {0x75c01a04, NamcoXCapcom, US, 0}, {0xBF6F101F, GiTS, US, 0}, {0xA5768F53, GiTS, JP, 0}, - {0x6BF11378, Onimusha3, US, 0}, + {0x6BF11378, Onimusha3, US, 0}, {0xF442260C, MajokkoALaMode2, JP, 0}, {0x14FE77F7, TalesOfAbyss, US, 0}, {0x045D77E9, TalesOfAbyss, JPUNDUB, 0}, - {0xAA5EC3A3, TalesOfAbyss, JP, 0}, + {0xAA5EC3A3, TalesOfAbyss, JP, 0}, {0xFB236A46, SonicUnleashed, US, 0}, {0x4C7BB3C8, SimpsonsGame, Unknown, 0}, {0x4C94B32C, SimpsonsGame, Unknown, 0}, @@ -156,7 +156,7 @@ CRC::Game CRC::m_games[] = {0xF0A31EE3, SMTNocturne, EU, ZWriteMustNotClear}, // SMTNocturne (Lucifers Call in EU) {0xD60DA6D4, SMTNocturne, JP, ZWriteMustNotClear}, // SMTNocturne {0x0e762e8d, SMTNocturne, JP, ZWriteMustNotClear}, // SMTNocturne Maniacs - {0x47BA9034, SMTNocturne, JP, ZWriteMustNotClear}, // SMTNocturne Maniacs Chronicle + {0x47BA9034, SMTNocturne, JP, ZWriteMustNotClear}, // SMTNocturne Maniacs Chronicle {0xD7273511, SMTDDS1, US, ZWriteMustNotClear}, // SMT Digital Devil Saga {0x1683A6BE, SMTDDS1, EU, ZWriteMustNotClear}, // SMT Digital Devil Saga {0x44865CE1, SMTDDS1, JP, ZWriteMustNotClear}, // SMT Digital Devil Saga @@ -185,4 +185,4 @@ CRC::Game CRC::Lookup(uint32 crc) } return m_games[0]; -} \ No newline at end of file +} diff --git a/plugins/GSdx/GSCrc.h b/plugins/GSdx/GSCrc.h index 9396a2c012..dbb15612f5 100644 --- a/plugins/GSdx/GSCrc.h +++ b/plugins/GSdx/GSCrc.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -82,14 +82,14 @@ public: TitleCount, }; - enum Region + enum Region { - Unknown, - US, - EU, - JP, - JPUNDUB, - RU, + Unknown, + US, + EU, + JP, + JPUNDUB, + RU, FR, DE, IT, @@ -104,7 +104,7 @@ public: ZWriteMustNotClear = 2, }; - struct Game + struct Game { uint32 crc; Title title; diff --git a/plugins/GSdx/GSDevice.cpp b/plugins/GSdx/GSDevice.cpp index b662a472a7..5a09097b79 100644 --- a/plugins/GSdx/GSDevice.cpp +++ b/plugins/GSdx/GSDevice.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -23,7 +23,7 @@ #include "GSdx.h" #include "GSDevice.h" -GSDevice::GSDevice() +GSDevice::GSDevice() : m_wnd(NULL) , m_vsync(false) , m_rbswapped(false) @@ -41,12 +41,12 @@ GSDevice::GSDevice() m_msaa_desc.Quality = 0; } -GSDevice::~GSDevice() +GSDevice::~GSDevice() { for_each(m_pool.begin(), m_pool.end(), delete_object()); - + delete m_backbuffer; - delete m_merge; + delete m_merge; delete m_weavebob; delete m_blend; delete m_1x1; @@ -62,11 +62,11 @@ bool GSDevice::Create(GSWnd* wnd) bool GSDevice::Reset(int w, int h) { for_each(m_pool.begin(), m_pool.end(), delete_object()); - + m_pool.clear(); - + delete m_backbuffer; - delete m_merge; + delete m_merge; delete m_weavebob; delete m_blend; delete m_1x1; @@ -197,7 +197,7 @@ void GSDevice::Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVec // KH:COM crashes at startup when booting *through the bios* due to m_merge being NULL. // (texture appears to be non-null, and is being re-created at a size around like 1700x340, // dunno if that's relevant) -- air - + if(m_merge) { GSTexture* tex[2] = {NULL, NULL}; diff --git a/plugins/GSdx/GSDevice.h b/plugins/GSdx/GSDevice.h index 7a7b6f7f0d..596c011fa3 100644 --- a/plugins/GSdx/GSDevice.h +++ b/plugins/GSdx/GSDevice.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -132,7 +132,7 @@ public: } T m; - + m.Name = "SHADER_MODEL"; m.Definition = m_shader.model.c_str(); diff --git a/plugins/GSdx/GSDevice11.cpp b/plugins/GSdx/GSDevice11.cpp index 02777cd8c0..f7716dfc10 100644 --- a/plugins/GSdx/GSDevice11.cpp +++ b/plugins/GSdx/GSDevice11.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -84,7 +84,7 @@ bool GSDevice11::Create(GSWnd* wnd) flags |= D3D11_CREATE_DEVICE_DEBUG; #endif - D3D_FEATURE_LEVEL levels[] = + D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, @@ -104,7 +104,7 @@ bool GSDevice11::Create(GSWnd* wnd) } D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS options; - + hr = m_dev->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &options, sizeof(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS)); // msaa @@ -222,7 +222,7 @@ bool GSDevice11::Create(GSWnd* wnd) sd.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sd.MaxLOD = FLT_MAX; - sd.MaxAnisotropy = 16; + sd.MaxAnisotropy = 16; sd.ComparisonFunc = D3D11_COMPARISON_NEVER; hr = m_dev->CreateSamplerState(&sd, &m_convert.ln); @@ -238,7 +238,7 @@ bool GSDevice11::Create(GSWnd* wnd) // CreateTextureFX(); - + // memset(&dsd, 0, sizeof(dsd)); @@ -286,7 +286,7 @@ bool GSDevice11::Reset(int w, int h) memset(&scd, 0, sizeof(scd)); m_swapchain->GetDesc(&scd); m_swapchain->ResizeBuffers(scd.BufferCount, w, h, scd.BufferDesc.Format, 0); - + CComPtr backbuffer; if(FAILED(m_swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backbuffer))) { @@ -302,7 +302,7 @@ bool GSDevice11::Reset(int w, int h) void GSDevice11::SetExclusive(bool isExcl) { if(!m_swapchain) return; - + // TODO : Support for alternative display modes, by finishing this code below: // Video mode info should be pulled form config/ini. @@ -312,11 +312,11 @@ void GSDevice11::SetExclusive(bool isExcl) m_swapchain->ResizeTarget(&desc); */ - + HRESULT hr = m_swapchain->SetFullscreenState( isExcl, NULL ); if(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) fprintf(stderr, "(GSdx10) SetExclusive(%s) failed; request unavailable.", isExcl ? "true" : "false"); -} +} void GSDevice11::Flip() { @@ -367,7 +367,7 @@ GSTexture* GSDevice11::Create(int type, int w, int h, bool msaa, int format) desc.SampleDesc.Quality = 0; desc.Usage = D3D11_USAGE_DEFAULT; - if(msaa) + if(msaa) { desc.SampleDesc = m_msaa_desc; } @@ -636,7 +636,7 @@ void GSDevice11::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1 (&iaV PSSetShader(m_convert.ps[datm ? 2 : 3], NULL); PSSetSamplerState(m_convert.pt, NULL); - // + // DrawPrimitive(); @@ -676,7 +676,7 @@ void GSDevice11::IASetVertexBuffer(const void* vertices, size_t stride, size_t c bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; HRESULT hr; - + hr = m_dev->CreateBuffer(&bd, NULL, &m_vb); if(FAILED(hr)) return; @@ -747,7 +747,7 @@ void GSDevice11::VSSetShader(ID3D11VertexShader* vs, ID3D11Buffer* vs_cb) m_ctx->VSSetShader(vs, NULL, 0); } - + if(m_state.vs_cb != vs_cb) { m_state.vs_cb = vs_cb; @@ -770,7 +770,7 @@ void GSDevice11::PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) { ID3D11ShaderResourceView* srv0 = NULL; ID3D11ShaderResourceView* srv1 = NULL; - + if(sr0) srv0 = *(GSTexture11*)sr0; if(sr1) srv1 = *(GSTexture11*)sr1; @@ -780,7 +780,7 @@ void GSDevice11::PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) m_state.ps_srv[1] = srv1; ID3D11ShaderResourceView* srvs[] = {srv0, srv1}; - + m_ctx->PSSetShaderResources(0, 2, srvs); } } @@ -793,7 +793,7 @@ void GSDevice11::PSSetShader(ID3D11PixelShader* ps, ID3D11Buffer* ps_cb) m_ctx->PSSetShader(ps, NULL, 0); } - + if(m_state.ps_cb != ps_cb) { m_state.ps_cb = ps_cb; @@ -862,7 +862,7 @@ void GSDevice11::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector D3D11_VIEWPORT vp; memset(&vp, 0, sizeof(vp)); - + vp.TopLeftX = 0; vp.TopLeftY = 0; vp.Width = rt->GetWidth(); @@ -894,7 +894,7 @@ HRESULT GSDevice11::CompileShader(uint32 id, const string& entry, D3D11_SHADER_M CComPtr shader, error; hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry.c_str(), m_shader.vs.c_str(), 0, 0, NULL, &shader, &error, NULL); - + if(error) { printf("%s\n", (const char*)error->GetBufferPointer()); @@ -933,7 +933,7 @@ HRESULT GSDevice11::CompileShader(uint32 id, const string& entry, D3D11_SHADER_M CComPtr shader, error; hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry.c_str(), m_shader.gs.c_str(), 0, 0, NULL, &shader, &error, NULL); - + if(error) { printf("%s\n", (const char*)error->GetBufferPointer()); @@ -965,7 +965,7 @@ HRESULT GSDevice11::CompileShader(uint32 id, const string& entry, D3D11_SHADER_M CComPtr shader, error; hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry.c_str(), m_shader.ps.c_str(), 0, 0, NULL, &shader, &error, NULL); - + if(error) { printf("%s\n", (const char*)error->GetBufferPointer()); diff --git a/plugins/GSdx/GSDevice11.h b/plugins/GSdx/GSDevice11.h index 057cacfe9e..e161c3e20a 100644 --- a/plugins/GSdx/GSDevice11.h +++ b/plugins/GSdx/GSDevice11.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -112,8 +112,8 @@ public: // TODO CComPtr m_ps_cb; hash_map > m_ps_ss; CComPtr m_palette_ss; - hash_map > m_om_dss; - hash_map > m_om_bs; + hash_map > m_om_dss; + hash_map > m_om_bs; VSConstantBuffer m_vs_cb_cache; PSConstantBuffer m_ps_cb_cache; diff --git a/plugins/GSdx/GSDevice9.cpp b/plugins/GSdx/GSDevice9.cpp index 5f73cb0119..4b1abb413c 100644 --- a/plugins/GSdx/GSDevice9.cpp +++ b/plugins/GSdx/GSDevice9.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -24,7 +24,7 @@ #include "GSDevice9.h" #include "resource.h" -GSDevice9::GSDevice9() +GSDevice9::GSDevice9() : m_lost(false) { m_rbswapped = true; @@ -41,7 +41,7 @@ GSDevice9::GSDevice9() GSDevice9::~GSDevice9() { for_each(m_mskfix.begin(), m_mskfix.end(), delete_second()); - + for_each(m_om_bs.begin(), m_om_bs.end(), delete_second()); for_each(m_om_dss.begin(), m_om_dss.end(), delete_second()); for_each(m_ps_ss.begin(), m_ps_ss.end(), delete_second()); @@ -62,7 +62,7 @@ bool GSDevice9::Create(GSWnd* wnd) // dd // Unreferenced - /*CComPtr dd; + /*CComPtr dd; hr = DirectDrawCreateEx(0, (void**)&dd, IID_IDirectDraw7, 0); @@ -70,7 +70,7 @@ bool GSDevice9::Create(GSWnd* wnd) memset(&m_ddcaps, 0, sizeof(m_ddcaps)); - m_ddcaps.dwSize = sizeof(DDCAPS); + m_ddcaps.dwSize = sizeof(DDCAPS); hr = dd->GetCaps(&m_ddcaps, NULL); @@ -149,7 +149,7 @@ bool GSDevice9::Create(GSWnd* wnd) // - if(!Reset(1, 1)) + if(!Reset(1, 1)) { return false; } @@ -337,7 +337,7 @@ bool GSDevice9::Reset(int w, int h) { flags |= D3DCREATE_PUREDEVICE; } - + hr = m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, (HWND)m_wnd->GetHandle(), flags, &m_pp, &m_dev); if(FAILED(hr)) return false; @@ -797,7 +797,7 @@ void GSDevice9::IASetVertexBuffer(const void* vertices, size_t stride, size_t co if(m_vb == NULL) { HRESULT hr; - + hr = m_dev->CreateVertexBuffer(m_vertices.limit * stride, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &m_vb, NULL); if(FAILED(hr)) return; @@ -865,7 +865,7 @@ void GSDevice9::VSSetShader(IDirect3DVertexShader9* vs, const float* vs_cb, int if(vs_cb && vs_cb_len > 0) { int size = vs_cb_len * sizeof(float) * 4; - + if(m_state.vs_cb_len != vs_cb_len || m_state.vs_cb == NULL || memcmp(m_state.vs_cb, vs_cb, size)) { if(m_state.vs_cb == NULL || m_state.vs_cb_len < vs_cb_len) @@ -888,7 +888,7 @@ void GSDevice9::PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) { IDirect3DTexture9* srv0 = NULL; IDirect3DTexture9* srv1 = NULL; - + if(sr0) srv0 = *(GSTexture9*)sr0; if(sr1) srv1 = *(GSTexture9*)sr1; @@ -915,11 +915,11 @@ void GSDevice9::PSSetShader(IDirect3DPixelShader9* ps, const float* ps_cb, int p m_dev->SetPixelShader(ps); } - + if(ps_cb && ps_cb_len > 0) { int size = ps_cb_len * sizeof(float) * 4; - + if(m_state.ps_cb_len != ps_cb_len || m_state.ps_cb == NULL || memcmp(m_state.ps_cb, ps_cb, size)) { if(m_state.ps_cb == NULL || m_state.ps_cb_len < ps_cb_len) @@ -971,7 +971,7 @@ void GSDevice9::OMSetDepthStencilState(Direct3DDepthStencilState9* dss) m_dev->SetRenderState(D3DRS_ZENABLE, dss->DepthEnable); m_dev->SetRenderState(D3DRS_ZWRITEENABLE, dss->DepthWriteMask); - + if(dss->DepthEnable) { m_dev->SetRenderState(D3DRS_ZFUNC, dss->DepthFunc); @@ -982,7 +982,7 @@ void GSDevice9::OMSetDepthStencilState(Direct3DDepthStencilState9* dss) if(dss->StencilEnable) { m_dev->SetRenderState(D3DRS_STENCILMASK, dss->StencilReadMask); - m_dev->SetRenderState(D3DRS_STENCILWRITEMASK, dss->StencilWriteMask); + m_dev->SetRenderState(D3DRS_STENCILWRITEMASK, dss->StencilWriteMask); m_dev->SetRenderState(D3DRS_STENCILFUNC, dss->StencilFunc); m_dev->SetRenderState(D3DRS_STENCILPASS, dss->StencilPassOp); m_dev->SetRenderState(D3DRS_STENCILFAIL, dss->StencilFailOp); diff --git a/plugins/GSdx/GSDevice9.h b/plugins/GSdx/GSDevice9.h index 62d26d136e..0ba8278d49 100644 --- a/plugins/GSdx/GSDevice9.h +++ b/plugins/GSdx/GSDevice9.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -144,12 +144,12 @@ public: // TODO D3DXHANDLE m_vs_params; hash_map > m_ps; hash_map m_ps_ss; - hash_map m_om_dss; - hash_map m_om_bs; + hash_map m_om_dss; + hash_map m_om_bs; hash_map m_mskfix; GSTexture* CreateMskFix(uint32 size, uint32 msk, uint32 fix); - + public: GSDevice9(); virtual ~GSDevice9(); @@ -158,7 +158,7 @@ public: bool Reset(int w, int h); bool IsLost(bool update); void Flip(); - + void SetVsync(bool enable); void BeginScene(); diff --git a/plugins/GSdx/GSDeviceDX.h b/plugins/GSdx/GSDeviceDX.h index 2b80ff7af0..93e1654be8 100644 --- a/plugins/GSdx/GSDeviceDX.h +++ b/plugins/GSdx/GSDeviceDX.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -36,7 +36,7 @@ public: GSVector4 VertexOffset; GSVector4 TextureScale; - struct VSConstantBuffer() + struct VSConstantBuffer() { VertexScale = GSVector4::zero(); VertexOffset = GSVector4::zero(); @@ -94,7 +94,7 @@ public: GSVector4 MinF_TA; GSVector4i MskFix; - struct PSConstantBuffer() + struct PSConstantBuffer() { FogColor_AREF = GSVector4::zero(); HalfTexel = GSVector4::zero(); @@ -268,15 +268,15 @@ public: { return __super::Create( wnd ); } - + virtual bool Reset(int w, int h) { return __super::Reset( w, h ); } - + //virtual void Present(const GSVector4i& r, int shader); //virtual void Flip() {} - + virtual void SetupIA(const void* vertices, int count, int prim) = 0; virtual void SetupVS(VSSelector sel, const VSConstantBuffer* cb) = 0; virtual void SetupGS(GSSelector sel) = 0; diff --git a/plugins/GSdx/GSDeviceNull.cpp b/plugins/GSdx/GSDeviceNull.cpp index 061e5ca571..39c58877d1 100644 --- a/plugins/GSdx/GSDeviceNull.cpp +++ b/plugins/GSdx/GSDeviceNull.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSDeviceNull.h b/plugins/GSdx/GSDeviceNull.h index d360d4ac28..848e7c5adf 100644 --- a/plugins/GSdx/GSDeviceNull.h +++ b/plugins/GSdx/GSDeviceNull.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSDialog.cpp b/plugins/GSdx/GSDialog.cpp index 56ebc54051..51bd52d23a 100644 --- a/plugins/GSdx/GSDialog.cpp +++ b/plugins/GSdx/GSDialog.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -51,23 +51,23 @@ INT_PTR CALLBACK GSDialog::DialogProc(HWND hWnd, UINT message, WPARAM wParam, LP GSVector4i r; GetWindowRect(hWnd, r); - + int x = (mi.rcWork.left + mi.rcWork.right - r.width()) / 2; int y = (mi.rcWork.top + mi.rcWork.bottom - r.height()) / 2; SetWindowPos(hWnd, NULL, x, y, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); dlg->OnInit(); - + return true; } dlg = (GSDialog*)GetWindowLongPtr(hWnd, GWL_USERDATA); - + return dlg != NULL ? dlg->OnMessage(message, wParam, lParam) : FALSE; } -bool GSDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) +bool GSDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) { return message == WM_COMMAND ? OnCommand((HWND)lParam, LOWORD(wParam), HIWORD(wParam)) : false; } @@ -134,8 +134,8 @@ void GSDialog::ComboBoxInit(UINT id, const GSSetting* settings, int count, uint3 if(settings[i].id <= maxid) { string str = settings[i].name; - - if(settings[i].note != NULL) + + if(settings[i].note != NULL) { str = str + " (" + settings[i].note + ")"; } diff --git a/plugins/GSdx/GSDialog.h b/plugins/GSdx/GSDialog.h index e08447c51b..be52362fd7 100644 --- a/plugins/GSdx/GSDialog.h +++ b/plugins/GSdx/GSDialog.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -23,7 +23,7 @@ #include "GSSetting.h" -class GSDialog +class GSDialog { int m_id; diff --git a/plugins/GSdx/GSDirtyRect.cpp b/plugins/GSdx/GSDirtyRect.cpp index 422fad5f22..602ce1427d 100644 --- a/plugins/GSdx/GSDirtyRect.cpp +++ b/plugins/GSdx/GSDirtyRect.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -22,7 +22,7 @@ #include "StdAfx.h" #include "GSDirtyRect.h" -GSDirtyRect::GSDirtyRect() +GSDirtyRect::GSDirtyRect() : psm(PSM_PSMCT32) { left = top = right = bottom = 0; diff --git a/plugins/GSdx/GSDirtyRect.h b/plugins/GSdx/GSDirtyRect.h index e9b7699055..9b5878e6a9 100644 --- a/plugins/GSdx/GSDirtyRect.h +++ b/plugins/GSdx/GSDirtyRect.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -43,4 +43,4 @@ class GSDirtyRectList : public list public: GSDirtyRectList() {} GSVector4i GetDirtyRectAndClear(const GIFRegTEX0& TEX0, const GSVector2i& size); -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSDrawScanline.cpp b/plugins/GSdx/GSDrawScanline.cpp index 152e6bc156..4ba06ed100 100644 --- a/plugins/GSdx/GSDrawScanline.cpp +++ b/plugins/GSdx/GSDrawScanline.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -105,53 +105,53 @@ void GSDrawScanline::BeginDraw(const GSRasterizerData* data, Functions* f) switch(context->CLAMP.WMS) { - case CLAMP_REPEAT: + case CLAMP_REPEAT: m_env.t.min.u16[0] = tw - 1; m_env.t.max.u16[0] = 0; - m_env.t.mask.u32[0] = 0xffffffff; + m_env.t.mask.u32[0] = 0xffffffff; break; - case CLAMP_CLAMP: + case CLAMP_CLAMP: m_env.t.min.u16[0] = 0; m_env.t.max.u16[0] = tw - 1; - m_env.t.mask.u32[0] = 0; + m_env.t.mask.u32[0] = 0; break; - case CLAMP_REGION_CLAMP: + case CLAMP_REGION_CLAMP: m_env.t.min.u16[0] = std::min(context->CLAMP.MINU, tw - 1); m_env.t.max.u16[0] = std::min(context->CLAMP.MAXU, tw - 1); - m_env.t.mask.u32[0] = 0; + m_env.t.mask.u32[0] = 0; break; - case CLAMP_REGION_REPEAT: + case CLAMP_REGION_REPEAT: m_env.t.min.u16[0] = context->CLAMP.MINU; m_env.t.max.u16[0] = context->CLAMP.MAXU; - m_env.t.mask.u32[0] = 0xffffffff; + m_env.t.mask.u32[0] = 0xffffffff; break; - default: + default: __assume(0); } switch(context->CLAMP.WMT) { - case CLAMP_REPEAT: + case CLAMP_REPEAT: m_env.t.min.u16[4] = th - 1; m_env.t.max.u16[4] = 0; - m_env.t.mask.u32[2] = 0xffffffff; + m_env.t.mask.u32[2] = 0xffffffff; break; - case CLAMP_CLAMP: + case CLAMP_CLAMP: m_env.t.min.u16[4] = 0; m_env.t.max.u16[4] = th - 1; - m_env.t.mask.u32[2] = 0; + m_env.t.mask.u32[2] = 0; break; - case CLAMP_REGION_CLAMP: + case CLAMP_REGION_CLAMP: m_env.t.min.u16[4] = std::min(context->CLAMP.MINV, th - 1); m_env.t.max.u16[4] = std::min(context->CLAMP.MAXV, th - 1); // ffx anima summon scene, when the anchor appears (th = 256, maxv > 256) - m_env.t.mask.u32[2] = 0; + m_env.t.mask.u32[2] = 0; break; - case CLAMP_REGION_REPEAT: + case CLAMP_REGION_REPEAT: m_env.t.min.u16[4] = context->CLAMP.MINV; m_env.t.max.u16[4] = context->CLAMP.MAXV; - m_env.t.mask.u32[2] = 0xffffffff; + m_env.t.mask.u32[2] = 0xffffffff; break; - default: + default: __assume(0); } @@ -254,7 +254,7 @@ void GSDrawScanline::DrawSolidRect(const GSVector4i& r, const GSVertexSW& v) { c |= 0x80000000; } - + if(m_sel.fpsm != 2) { if(m == 0) @@ -282,7 +282,7 @@ void GSDrawScanline::DrawSolidRect(const GSVector4i& r, const GSVertexSW& v) } } -template +template void GSDrawScanline::DrawSolidRectT(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, uint32 c, uint32 m) { if(m == 0xffffffff) return; @@ -319,7 +319,7 @@ void GSDrawScanline::DrawSolidRectT(const int* RESTRICT row, const int* RESTRICT } } -template +template void GSDrawScanline::FillRect(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, uint32 c, uint32 m) { if(r.x >= r.z) return; @@ -335,7 +335,7 @@ void GSDrawScanline::FillRect(const int* RESTRICT row, const int* RESTRICT col, } } -template +template void GSDrawScanline::FillBlock(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, const GSVector4i& c, const GSVector4i& m) { if(r.x >= r.z) return; diff --git a/plugins/GSdx/GSDrawScanline.h b/plugins/GSdx/GSDrawScanline.h index 60f2bf708d..27e6f4819c 100644 --- a/plugins/GSdx/GSDrawScanline.h +++ b/plugins/GSdx/GSDrawScanline.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -58,13 +58,13 @@ class GSDrawScanline : public IDrawScanline void DrawSolidRect(const GSVector4i& r, const GSVertexSW& v); - template + template void DrawSolidRectT(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, uint32 c, uint32 m); - template + template __forceinline void FillRect(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, uint32 c, uint32 m); - template + template __forceinline void FillBlock(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, const GSVector4i& c, const GSVector4i& m); protected: diff --git a/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp b/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp index ac0aa8e821..9412299940 100644 --- a/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp +++ b/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -256,7 +256,7 @@ L("loop"); WriteFrame(params); L("step"); - + // if(steps <= 0) break; if(!m_sel.edge) @@ -402,7 +402,7 @@ void GSDrawScanlineCodeGenerator::Init(int params) pshufd(xmm3, xmm4, _MM_SHUFFLE(1, 1, 1, 1)); paddd(xmm2, xmmword[edx + 16 * 7]); - + if(!m_sel.sprite) { paddd(xmm3, xmmword[edx + 16 * 8]); @@ -424,7 +424,7 @@ void GSDrawScanlineCodeGenerator::Init(int params) } else { - // s = vt.xxxx() + m_env.d[skip].s; + // s = vt.xxxx() + m_env.d[skip].s; // t = vt.yyyy() + m_env.d[skip].t; // q = vt.zzzz() + m_env.d[skip].q; @@ -625,7 +625,7 @@ void GSDrawScanlineCodeGenerator::Step() void GSDrawScanlineCodeGenerator::TestZ(const Xmm& temp1, const Xmm& temp2) { - if(!m_sel.zb) + if(!m_sel.zb) { return; } @@ -706,7 +706,7 @@ void GSDrawScanlineCodeGenerator::TestZ(const Xmm& temp1, const Xmm& temp2) switch(m_sel.ztst) { - case ZTST_GEQUAL: + case ZTST_GEQUAL: // test |= zso < zdo; // ~(zso >= zdo) pcmpgtd(xmm1, xmm0); por(xmm7, xmm1); @@ -818,7 +818,7 @@ void GSDrawScanlineCodeGenerator::SampleTexture() pxor(xmm0, xmm0); movd(xmm1, ptr[&m_env.tw]); - + movdqa(xmm4, xmm2); punpckhwd(xmm2, xmm0); punpcklwd(xmm4, xmm0); @@ -1048,14 +1048,14 @@ void GSDrawScanlineCodeGenerator::Wrap(const Xmm& uv) movdqa(xmm5, xmmword[&m_env.t.max]); // GSVector4i clamp = t.sat_i16(m_env.t.min, m_env.t.max); - + pmaxsw(uv, xmm4); pminsw(uv, xmm5); // GSVector4i repeat = (t & m_env.t.min) | m_env.t.max; pand(xmm1, xmm4); - + if(region) { por(xmm1, xmm5); @@ -1125,7 +1125,7 @@ void GSDrawScanlineCodeGenerator::Wrap(const Xmm& uv0, const Xmm& uv1) movdqa(xmm5, xmmword[&m_env.t.max]); // GSVector4i clamp = t.sat_i16(m_env.t.min, m_env.t.max); - + pmaxsw(uv0, xmm4); pmaxsw(uv1, xmm4); pminsw(uv0, xmm5); @@ -1185,11 +1185,11 @@ void GSDrawScanlineCodeGenerator::AlphaTFX() // gat = gat.modulate16<1>(ga).clamp8(); modulate16<1>(xmm6, xmm4); - + clamp16(xmm6, xmm3); // if(!tcc) gat = gat.mix16(ga.srl16(7)); - + if(!m_sel.tcc) { psrlw(xmm4, 7); @@ -1216,7 +1216,7 @@ void GSDrawScanlineCodeGenerator::AlphaTFX() break; - case TFX_HIGHLIGHT: + case TFX_HIGHLIGHT: // GSVector4i ga = iip ? gaf : m_env.c.ga; @@ -1254,7 +1254,7 @@ void GSDrawScanlineCodeGenerator::AlphaTFX() break; - case TFX_NONE: + case TFX_NONE: // gat = iip ? ga.srl16(7) : ga; @@ -1263,7 +1263,7 @@ void GSDrawScanlineCodeGenerator::AlphaTFX() psrlw(xmm6, 7); } - break; + break; } if(m_sel.aa1) @@ -1359,7 +1359,7 @@ void GSDrawScanlineCodeGenerator::TestAlpha() pxor(xmm1, xmm0); break; - case ATST_GEQUAL: + case ATST_GEQUAL: case ATST_GREATER: // t = (ga >> 16) < m_env.aref; movdqa(xmm0, xmm6); @@ -1449,7 +1449,7 @@ void GSDrawScanlineCodeGenerator::ColorTFX() pshuflw(xmm2, xmm2, _MM_SHUFFLE(3, 3, 1, 1)); pshufhw(xmm2, xmm2, _MM_SHUFFLE(3, 3, 1, 1)); psrlw(xmm2, 7); - + paddw(xmm6, xmm2); clamp16(xmm6, xmm0); @@ -1468,7 +1468,7 @@ void GSDrawScanlineCodeGenerator::ColorTFX() break; - case TFX_NONE: + case TFX_NONE: // rbt = iip ? rb.srl16(7) : rb; @@ -1477,7 +1477,7 @@ void GSDrawScanlineCodeGenerator::ColorTFX() psrlw(xmm5, 7); } - break; + break; } } @@ -1617,9 +1617,9 @@ void GSDrawScanlineCodeGenerator::AlphaBlend() psllw(xmm0, 8); psrlw(xmm0, 8); psrlw(xmm1, 8); - + break; - + case 2: // c[2] = ((fd & 0x7c00) << 9) | ((fd & 0x001f) << 3); @@ -1633,7 +1633,7 @@ void GSDrawScanlineCodeGenerator::AlphaBlend() psrld(xmm7, 27); // 0x0000001f pand(xmm0, xmm7); pslld(xmm0, 3); - + pslld(xmm7, 10); // 0x00007c00 pand(xmm4, xmm7); pslld(xmm4, 9); @@ -1692,15 +1692,15 @@ void GSDrawScanlineCodeGenerator::AlphaBlend() switch(m_sel.abc) { - case 0: - case 1: + case 0: + case 1: movdqa(xmm7, m_sel.abc ? xmm1 : xmm6); pshuflw(xmm7, xmm7, _MM_SHUFFLE(3, 3, 1, 1)); pshufhw(xmm7, xmm7, _MM_SHUFFLE(3, 3, 1, 1)); psllw(xmm7, 7); break; - case 2: - movdqa(xmm7, xmmword[&m_env.afix]); + case 2: + movdqa(xmm7, xmmword[&m_env.afix]); break; } @@ -1931,7 +1931,7 @@ void GSDrawScanlineCodeGenerator::WritePixel(const Xmm& src, const Xmm& temp, co { if(fast) { - // if(fzm & 0x0f) GSVector4i::storel(&vm16[addr + 0], fs); + // if(fzm & 0x0f) GSVector4i::storel(&vm16[addr + 0], fs); // if(fzm & 0xf0) GSVector4i::storeh(&vm16[addr + 8], fs); test(mask, 0x0f); @@ -1946,9 +1946,9 @@ void GSDrawScanlineCodeGenerator::WritePixel(const Xmm& src, const Xmm& temp, co } else { - // if(fzm & 0x03) WritePixel(fpsm, &vm16[addr + 0], fs.extract32<0>()); + // if(fzm & 0x03) WritePixel(fpsm, &vm16[addr + 0], fs.extract32<0>()); // if(fzm & 0x0c) WritePixel(fpsm, &vm16[addr + 2], fs.extract32<1>()); - // if(fzm & 0x30) WritePixel(fpsm, &vm16[addr + 8], fs.extract32<2>()); + // if(fzm & 0x30) WritePixel(fpsm, &vm16[addr + 8], fs.extract32<2>()); // if(fzm & 0xc0) WritePixel(fpsm, &vm16[addr + 10], fs.extract32<3>()); test(mask, 0x03); @@ -2068,7 +2068,7 @@ void GSDrawScanlineCodeGenerator::ReadTexel(const Xmm& dst, const Xmm& addr, uin else pinsrd(dst, src, i); } -template +template void GSDrawScanlineCodeGenerator::modulate16(const Xmm& a, const Operand& f) { if(shift == 0 && m_cpu.has(util::Cpu::tSSSE3)) @@ -2082,7 +2082,7 @@ void GSDrawScanlineCodeGenerator::modulate16(const Xmm& a, const Operand& f) } } -template +template void GSDrawScanlineCodeGenerator::lerp16(const Xmm& a, const Xmm& b, const Xmm& f) { psubw(a, b); @@ -2168,7 +2168,7 @@ void GSDrawScanlineCodeGenerator::blendr(const Xmm& b, const Xmm& a, const Xmm& por(b, mask); } -const GSVector4i GSDrawScanlineCodeGenerator::m_test[8] = +const GSVector4i GSDrawScanlineCodeGenerator::m_test[8] = { GSVector4i::zero(), GSVector4i(0xffffffff, 0x00000000, 0x00000000, 0x00000000), diff --git a/plugins/GSdx/GSDrawScanlineCodeGenerator.h b/plugins/GSdx/GSDrawScanlineCodeGenerator.h index fdf6755bf6..76358a8358 100644 --- a/plugins/GSdx/GSDrawScanlineCodeGenerator.h +++ b/plugins/GSdx/GSDrawScanlineCodeGenerator.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -74,4 +74,4 @@ class GSDrawScanlineCodeGenerator : public CodeGenerator public: GSDrawScanlineCodeGenerator(GSScanlineEnvironment& env, uint64 key, void* ptr, size_t maxsize); -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSDrawingContext.h b/plugins/GSdx/GSDrawingContext.h index 0129292ff8..66efc2f3bb 100644 --- a/plugins/GSdx/GSDrawingContext.h +++ b/plugins/GSdx/GSDrawingContext.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -51,7 +51,7 @@ public: GSVector4 ex; } scissor; - struct + struct { GSOffset* fb; GSOffset* zb; @@ -122,4 +122,4 @@ public: } }; -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/plugins/GSdx/GSDrawingEnvironment.h b/plugins/GSdx/GSDrawingEnvironment.h index 63b28e8090..982df9eace 100644 --- a/plugins/GSdx/GSDrawingEnvironment.h +++ b/plugins/GSdx/GSDrawingEnvironment.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -45,7 +45,7 @@ public: GIFRegTRXREG TRXREG; GSDrawingContext CTXT[2]; - GSDrawingEnvironment() + GSDrawingEnvironment() { } diff --git a/plugins/GSdx/GSDump.cpp b/plugins/GSdx/GSDump.cpp index 4082e7823f..04a09e595d 100644 --- a/plugins/GSdx/GSDump.cpp +++ b/plugins/GSdx/GSDump.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -151,7 +151,7 @@ void GSDump::Object(GSVertexSW* vertices, int count, GS_PRIM_CLASS primclass) m_objects++; break; - + case GS_SPRITE_CLASS: // TODO diff --git a/plugins/GSdx/GSDump.h b/plugins/GSdx/GSDump.h index 5cc2c88104..f90b4c7833 100644 --- a/plugins/GSdx/GSDump.h +++ b/plugins/GSdx/GSDump.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -24,7 +24,7 @@ #include "GS.h" #include "GSVertexSW.h" -/* +/* Dump file format: - [crc/4] [state size/4] [state data/size] [PMODE/0x2000] [id/1] [data/?] .. [id/1] [data/?] diff --git a/plugins/GSdx/GSFunctionMap.cpp b/plugins/GSdx/GSFunctionMap.cpp index 48e77b465e..80082d56b3 100644 --- a/plugins/GSdx/GSFunctionMap.cpp +++ b/plugins/GSdx/GSFunctionMap.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSFunctionMap.h b/plugins/GSdx/GSFunctionMap.h index 909b664ea8..1c34390d3c 100644 --- a/plugins/GSdx/GSFunctionMap.h +++ b/plugins/GSdx/GSFunctionMap.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -29,12 +29,12 @@ struct GSRasterizerStats int64 ticks; int prims, pixels; - GSRasterizerStats() + GSRasterizerStats() { Reset(); } - void Reset() + void Reset() { ticks = 0; pixels = prims = 0; @@ -59,8 +59,8 @@ protected: virtual VALUE GetDefaultFunction(KEY key) = 0; public: - GSFunctionMap() - : m_active(NULL) + GSFunctionMap() + : m_active(NULL) { } @@ -121,7 +121,7 @@ public: for(hash_map::iterator i = m_map_active.begin(); i != m_map_active.end(); i++) { ActivePtr* p = i->second; - + if(p->frames) { ttpf += p->ticks / p->frames; @@ -139,11 +139,11 @@ public: int64 tpf = p->frames > 0 ? p->ticks / p->frames : 0; int64 ppf = p->frames > 0 ? p->pixels / p->frames : 0; - printf("[%012I64x]%c %6.2f%% | %5.2f%% | f %4I64d | p %10I64d | tpp %4I64d | tpf %9I64d | ppf %7I64d\n", + printf("[%012I64x]%c %6.2f%% | %5.2f%% | f %4I64d | p %10I64d | tpp %4I64d | tpf %9I64d | ppf %7I64d\n", (uint64)key, m_map.find(key) == m_map.end() ? '*' : ' ', - (float)(tpf * 10000 / 50000000) / 100, - (float)(tpf * 10000 / ttpf) / 100, - p->frames, p->pixels, + (float)(tpf * 10000 / 50000000) / 100, + (float)(tpf * 10000 / ttpf) / 100, + p->frames, p->pixels, tpp, tpf, ppf); } } diff --git a/plugins/GSdx/GSLocalMemory.cpp b/plugins/GSdx/GSLocalMemory.cpp index dbfd5908e4..9ff7a2fde1 100644 --- a/plugins/GSdx/GSLocalMemory.cpp +++ b/plugins/GSdx/GSLocalMemory.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,24 +6,24 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * - * Special Notes: + * Special Notes: * * Based on Page.c from GSSoft * Copyright (C) 2002-2004 GSsoft Team * */ - + #include "StdAfx.h" #include "GSLocalMemory.h" @@ -95,7 +95,7 @@ GSLocalMemory::GSLocalMemory() pageOffset32Z[bp][y][x] = PixelAddressOrg32Z(x, y, bp, 0); } - for(int y = 0; y < 64; y++) for(int x = 0; x < 64; x++) + for(int y = 0; y < 64; y++) for(int x = 0; x < 64; x++) { pageOffset16[bp][y][x] = PixelAddressOrg16(x, y, bp, 0); pageOffset16S[bp][y][x] = PixelAddressOrg16S(x, y, bp, 0); @@ -620,7 +620,7 @@ void GSLocalMemory::WriteImageLeftRight(int l, int r, int y, int h, uint8* src, case PSM_PSMZ16S: WritePixel16SZ(x, y, *(uint16*)&src[x * 2], bp, bw); break; // TODO default: __assume(0); - } + } } } } @@ -664,7 +664,7 @@ void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, uint8* src, switch(psm) { case PSM_PSMCT32: - case PSM_PSMZ32: + case PSM_PSMZ32: ReadColumn32(y, dst, buff, 32); memcpy(&buff[32], &src[x * 4], 32); WriteColumn32(y, dst, buff, 32); @@ -677,18 +677,18 @@ void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, uint8* src, memcpy(&buff[32], &src[x * 2], 32); WriteColumn16(y, dst, buff, 32); break; - case PSM_PSMT8: + case PSM_PSMT8: ReadColumn8(y, dst, buff, 16); for(int i = 0, j = y2; i < h2; i++, j++) memcpy(&buff[j * 16], &src[i * srcpitch + x], 16); WriteColumn8(y, dst, buff, 16); break; - case PSM_PSMT4: + case PSM_PSMT4: ReadColumn4(y, dst, buff, 16); for(int i = 0, j = y2; i < h2; i++, j++) memcpy(&buff[j * 16], &src[i * srcpitch + (x >> 1)], 16); WriteColumn4(y, dst, buff, 16); break; // TODO - default: + default: __assume(0); } } @@ -745,7 +745,7 @@ void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, uint8* src, switch(psm) { case PSM_PSMCT32: - case PSM_PSMZ32: + case PSM_PSMZ32: ReadColumn32(y, dst, buff, 32); memcpy(&buff[0], &src[x * 4], 32); WriteColumn32(y, dst, buff, 32); @@ -758,18 +758,18 @@ void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, uint8* src, memcpy(&buff[0], &src[x * 2], 32); WriteColumn16(y, dst, buff, 32); break; - case PSM_PSMT8: + case PSM_PSMT8: ReadColumn8(y, dst, buff, 16); for(int i = 0; i < h; i++) memcpy(&buff[i * 16], &src[i * srcpitch + x], 16); WriteColumn8(y, dst, buff, 16); break; - case PSM_PSMT4: + case PSM_PSMT4: ReadColumn4(y, dst, buff, 16); for(int i = 0; i < h; i++) memcpy(&buff[i * 16], &src[i * srcpitch + (x >> 1)], 16); WriteColumn4(y, dst, buff, 16); break; // TODO - default: + default: __assume(0); } } @@ -786,7 +786,7 @@ void GSLocalMemory::WriteImage(int& tx, int& ty, uint8* src, int len, GIFRegBITB // finish the incomplete row first - if(tx != l) + if(tx != l) { int n = min(len, (r - tx) * trbpp >> 3); WriteImageX(tx, ty, src, n, BITBLTBUF, TRXPOS, TRXREG); @@ -1282,9 +1282,9 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB for(; len > 0 && x < ex; len--, x++, pb += 3) { uint32 c = ReadPixel32(addr + offset[x]); - - pb[0] = ((uint8*)&c)[0]; - pb[1] = ((uint8*)&c)[1]; + + pb[0] = ((uint8*)&c)[0]; + pb[1] = ((uint8*)&c)[1]; pb[2] = ((uint8*)&c)[2]; } @@ -1382,7 +1382,7 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB } break; - + case PSM_PSMT4HH: while(len > 0) @@ -1696,8 +1696,8 @@ void GSLocalMemory::ReadTexture(const GSOffset* RESTRICT o, const GSVector4i& r, readTexel rt = psm.rt; readTexture rtx = psm.rtx; - if(r.width() < psm.bs.x || r.height() < psm.bs.y - || (r.left & (psm.bs.x - 1)) || (r.top & (psm.bs.y - 1)) + if(r.width() < psm.bs.x || r.height() < psm.bs.y + || (r.left & (psm.bs.x - 1)) || (r.top & (psm.bs.y - 1)) || (r.right & (psm.bs.x - 1)) || (r.bottom & (psm.bs.y - 1))) { GIFRegTEX0 TEX0; diff --git a/plugins/GSdx/GSLocalMemory.h b/plugins/GSdx/GSLocalMemory.h index 0c475a92c2..1a67dd9c6d 100644 --- a/plugins/GSdx/GSLocalMemory.h +++ b/plugins/GSdx/GSLocalMemory.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -72,7 +72,7 @@ public: typedef void (GSLocalMemory::*readTexture)(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA); typedef void (GSLocalMemory::*readTextureBlock)(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const; - typedef union + typedef union { struct { @@ -88,7 +88,7 @@ public: readImage ri; readTexture rtx, rtxP; readTextureBlock rtxb, rtxbP; - uint16 bpp, trbpp, pal, fmt; + uint16 bpp, trbpp, pal, fmt; GSVector2i bs, pgs; int* rowOffset[8]; short* blockOffset; @@ -295,21 +295,21 @@ public: static __forceinline uint32 PixelAddress32(int x, int y, uint32 bp, uint32 bw) { - uint32 page = (bp >> 5) + (y >> 5) * bw + (x >> 6); + uint32 page = (bp >> 5) + (y >> 5) * bw + (x >> 6); uint32 word = (page << 11) + pageOffset32[bp & 0x1f][y & 0x1f][x & 0x3f]; return word; } static __forceinline uint32 PixelAddress16(int x, int y, uint32 bp, uint32 bw) { - uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6); + uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6); uint32 word = (page << 12) + pageOffset16[bp & 0x1f][y & 0x3f][x & 0x3f]; return word; } static __forceinline uint32 PixelAddress16S(int x, int y, uint32 bp, uint32 bw) { - uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6); + uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6); uint32 word = (page << 12) + pageOffset16S[bp & 0x1f][y & 0x3f][x & 0x3f]; return word; } @@ -317,7 +317,7 @@ public: static __forceinline uint32 PixelAddress8(int x, int y, uint32 bp, uint32 bw) { ASSERT((bw & 1) == 0); - uint32 page = (bp >> 5) + (y >> 6) * (bw >> 1) + (x >> 7); + uint32 page = (bp >> 5) + (y >> 6) * (bw >> 1) + (x >> 7); uint32 word = (page << 13) + pageOffset8[bp & 0x1f][y & 0x3f][x & 0x7f]; return word; } @@ -332,21 +332,21 @@ public: static __forceinline uint32 PixelAddress32Z(int x, int y, uint32 bp, uint32 bw) { - uint32 page = (bp >> 5) + (y >> 5) * bw + (x >> 6); + uint32 page = (bp >> 5) + (y >> 5) * bw + (x >> 6); uint32 word = (page << 11) + pageOffset32Z[bp & 0x1f][y & 0x1f][x & 0x3f]; return word; } static __forceinline uint32 PixelAddress16Z(int x, int y, uint32 bp, uint32 bw) { - uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6); + uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6); uint32 word = (page << 12) + pageOffset16Z[bp & 0x1f][y & 0x3f][x & 0x3f]; return word; } static __forceinline uint32 PixelAddress16SZ(int x, int y, uint32 bp, uint32 bw) { - uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6); + uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6); uint32 word = (page << 12) + pageOffset16SZ[bp & 0x1f][y & 0x3f][x & 0x3f]; return word; } @@ -358,47 +358,47 @@ public: return m_vm32[addr]; } - __forceinline uint32 ReadPixel24(uint32 addr) const + __forceinline uint32 ReadPixel24(uint32 addr) const { return m_vm32[addr] & 0x00ffffff; } - __forceinline uint32 ReadPixel16(uint32 addr) const + __forceinline uint32 ReadPixel16(uint32 addr) const { return (uint32)m_vm16[addr]; } - __forceinline uint32 ReadPixel8(uint32 addr) const + __forceinline uint32 ReadPixel8(uint32 addr) const { return (uint32)m_vm8[addr]; } - __forceinline uint32 ReadPixel4(uint32 addr) const + __forceinline uint32 ReadPixel4(uint32 addr) const { return (m_vm8[addr >> 1] >> ((addr & 1) << 2)) & 0x0f; } - __forceinline uint32 ReadPixel8H(uint32 addr) const + __forceinline uint32 ReadPixel8H(uint32 addr) const { return m_vm32[addr] >> 24; } - __forceinline uint32 ReadPixel4HL(uint32 addr) const + __forceinline uint32 ReadPixel4HL(uint32 addr) const { return (m_vm32[addr] >> 24) & 0x0f; } - __forceinline uint32 ReadPixel4HH(uint32 addr) const + __forceinline uint32 ReadPixel4HH(uint32 addr) const { return (m_vm32[addr] >> 28) & 0x0f; } - __forceinline uint32 ReadFrame24(uint32 addr) const + __forceinline uint32 ReadFrame24(uint32 addr) const { return 0x80000000 | (m_vm32[addr] & 0xffffff); } - __forceinline uint32 ReadFrame16(uint32 addr) const + __forceinline uint32 ReadFrame16(uint32 addr) const { uint32 c = (uint32)m_vm16[addr]; @@ -500,17 +500,17 @@ public: return ReadFrame16(PixelAddress16SZ(x, y, bp, bw)); } - __forceinline void WritePixel32(uint32 addr, uint32 c) + __forceinline void WritePixel32(uint32 addr, uint32 c) { m_vm32[addr] = c; } - __forceinline void WritePixel24(uint32 addr, uint32 c) + __forceinline void WritePixel24(uint32 addr, uint32 c) { m_vm32[addr] = (m_vm32[addr] & 0xff000000) | (c & 0x00ffffff); } - __forceinline void WritePixel16(uint32 addr, uint32 c) + __forceinline void WritePixel16(uint32 addr, uint32 c) { m_vm16[addr] = (uint16)c; } @@ -520,9 +520,9 @@ public: m_vm8[addr] = (uint8)c; } - __forceinline void WritePixel4(uint32 addr, uint32 c) + __forceinline void WritePixel4(uint32 addr, uint32 c) { - int shift = (addr & 1) << 2; addr >>= 1; + int shift = (addr & 1) << 2; addr >>= 1; m_vm8[addr] = (uint8)((m_vm8[addr] & (0xf0 >> shift)) | ((c & 0x0f) << shift)); } @@ -532,7 +532,7 @@ public: m_vm32[addr] = (m_vm32[addr] & 0x00ffffff) | (c << 24); } - __forceinline void WritePixel4HL(uint32 addr, uint32 c) + __forceinline void WritePixel4HL(uint32 addr, uint32 c) { m_vm32[addr] = (m_vm32[addr] & 0xf0ffffff) | ((c & 0x0f) << 24); } @@ -542,7 +542,7 @@ public: m_vm32[addr] = (m_vm32[addr] & 0x0fffffff) | ((c & 0x0f) << 28); } - __forceinline void WriteFrame16(uint32 addr, uint32 c) + __forceinline void WriteFrame16(uint32 addr, uint32 c) { uint32 rb = c & 0x00f800f8; uint32 ga = c & 0x8000f800; @@ -635,7 +635,7 @@ public: WriteFrame16(PixelAddress16SZ(x, y, bp, bw), c); } - __forceinline void WritePixel32(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r) + __forceinline void WritePixel32(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r) { src -= r.left * sizeof(uint32); @@ -652,7 +652,7 @@ public: } } - __forceinline void WritePixel24(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r) + __forceinline void WritePixel24(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r) { src -= r.left * sizeof(uint32); @@ -669,7 +669,7 @@ public: } } - __forceinline void WritePixel16(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r) + __forceinline void WritePixel16(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r) { src -= r.left * sizeof(uint16); @@ -686,7 +686,7 @@ public: } } - __forceinline void WriteFrame16(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r) + __forceinline void WriteFrame16(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r) { src -= r.left * sizeof(uint32); @@ -706,32 +706,32 @@ public: } } - __forceinline uint32 ReadTexel32(uint32 addr, const GIFRegTEXA& TEXA) const + __forceinline uint32 ReadTexel32(uint32 addr, const GIFRegTEXA& TEXA) const { return m_vm32[addr]; } - __forceinline uint32 ReadTexel24(uint32 addr, const GIFRegTEXA& TEXA) const + __forceinline uint32 ReadTexel24(uint32 addr, const GIFRegTEXA& TEXA) const { return Expand24To32(m_vm32[addr], TEXA); } - __forceinline uint32 ReadTexel16(uint32 addr, const GIFRegTEXA& TEXA) const + __forceinline uint32 ReadTexel16(uint32 addr, const GIFRegTEXA& TEXA) const { return Expand16To32(m_vm16[addr], TEXA); } - __forceinline uint32 ReadTexel8(uint32 addr, const GIFRegTEXA& TEXA) const + __forceinline uint32 ReadTexel8(uint32 addr, const GIFRegTEXA& TEXA) const { return m_clut[ReadPixel8(addr)]; } - __forceinline uint32 ReadTexel4(uint32 addr, const GIFRegTEXA& TEXA) const + __forceinline uint32 ReadTexel4(uint32 addr, const GIFRegTEXA& TEXA) const { return m_clut[ReadPixel4(addr)]; } - __forceinline uint32 ReadTexel8H(uint32 addr, const GIFRegTEXA& TEXA) const + __forceinline uint32 ReadTexel8H(uint32 addr, const GIFRegTEXA& TEXA) const { return m_clut[ReadPixel8H(addr)]; } @@ -741,7 +741,7 @@ public: return m_clut[ReadPixel4HL(addr)]; } - __forceinline uint32 ReadTexel4HH(uint32 addr, const GIFRegTEXA& TEXA) const + __forceinline uint32 ReadTexel4HH(uint32 addr, const GIFRegTEXA& TEXA) const { return m_clut[ReadPixel4HH(addr)]; } @@ -894,4 +894,4 @@ public: HRESULT SaveBMP(const string& fn, uint32 bp, uint32 bw, uint32 psm, int w, int h); }; -#pragma warning(default: 4244) \ No newline at end of file +#pragma warning(default: 4244) diff --git a/plugins/GSdx/GSPerfMon.cpp b/plugins/GSdx/GSPerfMon.cpp index 82c044c361..16e5cf572d 100644 --- a/plugins/GSdx/GSPerfMon.cpp +++ b/plugins/GSdx/GSPerfMon.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -38,7 +38,7 @@ void GSPerfMon::Put(counter_t c, double val) if(c == Frame) { clock_t now = clock(); - + if(m_lastframe != 0) { m_counters[c] += now - m_lastframe; @@ -97,4 +97,4 @@ int GSPerfMon::CPU() m_total = 0; return percent; -} \ No newline at end of file +} diff --git a/plugins/GSdx/GSPerfMon.h b/plugins/GSdx/GSPerfMon.h index e6d97e338c..4df83c13f4 100644 --- a/plugins/GSdx/GSPerfMon.h +++ b/plugins/GSdx/GSPerfMon.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSRasterizer.cpp b/plugins/GSdx/GSRasterizer.cpp index 324555f17d..83df082cb7 100644 --- a/plugins/GSdx/GSRasterizer.cpp +++ b/plugins/GSdx/GSRasterizer.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -215,7 +215,7 @@ void GSRasterizer::DrawLine(const GSVertexSW* v, const GSVector4i& scissor) } } -static const int s_abc[8][4] = +static const int s_abc[8][4] = { {0, 1, 2, 0}, // c >= b >= a {1, 0, 2, 0}, // c >= a > b @@ -354,7 +354,7 @@ void GSRasterizer::DrawTriangleTop(GSVertexSW* v, const GSVector4i& scissor) void GSRasterizer::DrawTriangleBottom(GSVertexSW* v, const GSVector4i& scissor) { GSVertexSW longest; - + longest.p = v[1].p - v[0].p; int i = longest.p.upl(longest.p == GSVector4::zero()).mask(); @@ -486,7 +486,7 @@ void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW& l, const { do { - if(IsOneOfMyScanlines(top)) + if(IsOneOfMyScanlines(top)) { GSVector4 lr = l.p.xyxy(r).ceil(); @@ -575,7 +575,7 @@ void GSRasterizer::DrawSprite(const GSVertexSW* vertices, const GSVector4i& scis GSVector4i r(v[0].p.xyxy(v[1].p).ceil()); r = r.rintersect(scissor); - + if(r.rempty()) return; GSVertexSW scan = v[0]; @@ -614,7 +614,7 @@ void GSRasterizer::DrawSprite(const GSVertexSW* vertices, const GSVector4i& scis for(; r.top < r.bottom; r.top++, scan.t += dedge.t) { - if(IsOneOfMyScanlines(r.top)) + if(IsOneOfMyScanlines(r.top)) { m_dsf.ssl(r.right, r.left, r.top, scan); @@ -625,10 +625,10 @@ void GSRasterizer::DrawSprite(const GSVertexSW* vertices, const GSVector4i& scis void GSRasterizer::DrawEdge(const GSVertexSW& v0, const GSVertexSW& v1, const GSVertexSW& dv, const GSVector4i& scissor, int orientation, int side) { - // orientation: + // orientation: // - true: |dv.p.y| > |dv.p.x| - // - false |dv.p.x| > |dv.p.y| - // side: + // - false |dv.p.x| > |dv.p.y| + // side: // - true: top/left edge // - false: bottom/right edge @@ -696,7 +696,7 @@ void GSRasterizer::DrawEdge(const GSVertexSW& v0, const GSVertexSW& v1, const GS edge.t.u32[3] = (0x10000 - xf) & 0xffff; m_dsf.ssle(xi + 1, xi, top, edge); - + edge.t.u32[3] = 0; } } @@ -794,7 +794,7 @@ void GSRasterizer::DrawEdge(const GSVertexSW& v0, const GSVertexSW& v1, const GS edge.t.u32[3] = (0x10000 - yf) & 0xffff; m_dsf.ssle(left + 1, left, yi, edge); - + edge.t.u32[3] = 0; } } @@ -822,7 +822,7 @@ void GSRasterizer::DrawEdge(const GSVertexSW& v0, const GSVertexSW& v1, const GS edge.t.u32[3] = yf; m_dsf.ssle(left + 1, left, yi, edge); - + edge.t.u32[3] = 0; } } @@ -856,7 +856,7 @@ GSRasterizerMT::~GSRasterizerMT() m_exit = true; sem_post(&m_semaphore); sem_wait(&m_stopped); - + sem_destroy(&m_semaphore); sem_destroy(&m_stopped); } @@ -884,7 +884,7 @@ void GSRasterizerMT::ThreadProc() else sem_post(&m_finished); } - + sem_post(&m_stopped); } diff --git a/plugins/GSdx/GSRasterizer.h b/plugins/GSdx/GSRasterizer.h index 36dc693340..85fd582f2e 100644 --- a/plugins/GSdx/GSRasterizer.h +++ b/plugins/GSdx/GSRasterizer.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -153,7 +153,7 @@ public: push_back(new GSRasterizer(new DS(parent, 0), 0, threads)); m_syncstart = 0; - for(int i = 1; i < threads; i++) + for(int i = 1; i < threads; i++) { push_back(new GSRasterizerMT(new DS(parent, i), i, threads, m_finished, m_sync)); _interlockedbittestandset(&m_syncstart, i); diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 73d8393587..a079a5964b 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -34,7 +34,7 @@ GSRenderer::GSRenderer() m_filter = theApp.GetConfig("filter", 1); m_vsync = !!theApp.GetConfig("vsync", 0); m_nativeres = !!theApp.GetConfig("nativeres", 0); - + m_upscale_multiplier = theApp.GetConfig("upscale_multiplier", 1); if(m_nativeres) m_upscale_multiplier = 1; else if (m_upscale_multiplier > 6) m_upscale_multiplier = 1; @@ -107,7 +107,7 @@ bool GSRenderer::Merge(int field) baseline = min(dr[i].top, baseline); - // printf("[%d]: %d %d %d %d, %d %d %d %d\n", i, fr[i], dr[i]); + // printf("[%d]: %d %d %d %d, %d %d %d %d\n", i, fr[i], dr[i]); } } @@ -120,10 +120,10 @@ bool GSRenderer::Merge(int field) // // NOTE: probably the technique explained in graphtip.pdf (Antialiasing by Supersampling / 4. Reading Odd/Even Scan Lines Separately with the PCRTC then Blending) - bool samesrc = - en[0] && en[1] && - m_regs->DISP[0].DISPFB.FBP == m_regs->DISP[1].DISPFB.FBP && - m_regs->DISP[0].DISPFB.FBW == m_regs->DISP[1].DISPFB.FBW && + bool samesrc = + en[0] && en[1] && + m_regs->DISP[0].DISPFB.FBP == m_regs->DISP[1].DISPFB.FBP && + m_regs->DISP[0].DISPFB.FBW == m_regs->DISP[1].DISPFB.FBW && m_regs->DISP[0].DISPFB.PSM == m_regs->DISP[1].DISPFB.PSM; bool blurdetected = false; @@ -225,9 +225,9 @@ bool GSRenderer::Merge(int field) GSVector4 scale = GSVector4(tex[i]->GetScale()).xyxy(); src[i] = GSVector4(r) * scale / GSVector4(tex[i]->GetSize()).xyxy(); - + GSVector2 o(0, 0); - + if(dr[i].top - baseline >= 4) // 2? { o.y = tex[i]->GetScale().y * (dr[i].top - baseline); @@ -305,7 +305,7 @@ void GSRenderer::VSync(int field) ResetDevice(); } - // osd + // osd if((m_perfmon.GetFrame() & 0x1f) == 0 && m_wnd.IsManaged()) { @@ -316,9 +316,9 @@ void GSRenderer::VSync(int field) string s2 = m_regs->SMODE2.INT ? (string("Interlaced ") + (m_regs->SMODE2.FFMD ? "(frame)" : "(field)")) : "Progressive"; GSVector4i r = GetDisplayRect(); - + string s = format( - "%I64d | %d x %d | %.2f fps (%d%%) | %s - %s | %s | %d/%d/%d | %d%% CPU | %.2f | %.2f", + "%I64d | %d x %d | %.2f fps (%d%%) | %s - %s | %s | %d/%d/%d | %d%% CPU | %.2f | %.2f", m_perfmon.GetFrame(), r.width(), r.height(), fps, (int)(100.0 * fps / GetFPS()), s2.c_str(), GSSettingsDlg::g_interlace[m_interlace].name, @@ -499,10 +499,10 @@ void GSRenderer::GetTextureMinMax(GSVector4i& r, bool linear) if(vr.z > maxu + 1) vr.z = maxu + 1; break; case CLAMP_REGION_REPEAT: - vr.x = maxu; + vr.x = maxu; vr.z = vr.x + (minu + 1); break; - default: + default: __assume(0); } @@ -517,7 +517,7 @@ void GSRenderer::GetTextureMinMax(GSVector4i& r, bool linear) if(vr.w > maxv + 1) vr.w = maxv + 1; break; case CLAMP_REGION_REPEAT: - vr.y = maxv; + vr.y = maxv; vr.w = vr.y + (minv + 1); break; default: @@ -579,7 +579,7 @@ void GSRenderer::GetTextureMinMax(GSVector4i& r, bool linear) if(vr.w > uv.w + 1) vr.w = uv.w + 1; break; case CLAMP_REGION_REPEAT: // TODO - //Xenosaga 2 and 3 use it + //Xenosaga 2 and 3 use it //printf("gsdx: CLAMP_REGION_REPEAT not implemented, please report\n"); break; default: @@ -678,43 +678,43 @@ bool GSRenderer::TryAlphaTest(uint32& fm, uint32& zm) switch(context->TEST.ATST) { - case ATST_NEVER: - pass = false; + case ATST_NEVER: + pass = false; break; - case ATST_ALWAYS: - pass = true; + case ATST_ALWAYS: + pass = true; break; - case ATST_LESS: + case ATST_LESS: if(amax < aref) pass = true; else if(amin >= aref) pass = false; else return false; break; - case ATST_LEQUAL: + case ATST_LEQUAL: if(amax <= aref) pass = true; else if(amin > aref) pass = false; else return false; break; - case ATST_EQUAL: + case ATST_EQUAL: if(amin == aref && amax == aref) pass = true; else if(amin > aref || amax < aref) pass = false; else return false; break; - case ATST_GEQUAL: + case ATST_GEQUAL: if(amin >= aref) pass = true; else if(amax < aref) pass = false; else return false; break; - case ATST_GREATER: + case ATST_GREATER: if(amin > aref) pass = true; else if(amax <= aref) pass = false; else return false; break; - case ATST_NOTEQUAL: + case ATST_NOTEQUAL: if(amin == aref && amax == aref) pass = false; else if(amin > aref || amax < aref) pass = true; else return false; break; - default: + default: __assume(0); } } @@ -747,7 +747,7 @@ bool GSRenderer::IsLinear() } // if FST => assume Q = 1.0f (should not, but Q is very often bogus, 0 or DEN) // Fixme : Why should Q be bogus? - if(!TEX1.LCM && !PRIM->FST) + if(!TEX1.LCM && !PRIM->FST) { float K = (float)TEX1.K / 16; float f = (float)(1 << TEX1.L) / log(2.0f); diff --git a/plugins/GSdx/GSRenderer.h b/plugins/GSdx/GSRenderer.h index 7d97cd776e..542e5f65ac 100644 --- a/plugins/GSdx/GSRenderer.h +++ b/plugins/GSdx/GSRenderer.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -48,7 +48,7 @@ protected: bool m_framelimit; uint8* m_tex_buff; - + virtual GSTexture* GetOutput(int i) = 0; GSVertexTrace m_vt; @@ -85,7 +85,7 @@ public: virtual void VSync(int field); virtual bool MakeSnapshot(const string& path); virtual void KeyEvent(GSKeyEventData* e, int param = 0); - virtual bool CanUpscale() + virtual bool CanUpscale() { return !m_nativeres && m_regs->PMODE.EN != 0; // upscale ratio depends on the display size, with no output it may not be set correctly (ps2 logo to game transition) } @@ -125,7 +125,7 @@ protected: m_vl.RemoveAll(); } - void FlushPrim() + void FlushPrim() { if(m_count == 0) return; diff --git a/plugins/GSdx/GSRendererDX.cpp b/plugins/GSdx/GSRendererDX.cpp index dc5e32dacd..35f7578f3f 100644 --- a/plugins/GSdx/GSRendererDX.cpp +++ b/plugins/GSdx/GSRendererDX.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,18 +6,18 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ #include "stdafx.h" -#include "GSRendererDX.h" \ No newline at end of file +#include "GSRendererDX.h" diff --git a/plugins/GSdx/GSRendererDX.h b/plugins/GSdx/GSRendererDX.h index f17a40d7d3..e0a19a3f24 100644 --- a/plugins/GSdx/GSRendererDX.h +++ b/plugins/GSdx/GSRendererDX.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -23,7 +23,7 @@ #include "GSRendererHW.h" -template +template class GSRendererDX : public GSRendererHW { GSVector2 m_pixelcenter; @@ -135,10 +135,10 @@ public: { if(om_bsel.a == 0 && om_bsel.b == 1 && om_bsel.c == 0 && om_bsel.d == 1) { - // this works because with PABE alpha blending is on when alpha >= 0x80, but since the pixel shader + // this works because with PABE alpha blending is on when alpha >= 0x80, but since the pixel shader // cannot output anything over 0x80 (== 1.0) blending with 0x80 or turning it off gives the same result - om_bsel.abe = 0; + om_bsel.abe = 0; } else { @@ -180,7 +180,7 @@ public: ASSERT(m_vt.m_min.p.z > 0xffff); // sfex capcom logo // Fixme : Same as above, I guess. if (m_vt.m_min.p.z > 0xffff) - { + { vs_sel.bppz = 2; om_dssel.ztst = ZTST_ALWAYS; } @@ -196,23 +196,23 @@ public: float oy = (float)(int)context->XYOFFSET.OFY; float ox2 = 2.0f * m_pixelcenter.x / rt->GetWidth(); float oy2 = 2.0f * m_pixelcenter.y / rt->GetHeight(); - + //This hack subtracts around half a pixel from OFX and OFY. (Cannot do this directly, //because DX10 and DX9 have a different pixel center.) // //The resulting shifted output aligns better with common blending / corona / blurring effects, //but introduces a few bad pixels on the edges. - + // Edit: Moved to CreateSource() in GSTextureCache.cpp //if (UserHacks_HalfPixelOffset == true) //{ // //DX9 has pixelcenter set to 0.0, so give it some value here - // if (m_pixelcenter.x == 0 && m_pixelcenter.y == 0) { ox2 = oy2 = -0.00035f; } - // + // if (m_pixelcenter.x == 0 && m_pixelcenter.y == 0) { ox2 = oy2 = -0.00035f; } + // // if (ox != 0) { ox2 *= upscale_Multiplier(); } - // if (oy != 0) { oy2 *= upscale_Multiplier(); } + // if (oy != 0) { oy2 *= upscale_Multiplier(); } //} - + vs_cb.VertexScale = GSVector4(sx, -sy, 1.0f / UINT_MAX, 0.0f); vs_cb.VertexOffset = GSVector4(ox * sx + ox2 + 1, -(oy * sy + oy2 + 1), 0.0f, -1.0f); // gs @@ -264,7 +264,7 @@ public: { ps_sel.atst = ATST_ALWAYS; } - + if(tex) { ps_sel.wms = context->CLAMP.WMS; @@ -417,4 +417,4 @@ public: if(om_dssel.fba) UpdateFBA(rt); } -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSRendererDX11.cpp b/plugins/GSdx/GSRendererDX11.cpp index 0b844d5ac3..8bf8c902ba 100644 --- a/plugins/GSdx/GSRendererDX11.cpp +++ b/plugins/GSdx/GSRendererDX11.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -38,7 +38,7 @@ bool GSRendererDX11::CreateDevice(GSDevice* dev) return true; } -template +template void GSRendererDX11::VertexKick(bool skip) { GSVertexHW11& dst = m_vl.AddTail(); @@ -54,10 +54,10 @@ void GSRendererDX11::VertexKick(bool skip) int Vdiff = 0; int Uadjust = 0; int Vadjust = 0; - int multiplier = upscale_Multiplier(); - + int multiplier = upscale_Multiplier(); + if (multiplier > 1) { - + Udiff = m_v.UV.U & 4095; Vdiff = m_v.UV.V & 4095; if (Udiff != 0){ @@ -68,14 +68,14 @@ void GSRendererDX11::VertexKick(bool skip) if (Vdiff >= 4080) {/*printf("V+ %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = -1; } else if (Vdiff <= 16) {/*printf("V- %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = 1; } } - + Udiff = m_v.UV.U & 255; Vdiff = m_v.UV.V & 255; if (Udiff != 0){ - if (Udiff >= 248) { Uadjust = -1; } + if (Udiff >= 248) { Uadjust = -1; } else if (Udiff <= 8) { Uadjust = 1; } } - + if (Vdiff != 0){ if (Vdiff >= 248) { Vadjust = -1; } else if (Vdiff <= 8) { Vadjust = 1; } @@ -84,17 +84,17 @@ void GSRendererDX11::VertexKick(bool skip) Udiff = m_v.UV.U & 15; Vdiff = m_v.UV.V & 15; if (Udiff != 0){ - if (Udiff >= 15) { Uadjust = -1; } + if (Udiff >= 15) { Uadjust = -1; } else if (Udiff <= 1) { Uadjust = 1; } } - + if (Vdiff != 0){ if (Vdiff >= 15) { Vadjust = -1; } else if (Vdiff <= 1) { Vadjust = 1; } } } dst.ST.S = (float)m_v.UV.U - Uadjust; - dst.ST.T = (float)m_v.UV.V - Vadjust; + dst.ST.T = (float)m_v.UV.V - Vadjust; } else if (tme) { @@ -110,7 +110,7 @@ void GSRendererDX11::VertexKick(bool skip) #endif int count = 0; - + if(GSVertexHW11* v = DrawingKick(skip, count)) { GSVector4i scissor = m_context->scissor.dx10; @@ -206,7 +206,7 @@ void GSRendererDX11::Draw(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* m_topology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; m_perfmon.Put(GSPerfMon::Prim, m_count); break; - case GS_LINE_CLASS: + case GS_LINE_CLASS: case GS_SPRITE_CLASS: m_topology = D3D11_PRIMITIVE_TOPOLOGY_LINELIST; m_perfmon.Put(GSPerfMon::Prim, m_count / 2); diff --git a/plugins/GSdx/GSRendererDX11.h b/plugins/GSdx/GSRendererDX11.h index 125d60a735..fc7f8a0337 100644 --- a/plugins/GSdx/GSRendererDX11.h +++ b/plugins/GSdx/GSRendererDX11.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -37,4 +37,4 @@ public: bool CreateDevice(GSDevice* dev); template void VertexKick(bool skip); -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSRendererDX9.cpp b/plugins/GSdx/GSRendererDX9.cpp index c3d42eb975..06b816fe5a 100644 --- a/plugins/GSdx/GSRendererDX9.cpp +++ b/plugins/GSdx/GSRendererDX9.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -57,7 +57,7 @@ bool GSRendererDX9::CreateDevice(GSDevice* dev) return true; } -template +template void GSRendererDX9::VertexKick(bool skip) { GSVertexHW9 v; @@ -72,7 +72,7 @@ void GSRendererDX9::VertexKick(bool skip) { v.p = v.p.xyxy(GSVector4::load((float)m_v.XYZ.Z)); } - + int Uadjust = 0; int Vadjust = 0; @@ -81,15 +81,15 @@ void GSRendererDX9::VertexKick(bool skip) if(fst) { v.t = m_v.GetUV(); - + #ifdef USE_UPSCALE_HACKS - + int Udiff = 0; int Vdiff = 0; - int multiplier = upscale_Multiplier(); - + int multiplier = upscale_Multiplier(); + if (multiplier > 1) { - + Udiff = m_v.UV.U & 4095; Vdiff = m_v.UV.V & 4095; if (Udiff != 0){ @@ -100,14 +100,14 @@ void GSRendererDX9::VertexKick(bool skip) if (Vdiff >= 4080) {/*printf("V+ %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = -1; } else if (Vdiff <= 16) {/*printf("V- %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = 1; } } - + Udiff = m_v.UV.U & 255; Vdiff = m_v.UV.V & 255; if (Udiff != 0){ - if (Udiff >= 248) { Uadjust = -1; } + if (Udiff >= 248) { Uadjust = -1; } else if (Udiff <= 8) { Uadjust = 1; } } - + if (Vdiff != 0){ if (Vdiff >= 248) { Vadjust = -1; } else if (Vdiff <= 8) { Vadjust = 1; } @@ -116,10 +116,10 @@ void GSRendererDX9::VertexKick(bool skip) Udiff = m_v.UV.U & 15; Vdiff = m_v.UV.V & 15; if (Udiff != 0){ - if (Udiff >= 15) { Uadjust = -1; } + if (Udiff >= 15) { Uadjust = -1; } else if (Udiff <= 1) { Uadjust = 1; } } - + if (Vdiff != 0){ if (Vdiff >= 15) { Vadjust = -1; } else if (Vdiff <= 1) { Vadjust = 1; } @@ -138,7 +138,7 @@ void GSRendererDX9::VertexKick(bool skip) dst = v; -#ifdef USE_UPSCALE_HACKS +#ifdef USE_UPSCALE_HACKS if(tme && fst) { dst.t.x -= (float) Uadjust; @@ -150,7 +150,7 @@ void GSRendererDX9::VertexKick(bool skip) dst.c1 = m_v.FOG.u32[1]; int count = 0; - + if(GSVertexHW9* v = DrawingKick(skip, count)) { GSVector4 scissor = m_context->scissor.dx9; @@ -236,11 +236,11 @@ void GSRendererDX9::Draw(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t m_topology = D3DPT_POINTLIST; m_perfmon.Put(GSPerfMon::Prim, m_count); break; - case GS_LINE_CLASS: + case GS_LINE_CLASS: m_topology = D3DPT_LINELIST; m_perfmon.Put(GSPerfMon::Prim, m_count / 2); break; - case GS_TRIANGLE_CLASS: + case GS_TRIANGLE_CLASS: case GS_SPRITE_CLASS: m_topology = D3DPT_TRIANGLELIST; m_perfmon.Put(GSPerfMon::Prim, m_count / 3); diff --git a/plugins/GSdx/GSRendererDX9.h b/plugins/GSdx/GSRendererDX9.h index 8c6b099292..f4d8eb73a8 100644 --- a/plugins/GSdx/GSRendererDX9.h +++ b/plugins/GSdx/GSRendererDX9.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index 68eaca8000..8db4e975d3 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,18 +6,18 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ #include "stdafx.h" -#include "GSRendererHW.h" \ No newline at end of file +#include "GSRendererHW.h" diff --git a/plugins/GSdx/GSRendererHW.h b/plugins/GSdx/GSRendererHW.h index 4726aa5066..a54b2d2f21 100644 --- a/plugins/GSdx/GSRendererHW.h +++ b/plugins/GSdx/GSRendererHW.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -27,7 +27,7 @@ #include "GSFunctionMap.h" -template +template class GSRendererHW : public GSRendererT { int m_width; @@ -79,7 +79,7 @@ class GSRendererHW : public GSRendererT return false; } - else + else { lines = 0; } @@ -108,7 +108,7 @@ class GSRendererHW : public GSRendererT m_vt.Update(m_vertices, m_count, GS_TRIANGLE_CLASS); } - else + else { lines = 0; } @@ -137,7 +137,7 @@ class GSRendererHW : public GSRendererT bool OI_MetalSlug6(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t) { // missing red channel fix - + for(int i = 0, j = m_count; i < j; i++) { if(m_vertices[i].r == 0 && m_vertices[i].g != 0 && m_vertices[i].b != 0) @@ -355,10 +355,10 @@ class GSRendererHW : public GSRendererT class Hacks { - template struct HackEntry + template struct HackEntry { - CRC::Title title; - CRC::Region region; + CRC::Title title; + CRC::Region region; T func; struct HackEntry(CRC::Title t, CRC::Region r, T f) @@ -369,7 +369,7 @@ class GSRendererHW : public GSRendererT } }; - template class FunctionMap : public GSFunctionMap + template class FunctionMap : public GSFunctionMap { list >& m_tbl; @@ -405,13 +405,13 @@ class GSRendererHW : public GSRendererT OI_Ptr m_oi; OO_Ptr m_oo; CU_Ptr m_cu; - - Hacks() + + Hacks() : m_oi_map(m_oi_list) , m_oo_map(m_oo_list) , m_cu_map(m_cu_list) - , m_oi(NULL) - , m_oo(NULL) + , m_oi(NULL) + , m_oo(NULL) , m_cu(NULL) { m_oi_list.push_back(HackEntry(CRC::FFXII, CRC::EU, &GSRendererHW::OI_FFXII)); @@ -452,7 +452,7 @@ class GSRendererHW : public GSRendererT protected: GSTextureCache* m_tc; - void Reset() + void Reset() { // TODO: GSreset can come from the main thread too => crash // m_tc->RemoveAll(); @@ -466,7 +466,7 @@ protected: { __super::VSync(field); - m_tc->IncAge(); + m_tc->IncAge(); m_skip = 0; @@ -478,7 +478,7 @@ protected: } } - void ResetDevice() + void ResetDevice() { __super::ResetDevice(); m_tc->RemoveAll(); @@ -504,7 +504,7 @@ protected: if(s_dump) { - if(s_save && s_n >= s_saven) + if(s_save && s_n >= s_saven) { t->Save(format("c:\\temp2\\_%05d_f%I64d_fr%d_%05x_%d.bmp", s_n, m_perfmon.GetFrame(), i, (int)TEX0.TBP0, (int)TEX0.PSM)); } @@ -533,7 +533,7 @@ protected: void Draw() { if(IsBadFrame(m_skip, m_UserHacks_SkipDraw)) return; - + GSDrawingEnvironment& env = m_env; GSDrawingContext* context = m_context; @@ -571,13 +571,13 @@ protected: uint64 frame = m_perfmon.GetFrame(); string s; - - if(s_save && s_n >= s_saven && tex) + + if(s_save && s_n >= s_saven && tex) { - s = format("c:\\temp2\\_%05d_f%I64d_tex_%05x_%d_%d%d_%02x_%02x_%02x_%02x.dds", + s = format("c:\\temp2\\_%05d_f%I64d_tex_%05x_%d_%d%d_%02x_%02x_%02x_%02x.dds", s_n, frame, (int)context->TEX0.TBP0, (int)context->TEX0.PSM, - (int)context->CLAMP.WMS, (int)context->CLAMP.WMT, - (int)context->CLAMP.MINU, (int)context->CLAMP.MAXU, + (int)context->CLAMP.WMS, (int)context->CLAMP.WMT, + (int)context->CLAMP.MINU, (int)context->CLAMP.MAXU, (int)context->CLAMP.MINV, (int)context->CLAMP.MAXV); tex->m_texture->Save(s, true); @@ -722,7 +722,7 @@ public: m_height = theApp.GetConfig("resy", m_height); m_upscale_multiplier = theApp.GetConfig("upscale_multiplier", m_upscale_multiplier); if (m_upscale_multiplier > 6) m_upscale_multiplier = 1; //use the normal upscale math - if (m_upscale_multiplier > 1) + if (m_upscale_multiplier > 1) { m_width = 640 * m_upscale_multiplier; //512 is also common, but this is not always detected right. m_height = 512 * m_upscale_multiplier; //448 is also common, but this is not always detected right. @@ -747,4 +747,4 @@ public: m_width = 1280; // TODO: uses a 1280px wide 16 bit render target, but this only fixes half of the problem } } -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSRendererNull.cpp b/plugins/GSdx/GSRendererNull.cpp index 5e82cc2b09..5948bc2d5b 100644 --- a/plugins/GSdx/GSRendererNull.cpp +++ b/plugins/GSdx/GSRendererNull.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSRendererNull.h b/plugins/GSdx/GSRendererNull.h index 112e3bf626..5d54ebbf35 100644 --- a/plugins/GSdx/GSRendererNull.h +++ b/plugins/GSdx/GSRendererNull.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -27,11 +27,11 @@ class GSRendererNull : public GSRendererT { protected: - void Draw() + void Draw() { } - GSTexture* GetOutput(int i) + GSTexture* GetOutput(int i) { return NULL; } @@ -48,4 +48,4 @@ public: template void VertexKick(bool skip) { } -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSRendererSW.cpp b/plugins/GSdx/GSRendererSW.cpp index d27d3daa95..f367d1e12b 100644 --- a/plugins/GSdx/GSRendererSW.cpp +++ b/plugins/GSdx/GSRendererSW.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -46,7 +46,7 @@ GSRendererSW::~GSRendererSW() } } -void GSRendererSW::Reset() +void GSRendererSW::Reset() { // TODO: GSreset can come from the main thread too => crash // m_tc->RemoveAll(); @@ -72,7 +72,7 @@ void GSRendererSW::VSync(int field) // if((m_perfmon.GetFrame() & 255) == 0) m_rl.PrintStats(); } -void GSRendererSW::ResetDevice() +void GSRendererSW::ResetDevice() { for(int i = 0; i < countof(m_texture); i++) { @@ -121,7 +121,7 @@ GSTexture* GSRendererSW::GetOutput(int i) void GSRendererSW::Draw() { - if(m_dump) + if(m_dump) { m_dump.Object(m_vertices, m_count, m_vt.m_primclass); } @@ -141,7 +141,7 @@ void GSRendererSW::Draw() string s; - if(s_save && s_n >= s_saven && PRIM->TME) + if(s_save && s_n >= s_saven && PRIM->TME) { s = format("c:\\temp1\\_%05d_f%I64d_tex_%05x_%d.bmp", s_n, frame, (int)m_context->TEX0.TBP0, (int)m_context->TEX0.PSM); @@ -222,10 +222,10 @@ void GSRendererSW::Draw() if(0)//stats.ticks > 5000000) { - printf("* [%I64d | %012I64x] ticks %I64d prims %d (%d) pixels %d (%d)\n", - m_perfmon.GetFrame(), p.sel.key, - stats.ticks, - stats.prims, stats.prims > 0 ? (int)(stats.ticks / stats.prims) : -1, + printf("* [%I64d | %012I64x] ticks %I64d prims %d (%d) pixels %d (%d)\n", + m_perfmon.GetFrame(), p.sel.key, + stats.ticks, + stats.prims, stats.prims > 0 ? (int)(stats.ticks / stats.prims) : -1, stats.pixels, stats.pixels > 0 ? (int)(stats.ticks / stats.pixels) : -1); } } @@ -398,9 +398,9 @@ void GSRendererSW::GetScanlineParam(GSScanlineParam& p, GS_PRIM_CLASS primclass) } } - if(p.sel.date + if(p.sel.date || p.sel.aba == 1 || p.sel.abb == 1 || p.sel.abc == 1 || p.sel.abd == 1 - || p.sel.atst != ATST_ALWAYS && p.sel.afail == AFAIL_RGB_ONLY + || p.sel.atst != ATST_ALWAYS && p.sel.afail == AFAIL_RGB_ONLY || p.sel.fpsm == 0 && p.fm != 0 && p.fm != 0xffffffff || p.sel.fpsm == 1 && (p.fm & 0x00ffffff) != 0 && (p.fm & 0x00ffffff) != 0x00ffffff || p.sel.fpsm == 2 && (p.fm & 0x80f8f8f8) != 0 && (p.fm & 0x80f8f8f8) != 0x80f8f8f8) @@ -427,13 +427,13 @@ void GSRendererSW::GetScanlineParam(GSScanlineParam& p, GS_PRIM_CLASS primclass) } } -template +template void GSRendererSW::VertexKick(bool skip) { const GSDrawingContext* context = m_context; GSVector4i xy = GSVector4i::load((int)m_v.XYZ.u32[0]); - + xy = xy.insert16<3>(m_v.FOG.F); xy = xy.upl16(); xy -= context->XYOFFSET; @@ -470,7 +470,7 @@ void GSRendererSW::VertexKick(bool skip) dst.p.z = (float)min(m_v.XYZ.Z, 0xffffff00); // max value which can survive the uint32 => float => uint32 conversion int count = 0; - + if(GSVertexSW* v = DrawingKick(skip, count)) { if(!m_dump) @@ -521,7 +521,7 @@ if(!m_dump) test |= tmp == tmp.yxwz(); break; } - + if(test.mask() & 3) { return; diff --git a/plugins/GSdx/GSRendererSW.h b/plugins/GSdx/GSRendererSW.h index 0aac07b450..cb47750e64 100644 --- a/plugins/GSdx/GSRendererSW.h +++ b/plugins/GSdx/GSRendererSW.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -47,6 +47,6 @@ public: GSRendererSW(); virtual ~GSRendererSW(); - template + template void VertexKick(bool skip); }; diff --git a/plugins/GSdx/GSScanlineEnvironment.h b/plugins/GSdx/GSScanlineEnvironment.h index 2a4fb7ba2e..94c9f7011b 100644 --- a/plugins/GSdx/GSScanlineEnvironment.h +++ b/plugins/GSdx/GSScanlineEnvironment.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -91,8 +91,8 @@ union GSScanlineSelector return sprite && iip == 0 && tfx == TFX_NONE - && abe == 0 - && ztst <= 1 + && abe == 0 + && ztst <= 1 && atst <= 1 && date == 0 && fge == 0; diff --git a/plugins/GSdx/GSSetting.cpp b/plugins/GSdx/GSSetting.cpp index 6094fb5e9b..7d4ea9ab8c 100644 --- a/plugins/GSdx/GSSetting.cpp +++ b/plugins/GSdx/GSSetting.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSSetting.h b/plugins/GSdx/GSSetting.h index ced75eb7b9..8cfb007364 100644 --- a/plugins/GSdx/GSSetting.h +++ b/plugins/GSdx/GSSetting.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,24 +6,24 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ #pragma once -struct GSSetting +struct GSSetting { - uint32 id; - const char* name; + uint32 id; + const char* name; const char* note; }; diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index 872dd93e73..4f8ac55a65 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -136,7 +136,7 @@ void GSSettingsDlg::OnInit() CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfig("UserHacks_HalfPixelOffset", 0)); SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETRANGE, 0, MAKELPARAM(1000, 0)); SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("UserHacks_SkipDraw", 0), 0)); - + SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETRANGE, 0, MAKELPARAM(8192, 256)); SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resx", 1024), 0)); @@ -189,7 +189,7 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) { theApp.SetConfig("AspectRatio", (int)data); } - + if(ComboBoxGetSelData(IDC_UPSCALE_MULTIPLIER, data)) { theApp.SetConfig("upscale_multiplier", (int)data); @@ -198,7 +198,7 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) { theApp.SetConfig("upscale_multiplier", 1); } - + theApp.SetConfig("windowed", (int)IsDlgButtonChecked(m_hWnd, IDC_WINDOWED)); theApp.SetConfig("filter", (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER)); theApp.SetConfig("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX)); @@ -212,7 +212,7 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) theApp.SetConfig("swthreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0)); theApp.SetConfig("msaa", (int)SendMessage(GetDlgItem(m_hWnd, IDC_MSAA), UDM_GETPOS, 0, 0)); // Hacks - theApp.SetConfig("UserHacks_AlphaHack", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHAHACK)); + theApp.SetConfig("UserHacks_AlphaHack", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHAHACK)); theApp.SetConfig("UserHacks_HalfPixelOffset", (int)IsDlgButtonChecked(m_hWnd, IDC_OFFSETHACK)); theApp.SetConfig("UserHacks_SkipDraw", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_GETPOS, 0, 0)); } @@ -249,7 +249,7 @@ void GSSettingsDlg::UpdateControls() EnableWindow(GetDlgItem(m_hWnd, IDC_RESY_EDIT), hw && !native); EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER), hw && !native); EnableWindow(GetDlgItem(m_hWnd, IDC_NATIVERES), hw); - EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER), hw && !native); + EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER), hw && !native); EnableWindow(GetDlgItem(m_hWnd, IDC_PALTEX), hw); EnableWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 && hw); EnableWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 && hw); @@ -262,9 +262,9 @@ void GSSettingsDlg::UpdateControls() ShowWindow(GetDlgItem(m_hWnd, IDC_USERHACKS), allowHacks && hw)?SW_SHOW:SW_HIDE; ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHAHACK), allowHacks && hw)?SW_SHOW:SW_HIDE; ShowWindow(GetDlgItem(m_hWnd, IDC_OFFSETHACK), allowHacks && hw)?SW_SHOW:SW_HIDE; - ShowWindow(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACKEDIT), allowHacks && hw)?SW_SHOW:SW_HIDE; - ShowWindow(GetDlgItem(m_hWnd, IDC_STATIC10), allowHacks && hw)?SW_SHOW:SW_HIDE; - ShowWindow(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), allowHacks && hw)?SW_SHOW:SW_HIDE; + ShowWindow(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACKEDIT), allowHacks && hw)?SW_SHOW:SW_HIDE; + ShowWindow(GetDlgItem(m_hWnd, IDC_STATIC10), allowHacks && hw)?SW_SHOW:SW_HIDE; + ShowWindow(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), allowHacks && hw)?SW_SHOW:SW_HIDE; } } diff --git a/plugins/GSdx/GSSettingsDlg.h b/plugins/GSdx/GSSettingsDlg.h index daeddd9d79..78b68df966 100644 --- a/plugins/GSdx/GSSettingsDlg.h +++ b/plugins/GSdx/GSSettingsDlg.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -28,7 +28,7 @@ class GSSettingsDlg : public GSDialog { list m_modes; bool m_IsOpen2; - + void UpdateControls(); protected: @@ -42,4 +42,4 @@ public: static GSSetting g_interlace[]; static GSSetting g_aspectratio[]; static GSSetting g_upscale_multiplier[]; -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSSetupPrimCodeGenerator.cpp b/plugins/GSdx/GSSetupPrimCodeGenerator.cpp index 8bfa457828..f6f48f6b77 100644 --- a/plugins/GSdx/GSSetupPrimCodeGenerator.cpp +++ b/plugins/GSdx/GSSetupPrimCodeGenerator.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -164,7 +164,7 @@ void GSSetupPrimCodeGenerator::Depth() pcmpeqd(xmm2, xmm2); psrld(xmm2, 31); pand(xmm0, xmm2); - + por(xmm0, xmm1); } else @@ -367,11 +367,11 @@ void GSSetupPrimCodeGenerator::Color() } } -const GSVector4 GSSetupPrimCodeGenerator::m_shift[5] = +const GSVector4 GSSetupPrimCodeGenerator::m_shift[5] = { GSVector4(4.0f, 4.0f, 4.0f, 4.0f), GSVector4(0.0f, 1.0f, 2.0f, 3.0f), GSVector4(-1.0f, 0.0f, 1.0f, 2.0f), GSVector4(-2.0f, -1.0f, 0.0f, 1.0f), GSVector4(-3.0f, -2.0f, -1.0f, 0.0f), -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSSetupPrimCodeGenerator.h b/plugins/GSdx/GSSetupPrimCodeGenerator.h index 548ef4312f..0639dfd797 100644 --- a/plugins/GSdx/GSSetupPrimCodeGenerator.h +++ b/plugins/GSdx/GSSetupPrimCodeGenerator.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -48,4 +48,4 @@ class GSSetupPrimCodeGenerator : public CodeGenerator public: GSSetupPrimCodeGenerator(GSScanlineEnvironment& env, uint64 key, void* ptr, size_t maxsize); -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 242615b06e..ae2c404360 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -36,7 +36,7 @@ GSState::GSState() , m_vkf(NULL) { m_sssize = 0; - + m_sssize += sizeof(m_version); m_sssize += sizeof(m_env.PRIM); m_sssize += sizeof(m_env.PRMODE); @@ -54,7 +54,7 @@ GSState::GSState() m_sssize += sizeof(m_env.TRXPOS); m_sssize += sizeof(m_env.TRXREG); m_sssize += sizeof(m_env.TRXREG); // obsolete - + for(int i = 0; i < 2; i++) { m_sssize += sizeof(m_env.CTXT[i].XYOFFSET); @@ -114,7 +114,7 @@ void GSState::SetMultithreaded( bool isMT ) // in multithreaded mode (possibly because ZeroGS itself would assert in such // cases), and didn't bind them to a dummy callback either. PCSX2 handles all // IRQs internally when multithreaded anyway -- so let's ignore them here: - + m_mt = isMT; if( isMT ) { @@ -284,7 +284,7 @@ GSVector2i GSState::GetDeviceSize(int i) { h = (m_regs->SMODE1.CMOD & 1) ? 512 : 448; }*/ - + //Fixme : Just slightly better than the hack above if(m_regs->SMODE2.INT && m_regs->SMODE2.FFMD && h > 1){ if (!IsEnabled(0) || !IsEnabled(1)){h >>= 1;} @@ -298,11 +298,11 @@ bool GSState::IsEnabled(int i) { ASSERT(i >= 0 && i < 2); - if(i == 0 && m_regs->PMODE.EN1) + if(i == 0 && m_regs->PMODE.EN1) { return m_regs->DISP[0].DISPLAY.DW || m_regs->DISP[0].DISPLAY.DH; } - else if(i == 1 && m_regs->PMODE.EN2) + else if(i == 1 && m_regs->PMODE.EN2) { return m_regs->DISP[1].DISPLAY.DW || m_regs->DISP[1].DISPLAY.DH; } @@ -521,7 +521,7 @@ template void GSState::GIFRegHandlerTEX0(GIFReg* r) if(wt || PRIM->CTXT == i && r->TEX0 != m_env.CTXT[i].TEX0) { - Flush(); + Flush(); } if(r->TEX0.TW > 10) r->TEX0.TW = 10; @@ -853,7 +853,7 @@ template void GSState::GIFRegHandlerZBUF(GIFReg* r) { // during startup all regs are cleared to 0 (by the bios or something), so we mask z until this register becomes valid - r->ZBUF.ZMSK = 1; + r->ZBUF.ZMSK = 1; } r->ZBUF.PSM |= 0x30; @@ -937,7 +937,7 @@ void GSState::GIFRegHandlerTRXDIR(GIFReg* r) case 2: // local -> local Move(); break; - case 3: + case 3: ASSERT(0); break; } @@ -995,7 +995,7 @@ void GSState::FlushWrite() m_perfmon.Put(GSPerfMon::Swizzle, len); GSVector4i r; - + r.left = m_env.TRXPOS.DSAX; r.top = y; r.right = r.left + m_env.TRXREG.RRW; @@ -1005,8 +1005,8 @@ void GSState::FlushWrite() /* static int n = 0; string s; - s = format("c:\\temp1\\[%04d]_%05x_%d_%d_%d_%d_%d_%d.bmp", - n++, (int)m_env.BITBLTBUF.DBP, (int)m_env.BITBLTBUF.DBW, (int)m_env.BITBLTBUF.DPSM, + s = format("c:\\temp1\\[%04d]_%05x_%d_%d_%d_%d_%d_%d.bmp", + n++, (int)m_env.BITBLTBUF.DBP, (int)m_env.BITBLTBUF.DBW, (int)m_env.BITBLTBUF.DPSM, r.left, r.top, r.right, r.bottom); m_mem.SaveBMP(s, m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW, m_env.BITBLTBUF.DPSM, r.right, r.bottom); */ @@ -1033,7 +1033,7 @@ void GSState::Write(uint8* mem, int len) FlushPrim(); } - if(m_tr.end == 0 && len >= m_tr.total) + if(m_tr.end == 0 && len >= m_tr.total) { // received all data in one piece, no need to buffer it @@ -1046,7 +1046,7 @@ void GSState::Write(uint8* mem, int len) m_perfmon.Put(GSPerfMon::Swizzle, len); GSVector4i r; - + r.left = m_env.TRXPOS.DSAX; r.top = m_env.TRXPOS.DSAY; r.right = r.left + m_env.TRXREG.RRW; @@ -1095,14 +1095,14 @@ void GSState::Read(uint8* mem, int len) m_mem.ReadImageX(m_tr.x, m_tr.y, mem, len, m_env.BITBLTBUF, m_env.TRXPOS, m_env.TRXREG); } -// Use version 1 of the optimized local > local transfer, as per revision 887. +// Use version 1 of the optimized local > local transfer, as per revision 887. // Later (more optimized?) versions cause a crash in Dark Cloud 2. #if 1 void GSState::Move() { // ffxii uses this to move the top/bottom of the scrolling menus offscreen and then blends them back over the text to create a shading effect // guitar hero copies the far end of the board to do a similar blend too - + int sx = m_env.TRXPOS.SSAX; int dx = m_env.TRXPOS.DSAX; int sy = m_env.TRXPOS.SSAY; @@ -1130,7 +1130,7 @@ void GSState::Move() DWORD dbase = dpsm.pa(0, dy, m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW); int* doffset = dpsm.rowOffset[dy & 7]; - + for(int x = 0; x < w; x++, sx += xinc, dx += xinc) { m_mem.WritePixel32(dbase + doffset[dx], m_mem.ReadPixel32(sbase + soffset[sx])); @@ -1146,7 +1146,7 @@ void GSState::Move() DWORD dbase = dpsm.pa(0, dy, m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW); int* doffset = dpsm.rowOffset[dy & 7]; - + for(int x = 0; x < w; x++, sx += xinc, dx += xinc) { (m_mem.*dpsm.wpa)(dbase + doffset[dx], (m_mem.*spsm.rpa)(sbase + soffset[sx])); @@ -1176,7 +1176,7 @@ void GSState::Move() if(m_env.TRXPOS.DIRX) {sx += w - 1; dx += w - 1; xinc = -1;} if(m_env.TRXPOS.DIRY) {sy += h - 1; dy += h - 1; yinc = -1;} /* - printf("%05x %d %d => %05x %d %d (%d%d), %d %d %d %d %d %d\n", + printf("%05x %d %d => %05x %d %d (%d%d), %d %d %d %d %d %d\n", m_env.BITBLTBUF.SBP, m_env.BITBLTBUF.SBW, m_env.BITBLTBUF.SPSM, m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW, m_env.BITBLTBUF.DPSM, m_env.TRXPOS.DIRX, m_env.TRXPOS.DIRY, @@ -1317,7 +1317,7 @@ void GSState::Move() int* RESTRICT scol = &spo->pixel.col[sy & 7][sx]; int* RESTRICT dcol = &dpo->pixel.col[dy & 7][dx]; - + for(int x = 0; x < w; x++) m_mem.WritePixel4(dbase + dcol[x], m_mem.ReadPixel4(sbase + scol[x])); } } @@ -1330,7 +1330,7 @@ void GSState::Move() int* RESTRICT scol = &spo->pixel.col[sy & 7][sx]; int* RESTRICT dcol = &dpo->pixel.col[dy & 7][dx]; - + for(int x = 0; x > -w; x--) m_mem.WritePixel4(dbase + dcol[x], m_mem.ReadPixel4(sbase + scol[x])); } } @@ -1346,7 +1346,7 @@ void GSState::Move() int* RESTRICT scol = &spo->pixel.col[sy & 7][sx]; int* RESTRICT dcol = &dpo->pixel.col[dy & 7][dx]; - + for(int x = 0; x < w; x++) (m_mem.*dpsm.wpa)(dbase + dcol[x], (m_mem.*spsm.rpa)(sbase + scol[x])); } } @@ -1359,7 +1359,7 @@ void GSState::Move() int* RESTRICT scol = &spo->pixel.col[sy & 7][sx]; int* RESTRICT dcol = &dpo->pixel.col[dy & 7][dx]; - + for(int x = 0; x > -w; x--) (m_mem.*dpsm.wpa)(dbase + dcol[x], (m_mem.*spsm.rpa)(sbase + scol[x])); } } @@ -1495,7 +1495,7 @@ template void GSState::Transfer(uint8* mem, uint32 size) size--; } while(path.StepReg() && size > 0); - + if(size & 1) mem += sizeof(GIFReg); size /= 2; @@ -1522,16 +1522,16 @@ template void GSState::Transfer(uint8* mem, uint32 size) case 0: Write(mem, len * 16); break; - case 1: + case 1: Read(mem, len * 16); break; - case 2: + case 2: Move(); break; - case 3: + case 3: ASSERT(0); break; - default: + default: __assume(0); } @@ -1542,7 +1542,7 @@ template void GSState::Transfer(uint8* mem, uint32 size) break; - default: + default: __assume(0); } } @@ -1598,7 +1598,7 @@ int GSState::Freeze(GSFreezeData* fd, bool sizeonly) fd->size = m_sssize; return 0; } - + if(!fd->data || fd->size < m_sssize) { return -1; @@ -1668,12 +1668,12 @@ int GSState::Freeze(GSFreezeData* fd, bool sizeonly) int GSState::Defrost(const GSFreezeData* fd) { - if(!fd || !fd->data || fd->size == 0) + if(!fd || !fd->data || fd->size == 0) { return -1; } - if(fd->size < m_sssize) + if(fd->size < m_sssize) { return -1; } @@ -1732,7 +1732,7 @@ int GSState::Defrost(const GSFreezeData* fd) if(version <= 4) { - data += sizeof(uint32) * 7; // skip + data += sizeof(uint32) * 7; // skip } } @@ -1941,7 +1941,7 @@ bool GSC_MetalGearSolid3(const GSFrameInfo& fi, int& skip) skip = 1000; // 69 } } - else + else { if(!fi.TME && (fi.FBP == 0x00000 || fi.FBP == 0x01000) && fi.FPSM == PSM_PSMCT32) { @@ -2013,7 +2013,7 @@ bool GSC_Bully(const GSFrameInfo& fi, int& skip) skip = 6; } } - else + else { if(!fi.TME && (fi.FBP == 0x00000 || fi.FBP == 0x01180) && fi.FPSM == PSM_PSMCT32) { @@ -2318,8 +2318,8 @@ bool GSC_GodOfWar2(const GSFrameInfo& fi, int& skip) { skip = 29; // shadows } - if(fi.FBP == 0x00100 && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 & 0x03000) == 0x03000 - && (fi.TPSM == PSM_PSMT8 || fi.TPSM == PSM_PSMT4) + if(fi.FBP == 0x00100 && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 & 0x03000) == 0x03000 + && (fi.TPSM == PSM_PSMT8 || fi.TPSM == PSM_PSMT4) && ((fi.TZTST == 2 && fi.FBMSK == 0x00FFFFFF) || (fi.TZTST == 1 && fi.FBMSK == 0x00FFFFFF) || (fi.TZTST == 3 && fi.FBMSK == 0xFF000000))){ skip = 1; // wall of fog } @@ -2495,7 +2495,7 @@ bool GSState::IsBadFrame(int& skip, int UserHacks_SkipDraw) inited = true; memset(map, 0, sizeof(map)); - + map[CRC::Okami] = GSC_Okami; map[CRC::MetalGearSolid3] = GSC_MetalGearSolid3; map[CRC::DBZBT2] = GSC_DBZBT2; diff --git a/plugins/GSdx/GSState.h b/plugins/GSdx/GSState.h index 914ea9d1e8..7d98b0828c 100644 --- a/plugins/GSdx/GSState.h +++ b/plugins/GSdx/GSState.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -114,8 +114,8 @@ class GSState : public GSAlignedClass<16> struct GSTransferBuffer { - int x, y; - int start, end, total; + int x, y; + int start, end, total; bool overflow; uint8* buff; diff --git a/plugins/GSdx/GSTables.cpp b/plugins/GSdx/GSTables.cpp index 31693553ff..9f3d5fbd72 100644 --- a/plugins/GSdx/GSTables.cpp +++ b/plugins/GSdx/GSTables.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -110,9 +110,9 @@ const uint8 columnTable32[8][8] = { }; const uint8 columnTable16[8][16] = { - { 0, 2, 8, 10, 16, 18, 24, 26, + { 0, 2, 8, 10, 16, 18, 24, 26, 1, 3, 9, 11, 17, 19, 25, 27 }, - { 4, 6, 12, 14, 20, 22, 28, 30, + { 4, 6, 12, 14, 20, 22, 28, 30, 5, 7, 13, 15, 21, 23, 29, 31 }, { 32, 34, 40, 42, 48, 50, 56, 58, 33, 35, 41, 43, 49, 51, 57, 59 }, @@ -139,7 +139,7 @@ const uint8 columnTable8[16][16] = { 43, 47, 59, 63, 11, 15, 27, 31 }, { 96, 100, 112, 116, 64, 68, 80, 84, // column 1 98, 102, 114, 118, 66, 70, 82, 86 }, - { 104, 108, 120, 124, 72, 76, 88, 92, + { 104, 108, 120, 124, 72, 76, 88, 92, 106, 110, 122, 126, 74, 78, 90, 94 }, { 65, 69, 81, 85, 97, 101, 113, 117, 67, 71, 83, 87, 99, 103, 115, 119 }, @@ -174,7 +174,7 @@ const uint16 columnTable4[16][32] = { 22, 30, 54, 62, 86, 94, 118, 126 }, { 65, 73, 97, 105, 1, 9, 33, 41, 67, 75, 99, 107, 3, 11, 35, 43, - 69, 77, 101, 109, 5, 13, 37, 45, + 69, 77, 101, 109, 5, 13, 37, 45, 71, 79, 103, 111, 7, 15, 39, 47 }, { 81, 89, 113, 121, 17, 25, 49, 57, 83, 91, 115, 123, 19, 27, 51, 59, @@ -190,7 +190,7 @@ const uint16 columnTable4[16][32] = { 214, 222, 246, 254, 150, 158, 182, 190 }, { 129, 137, 161, 169, 193, 201, 225, 233, 131, 139, 163, 171, 195, 203, 227, 235, - 133, 141, 165, 173, 197, 205, 229, 237, + 133, 141, 165, 173, 197, 205, 229, 237, 135, 143, 167, 175, 199, 207, 231, 239 }, { 145, 153, 177, 185, 209, 217, 241, 249, 147, 155, 179, 187, 211, 219, 243, 251, @@ -206,7 +206,7 @@ const uint16 columnTable4[16][32] = { 278, 286, 310, 318, 342, 350, 374, 382 }, { 321, 329, 353, 361, 257, 265, 289, 297, 323, 331, 355, 363, 259, 267, 291, 299, - 325, 333, 357, 365, 261, 269, 293, 301, + 325, 333, 357, 365, 261, 269, 293, 301, 327, 335, 359, 367, 263, 271, 295, 303 }, { 337, 345, 369, 377, 273, 281, 305, 313, 339, 347, 371, 379, 275, 283, 307, 315, @@ -222,7 +222,7 @@ const uint16 columnTable4[16][32] = { 470, 478, 502, 510, 406, 414, 438, 446 }, { 385, 393, 417, 425, 449, 457, 481, 489, 387, 395, 419, 427, 451, 459, 483, 491, - 389, 397, 421, 429, 453, 461, 485, 493, + 389, 397, 421, 429, 453, 461, 485, 493, 391, 399, 423, 431, 455, 463, 487, 495 }, { 401, 409, 433, 441, 465, 473, 497, 505, 403, 411, 435, 443, 467, 475, 499, 507, @@ -230,33 +230,33 @@ const uint16 columnTable4[16][32] = { 407, 415, 439, 447, 471, 479, 503, 511 }, }; -const uint8 clutTableT32I8[128] = +const uint8 clutTableT32I8[128] = { - 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15, - 64, 65, 68, 69, 72, 73, 76, 77, 66, 67, 70, 71, 74, 75, 78, 79, - 16, 17, 20, 21, 24, 25, 28, 29, 18, 19, 22, 23, 26, 27, 30, 31, - 80, 81, 84, 85, 88, 89, 92, 93, 82, 83, 86, 87, 90, 91, 94, 95, - 32, 33, 36, 37, 40, 41, 44, 45, 34, 35, 38, 39, 42, 43, 46, 47, - 96, 97, 100, 101, 104, 105, 108, 109, 98, 99, 102, 103, 106, 107, 110, 111, - 48, 49, 52, 53, 56, 57, 60, 61, 50, 51, 54, 55, 58, 59, 62, 63, + 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15, + 64, 65, 68, 69, 72, 73, 76, 77, 66, 67, 70, 71, 74, 75, 78, 79, + 16, 17, 20, 21, 24, 25, 28, 29, 18, 19, 22, 23, 26, 27, 30, 31, + 80, 81, 84, 85, 88, 89, 92, 93, 82, 83, 86, 87, 90, 91, 94, 95, + 32, 33, 36, 37, 40, 41, 44, 45, 34, 35, 38, 39, 42, 43, 46, 47, + 96, 97, 100, 101, 104, 105, 108, 109, 98, 99, 102, 103, 106, 107, 110, 111, + 48, 49, 52, 53, 56, 57, 60, 61, 50, 51, 54, 55, 58, 59, 62, 63, 112, 113, 116, 117, 120, 121, 124, 125, 114, 115, 118, 119, 122, 123, 126, 127 }; -const uint8 clutTableT32I4[16] = +const uint8 clutTableT32I4[16] = { 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15 }; -const uint8 clutTableT16I8[32] = +const uint8 clutTableT16I8[32] = { 0, 2, 8, 10, 16, 18, 24, 26, 4, 6, 12, 14, 20, 22, 28, 30, - 1, 3, 9, 11, 17, 19, 25, 27, + 1, 3, 9, 11, 17, 19, 25, 27, 5, 7, 13, 15, 21, 23, 29, 31 }; -const uint8 clutTableT16I4[16] = +const uint8 clutTableT16I4[16] = { 0, 2, 8, 10, 16, 18, 24, 26, 4, 6, 12, 14, 20, 22, 28, 30 @@ -358,4 +358,4 @@ const D3D9Blend blendMapD3D9[3*3*3*3] = {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 2220: (0 - 0)*F + Cs ==> Cs {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 2221: (0 - 0)*F + Cd ==> Cd {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 2222: (0 - 0)*F + 0 ==> 0 -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSTables.h b/plugins/GSdx/GSTables.h index be32341f16..ff6a7e01b4 100644 --- a/plugins/GSdx/GSTables.h +++ b/plugins/GSdx/GSTables.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -34,7 +34,7 @@ extern const uint8 columnTable16[8][16]; extern const uint8 columnTable8[16][16]; extern const uint16 columnTable4[16][32]; extern const uint8 clutTableT32I8[128]; -extern const uint8 clutTableT32I4[16]; +extern const uint8 clutTableT32I4[16]; extern const uint8 clutTableT16I8[32]; extern const uint8 clutTableT16I4[16]; struct D3D9Blend { @@ -42,4 +42,4 @@ struct D3D9Blend { D3DBLENDOP op; D3DBLEND src, dst; }; -extern const D3D9Blend blendMapD3D9[3*3*3*3]; \ No newline at end of file +extern const D3D9Blend blendMapD3D9[3*3*3*3]; diff --git a/plugins/GSdx/GSTexture.cpp b/plugins/GSdx/GSTexture.cpp index 055fc1c8a7..885cf5fa79 100644 --- a/plugins/GSdx/GSTexture.cpp +++ b/plugins/GSdx/GSTexture.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -22,7 +22,7 @@ #include "StdAfx.h" #include "GSTexture.h" -GSTexture::GSTexture() +GSTexture::GSTexture() : m_scale(1, 1) , m_size(0, 0) , m_type(None) diff --git a/plugins/GSdx/GSTexture.h b/plugins/GSdx/GSTexture.h index 74986c7224..1f66740a91 100644 --- a/plugins/GSdx/GSTexture.h +++ b/plugins/GSdx/GSTexture.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSTexture11.cpp b/plugins/GSdx/GSTexture11.cpp index 14774bbcfa..e45c9fe98f 100644 --- a/plugins/GSdx/GSTexture11.cpp +++ b/plugins/GSdx/GSTexture11.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -50,7 +50,7 @@ bool GSTexture11::Update(const GSVector4i& r, const void* data, int pitch) if(m_dev && m_texture) { D3D11_BOX box = {r.left, r.top, 0, r.right, r.bottom, 1}; - + m_ctx->UpdateSubresource(m_texture, 0, &box, data, pitch, 0); return true; diff --git a/plugins/GSdx/GSTexture11.h b/plugins/GSdx/GSTexture11.h index b4f266d8b7..1f78df5f34 100644 --- a/plugins/GSdx/GSTexture11.h +++ b/plugins/GSdx/GSTexture11.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSTexture9.cpp b/plugins/GSdx/GSTexture9.cpp index 477ee37a27..883cbad742 100644 --- a/plugins/GSdx/GSTexture9.cpp +++ b/plugins/GSdx/GSTexture9.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -28,7 +28,7 @@ GSTexture9::GSTexture9(IDirect3DSurface9* surface) surface->GetDevice(&m_dev); surface->GetDesc(&m_desc); - + if(m_desc.Type != D3DRTYPE_SURFACE) { surface->GetContainer(__uuidof(IDirect3DTexture9), (void**)&m_texture); @@ -88,7 +88,7 @@ bool GSTexture9::Update(const GSVector4i& r, const void* data, int pitch) uint8* dst = (uint8*)lr.pBits; int bytes = r.width() * sizeof(uint32); - + switch(m_desc.Format) { case D3DFMT_A8: bytes >>= 2; break; @@ -144,7 +144,7 @@ void GSTexture9::Unmap() bool GSTexture9::Save(const string& fn, bool dds) { CComPtr surface; - + if(m_desc.Usage & D3DUSAGE_DEPTHSTENCIL) { HRESULT hr; diff --git a/plugins/GSdx/GSTexture9.h b/plugins/GSdx/GSTexture9.h index e28b085278..089778c30f 100644 --- a/plugins/GSdx/GSTexture9.h +++ b/plugins/GSdx/GSTexture9.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -27,7 +27,7 @@ class GSTexture9 : public GSTexture { CComPtr m_dev; CComPtr m_surface; - CComPtr m_texture; + CComPtr m_texture; D3DSURFACE_DESC m_desc; public: diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index e5fd659501..74056740c1 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -50,7 +50,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con { const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[TEX0.PSM]; const uint32* clut = m_renderer->m_mem.m_clut; - + Source* src = NULL; list& m = m_src.m_map[TEX0.TBP0 >> 5]; @@ -179,7 +179,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int #if 0 //#ifdef USE_UPSCALE_HACKS //not happy with this yet.. float x = 1.0f; float y = 1.0f; - + switch(multiplier) { case 2: x = 1.9375; y = 2.0f; break; // x res get's rid of vertical lines in many games @@ -205,7 +205,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int hh *= 2; } - //This vp2 fix doesn't work most of the time + //This vp2 fix doesn't work most of the time if(hh < 512 && m_renderer->m_context->SCISSOR.SCAY1 == 511) // vp2 { hh = 512; @@ -242,7 +242,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int break; } - else + else { // HACK: try to find something close to the base pointer @@ -275,8 +275,8 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int void GSTextureCache::InvalidateVideoMem(const GSOffset* o, const GSVector4i& rect, bool target) { // Fixme. Crashes Dual Hearts, maybe others as well. Was fine before r1549. - if (!o) return; - + if (!o) return; + uint32 bp = o->bp; uint32 bw = o->bw; uint32 psm = o->psm; @@ -422,7 +422,7 @@ void GSTextureCache::InvalidateLocalMem(const GSOffset* o, const GSVector4i& r) Read(t, r.rintersect(t->m_valid)); return; } - else if(psm == PSM_PSMCT32 && (t->m_TEX0.PSM == PSM_PSMCT16 || t->m_TEX0.PSM == PSM_PSMCT16S)) + else if(psm == PSM_PSMCT32 && (t->m_TEX0.PSM == PSM_PSMCT16 || t->m_TEX0.PSM == PSM_PSMCT16S)) { // ffx-2 riku changing to her default (shoots some reflecting glass at the end), 16-bit rt read as 32-bit Read(t, GSVector4i(r.left, r.top, r.right, r.top + (r.bottom - r.top) * 2).rintersect(t->m_valid)); @@ -430,7 +430,7 @@ void GSTextureCache::InvalidateLocalMem(const GSOffset* o, const GSVector4i& r) } else { - if (psm == PSM_PSMT4HH && t->m_TEX0.PSM == PSM_PSMCT32) + if (psm == PSM_PSMT4HH && t->m_TEX0.PSM == PSM_PSMCT32) { // Silent Hill Origins shadows: Read 8 bit using only the HIGH bits (4 bit) texture as 32 bit. Read(t, r.rintersect(t->m_valid)); @@ -446,7 +446,7 @@ void GSTextureCache::InvalidateLocalMem(const GSOffset* o, const GSVector4i& r) } // Grandia3, FFX, FFX-2 pause menus. t->m_TEX0.TBP0 magic number checks because otherwise kills xs2 videos - if( (GSUtil::HasSharedBits(psm, t->m_TEX0.PSM) && (bp > t->m_TEX0.TBP0) ) + if( (GSUtil::HasSharedBits(psm, t->m_TEX0.PSM) && (bp > t->m_TEX0.TBP0) ) && ((t->m_TEX0.TBP0 == 0) || (t->m_TEX0.TBP0==3328) || (t->m_TEX0.TBP0==3584) )) { //printf("first : %d-%d child : %d-%d\n", psm, bp, t->m_TEX0.PSM, t->m_TEX0.TBP0); @@ -527,7 +527,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con int tw = 1 << TEX0.TW; int th = 1 << TEX0.TH; int tp = TEX0.TBW << 6; - + bool hack = false; if(dst == NULL) @@ -552,18 +552,18 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con src->m_target = true; - if(dst->m_type != RenderTarget) + if(dst->m_type != RenderTarget) { // TODO delete src; - return NULL; + return NULL; } dst->Update(); GSTexture* tmp = NULL; - - if(dst->m_texture->IsMSAA()) + + if(dst->m_texture->IsMSAA()) { tmp = dst->m_texture; @@ -573,7 +573,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con // do not round here!!! if edge becomes a black pixel and addressing mode is clamp => everything outside the clamped area turns into black (kh2 shadows) int w = (int)(dst->m_texture->GetScale().x * tw); - int h = (int)(dst->m_texture->GetScale().y * th); + int h = (int)(dst->m_texture->GetScale().y * th); GSVector2i dstsize = dst->m_texture->GetSize(); @@ -641,14 +641,14 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con GSVector4 dr(0, 0, w, h); - if(w > dstsize.x) + if(w > dstsize.x) { scale.x = (float)dstsize.x / tw; dr.z = (float)dstsize.x * scale.x / dst->m_texture->GetScale().x; w = dstsize.x; } - - if(h > dstsize.y) + + if(h > dstsize.y) { scale.y = (float)dstsize.y / th; dr.w = (float)dstsize.y * scale.y / dst->m_texture->GetScale().y; @@ -656,7 +656,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con } GSVector4 sr(0, 0, w, h); - + if (UserHacks_HalfPixelOffset && hack) { int multiplier = m_renderer->upscale_Multiplier(); @@ -723,8 +723,8 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con src->m_fmt = FMT_8H; src->m_palette = m_renderer->m_dev->CreateTexture(256, 1); break; - case PSM_PSMT8: - //Not sure, this wasn't handled at all. + case PSM_PSMT8: + //Not sure, this wasn't handled at all. //Xenosaga 2 and 3 use it, Tales of Legendia as well. //It's always used for fog like effects. src->m_fmt = FMT_8; @@ -866,7 +866,7 @@ void GSTextureCache::Source::Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TE int tw = std::max(1 << m_TEX0.TW, bs.x); int th = std::max(1 << m_TEX0.TH, bs.y); - GSVector4i r = rect.ralign(bs); + GSVector4i r = rect.ralign(bs); if(r.eq(GSVector4i(0, 0, tw, th))) { @@ -1079,11 +1079,11 @@ void GSTextureCache::Target::Update() else { static uint8* buff = (uint8*)::_aligned_malloc(1024 * 1024 * 4, 16); - + int pitch = ((w + 3) & ~3) * 4; m_renderer->m_mem.ReadTexture(o, r, buff, pitch, TEXA); - + t->Update(r.rsize(), buff, pitch); } @@ -1191,4 +1191,4 @@ void GSTextureCache::SourceMap::RemoveAt(Source* s) } delete s; -} \ No newline at end of file +} diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index 55d8bcbcf3..cdd5d7c5db 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSTextureCache11.cpp b/plugins/GSdx/GSTextureCache11.cpp index fe598b5dc1..a1d2a8f5b9 100644 --- a/plugins/GSdx/GSTextureCache11.cpp +++ b/plugins/GSdx/GSTextureCache11.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -31,16 +31,16 @@ GSTextureCache11::GSTextureCache11(GSRenderer* r) void GSTextureCache11::Read(Target* t, const GSVector4i& r) { - if(t->m_type != RenderTarget) + if(t->m_type != RenderTarget) { // TODO - return; + return; } const GIFRegTEX0& TEX0 = t->m_TEX0; - if(TEX0.PSM != PSM_PSMCT32 + if(TEX0.PSM != PSM_PSMCT32 && TEX0.PSM != PSM_PSMCT24 && TEX0.PSM != PSM_PSMCT16 && TEX0.PSM != PSM_PSMCT16S) diff --git a/plugins/GSdx/GSTextureCache11.h b/plugins/GSdx/GSTextureCache11.h index 4900955d08..2ab4e4766e 100644 --- a/plugins/GSdx/GSTextureCache11.h +++ b/plugins/GSdx/GSTextureCache11.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSTextureCache9.cpp b/plugins/GSdx/GSTextureCache9.cpp index 571db7a759..4da51debd3 100644 --- a/plugins/GSdx/GSTextureCache9.cpp +++ b/plugins/GSdx/GSTextureCache9.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -31,16 +31,16 @@ GSTextureCache9::GSTextureCache9(GSRenderer* r) void GSTextureCache9::Read(Target* t, const GSVector4i& r) { - if(t->m_type != RenderTarget) + if(t->m_type != RenderTarget) { // TODO - return; + return; } const GIFRegTEX0& TEX0 = t->m_TEX0; - if(TEX0.PSM != PSM_PSMCT32 + if(TEX0.PSM != PSM_PSMCT32 && TEX0.PSM != PSM_PSMCT24 && TEX0.PSM != PSM_PSMCT16 && TEX0.PSM != PSM_PSMCT16S) diff --git a/plugins/GSdx/GSTextureCache9.h b/plugins/GSdx/GSTextureCache9.h index 20437f5ce8..f4974a6210 100644 --- a/plugins/GSdx/GSTextureCache9.h +++ b/plugins/GSdx/GSTextureCache9.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -33,4 +33,4 @@ protected: public: GSTextureCache9(GSRenderer* r); -}; \ No newline at end of file +}; diff --git a/plugins/GSdx/GSTextureCacheSW.cpp b/plugins/GSdx/GSTextureCacheSW.cpp index df8bfb7762..d4b5fd0eb6 100644 --- a/plugins/GSdx/GSTextureCacheSW.cpp +++ b/plugins/GSdx/GSTextureCacheSW.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSTextureCacheSW.h b/plugins/GSdx/GSTextureCacheSW.h index 94bb165863..fd2a1c031f 100644 --- a/plugins/GSdx/GSTextureCacheSW.h +++ b/plugins/GSdx/GSTextureCacheSW.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSTextureFX.cpp b/plugins/GSdx/GSTextureFX.cpp index ce9a21197e..15b2e18822 100644 --- a/plugins/GSdx/GSTextureFX.cpp +++ b/plugins/GSdx/GSTextureFX.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -22,12 +22,12 @@ #include "stdafx.h" #include "GSTextureFX.h" -GSTextureFX::GSTextureFX() +GSTextureFX::GSTextureFX() : m_dev(NULL) { } -bool GSTextureFX::Create(GSDevice* dev) +bool GSTextureFX::Create(GSDevice* dev) { m_dev = dev; diff --git a/plugins/GSdx/GSTextureFX11.cpp b/plugins/GSdx/GSTextureFX11.cpp index fc3c244e16..991d651b0e 100644 --- a/plugins/GSdx/GSTextureFX11.cpp +++ b/plugins/GSdx/GSTextureFX11.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -59,7 +59,7 @@ bool GSDevice11::CreateTextureFX() sd.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sd.MaxLOD = FLT_MAX; - sd.MaxAnisotropy = 16; + sd.MaxAnisotropy = 16; sd.ComparisonFunc = D3D11_COMPARISON_NEVER; hr = m_dev->CreateSamplerState(&sd, &m_palette_ss); @@ -212,7 +212,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe }; CComPtr ps; - + CompileShader(IDR_TFX_FX, "ps_main", macro, &ps); m_ps[sel] = ps; @@ -258,7 +258,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sd.MaxLOD = FLT_MAX; - sd.MaxAnisotropy = 16; + sd.MaxAnisotropy = 16; sd.ComparisonFunc = D3D11_COMPARISON_NEVER; m_dev->CreateSamplerState(&sd, &ss0); @@ -302,11 +302,11 @@ void GSDevice11::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uin if(dssel.ztst != ZTST_ALWAYS || dssel.zwe) { - static const D3D11_COMPARISON_FUNC ztst[] = + static const D3D11_COMPARISON_FUNC ztst[] = { - D3D11_COMPARISON_NEVER, - D3D11_COMPARISON_ALWAYS, - D3D11_COMPARISON_GREATER_EQUAL, + D3D11_COMPARISON_NEVER, + D3D11_COMPARISON_ALWAYS, + D3D11_COMPARISON_GREATER_EQUAL, D3D11_COMPARISON_GREATER }; diff --git a/plugins/GSdx/GSTextureFX9.cpp b/plugins/GSdx/GSTextureFX9.cpp index 4de4b18a6b..3e1c04732f 100644 --- a/plugins/GSdx/GSTextureFX9.cpp +++ b/plugins/GSdx/GSTextureFX9.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -245,11 +245,11 @@ void GSDevice9::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint if(dssel.ztst != ZTST_ALWAYS || dssel.zwe) { - static const D3DCMPFUNC ztst[] = + static const D3DCMPFUNC ztst[] = { - D3DCMP_NEVER, - D3DCMP_ALWAYS, - D3DCMP_GREATEREQUAL, + D3DCMP_NEVER, + D3DCMP_ALWAYS, + D3DCMP_GREATEREQUAL, D3DCMP_GREATER }; diff --git a/plugins/GSdx/GSTextureNull.cpp b/plugins/GSdx/GSTextureNull.cpp index 04c28e874f..395564d7e9 100644 --- a/plugins/GSdx/GSTextureNull.cpp +++ b/plugins/GSdx/GSTextureNull.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSTextureNull.h b/plugins/GSdx/GSTextureNull.h index 988215d32f..0dc70c6d40 100644 --- a/plugins/GSdx/GSTextureNull.h +++ b/plugins/GSdx/GSTextureNull.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSThread.cpp b/plugins/GSdx/GSThread.cpp index f4b19e4243..33449c13ab 100644 --- a/plugins/GSdx/GSThread.cpp +++ b/plugins/GSdx/GSThread.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSThread.h b/plugins/GSdx/GSThread.h index 2a2be1b0c5..7187d4e878 100644 --- a/plugins/GSdx/GSThread.h +++ b/plugins/GSdx/GSThread.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSUtil.cpp b/plugins/GSdx/GSUtil.cpp index 8aabf333fb..464f743f95 100644 --- a/plugins/GSdx/GSUtil.cpp +++ b/plugins/GSdx/GSUtil.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -103,18 +103,18 @@ bool GSUtil::CheckDirectX() OSVERSIONINFOEX version; memset(&version, 0, sizeof(version)); version.dwOSVersionInfoSize = sizeof(version); - + if(GetVersionEx((OSVERSIONINFO*)&version)) { printf("Windows %d.%d.%d", - version.dwMajorVersion, - version.dwMinorVersion, + version.dwMajorVersion, + version.dwMinorVersion, version.dwBuildNumber); if(version.wServicePackMajor > 0) { printf(" (%s %d.%d)", - version.szCSDVersion, + version.szCSDVersion, version.wServicePackMajor, version.wServicePackMinor); } @@ -129,10 +129,10 @@ bool GSUtil::CheckDirectX() if(S_OK == d3d->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &id)) { printf("%s (%d.%d.%d.%d)\n", - id.Description, - id.DriverVersion.HighPart >> 16, - id.DriverVersion.HighPart & 0xffff, - id.DriverVersion.LowPart >> 16, + id.Description, + id.DriverVersion.HighPart >> 16, + id.DriverVersion.HighPart & 0xffff, + id.DriverVersion.LowPart >> 16, id.DriverVersion.LowPart & 0xffff); } @@ -180,7 +180,7 @@ bool GSUtil::CheckSSE() if(!cpu.has(type)) { string s = format("This CPU does not support SSE %d.%02d", _M_SSE >> 8, _M_SSE & 0xff); - + MessageBox(GetActiveWindow(), s.c_str(), "GSdx", MB_OK); return false; @@ -211,7 +211,7 @@ bool GSUtil::IsDirect3D11Available() char* GSUtil::GetLibName() { static string str; - + str = format("GSdx %d", SVN_REV); if(SVN_MODS) str += "m"; @@ -229,7 +229,7 @@ char* GSUtil::GetLibName() #elif _MSC_VER sl.push_back(format("MSVC %d.%02d", _MSC_VER / 100, _MSC_VER % 100)); #endif - + #if _M_SSE >= 0x402 sl.push_back("SSE42"); #elif _M_SSE >= 0x401 @@ -250,4 +250,4 @@ char* GSUtil::GetLibName() } return (char*)str.c_str(); -} \ No newline at end of file +} diff --git a/plugins/GSdx/GSUtil.h b/plugins/GSdx/GSUtil.h index 095bf9b065..97c396fde6 100644 --- a/plugins/GSdx/GSUtil.h +++ b/plugins/GSdx/GSUtil.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSVector.cpp b/plugins/GSdx/GSVector.cpp index d7f6e7ec77..cfb62c47d1 100644 --- a/plugins/GSdx/GSVector.cpp +++ b/plugins/GSdx/GSVector.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSVector.h b/plugins/GSdx/GSVector.h index e653a18146..c7b920d4b9 100644 --- a/plugins/GSdx/GSVector.h +++ b/plugins/GSdx/GSVector.h @@ -10,20 +10,20 @@ template class GSVector2T { public: - union + union { - struct {T x, y;}; - struct {T r, g;}; + struct {T x, y;}; + struct {T r, g;}; struct {T v[2];}; }; GSVector2T() { } - - GSVector2T(T x, T y) + + GSVector2T(T x, T y) { - this->x = x; + this->x = x; this->y = y; } @@ -46,11 +46,11 @@ class GSVector4; __aligned16 class GSVector4i { public: - union + union { - struct {int x, y, z, w;}; + struct {int x, y, z, w;}; struct {int r, g, b, a;}; - struct {int left, top, right, bottom;}; + struct {int left, top, right, bottom;}; int v[4]; float f32[4]; int8 i8[16]; @@ -64,15 +64,15 @@ public: __m128i m; }; - GSVector4i() + GSVector4i() { } - GSVector4i(int x, int y, int z, int w) + GSVector4i(int x, int y, int z, int w) { // 4 gprs - // m = _mm_set_epi32(w, z, y, x); + // m = _mm_set_epi32(w, z, y, x); // 2 gprs @@ -82,22 +82,22 @@ public: *this = xz.upl32(yw); } - GSVector4i(int x, int y) + GSVector4i(int x, int y) { *this = load(x).upl32(load(y)); } - GSVector4i(short s0, short s1, short s2, short s3, short s4, short s5, short s6, short s7) + GSVector4i(short s0, short s1, short s2, short s3, short s4, short s5, short s6, short s7) { m = _mm_set_epi16(s7, s6, s5, s4, s3, s2, s1, s0); } - GSVector4i(char b0, char b1, char b2, char b3, char b4, char b5, char b6, char b7, char b8, char b9, char b10, char b11, char b12, char b13, char b14, char b15) + GSVector4i(char b0, char b1, char b2, char b3, char b4, char b5, char b6, char b7, char b8, char b9, char b10, char b11, char b12, char b13, char b14, char b15) { m = _mm_set_epi8(b15, b14, b13, b12, b11, b10, b9, b8, b7, b6, b5, b4, b3, b2, b1, b0); } - GSVector4i(const GSVector4i& v) + GSVector4i(const GSVector4i& v) { m = v.m; } @@ -107,7 +107,7 @@ public: m = _mm_loadl_epi64((__m128i*)&v); } - explicit GSVector4i(int i) + explicit GSVector4i(int i) { m = _mm_set1_epi32(i); } @@ -119,22 +119,22 @@ public: explicit GSVector4i(const GSVector4& v); - void operator = (const GSVector4i& v) + void operator = (const GSVector4i& v) { m = v.m; } - void operator = (int i) + void operator = (int i) { m = _mm_set1_epi32(i); } - void operator = (__m128i m) + void operator = (__m128i m) { this->m = m; } - operator __m128i() const + operator __m128i() const { return m; } @@ -161,7 +161,7 @@ public: return (*this < zwzw()).mask() != 0x00ff; } - GSVector4i runion(const GSVector4i& a) const + GSVector4i runion(const GSVector4i& a) const { int i = (upl64(a) < uph64(a)).mask(); @@ -191,14 +191,14 @@ public: return GSVector4i::zero(); } - GSVector4i rintersect(const GSVector4i& a) const + GSVector4i rintersect(const GSVector4i& a) const { return sat_i32(a); } enum RoundMode {Outside, Inside, NegInf, PosInf}; - template GSVector4i ralign(const GSVector2i& a) const + template GSVector4i ralign(const GSVector2i& a) const { // a must be 1 << n @@ -208,9 +208,9 @@ public: switch(mode) { - case Inside: v = *this + mask; break; + case Inside: v = *this + mask; break; case Outside: v = *this + mask.zwxy(); break; - case NegInf: v = *this; break; + case NegInf: v = *this; break; case PosInf: v = *this + mask.zwzw(); break; default: ASSERT(0); break; } @@ -252,43 +252,43 @@ public: #if _M_SSE >= 0x401 - GSVector4i sat_i8(const GSVector4i& a, const GSVector4i& b) const + GSVector4i sat_i8(const GSVector4i& a, const GSVector4i& b) const { return max_i8(a).min_i8(b); } - GSVector4i sat_i8(const GSVector4i& a) const + GSVector4i sat_i8(const GSVector4i& a) const { return max_i8(a.xyxy()).min_i8(a.zwzw()); } #endif - GSVector4i sat_i16(const GSVector4i& a, const GSVector4i& b) const + GSVector4i sat_i16(const GSVector4i& a, const GSVector4i& b) const { return max_i16(a).min_i16(b); } - GSVector4i sat_i16(const GSVector4i& a) const + GSVector4i sat_i16(const GSVector4i& a) const { return max_i16(a.xyxy()).min_i16(a.zwzw()); } #if _M_SSE >= 0x401 - GSVector4i sat_i32(const GSVector4i& a, const GSVector4i& b) const + GSVector4i sat_i32(const GSVector4i& a, const GSVector4i& b) const { return max_i32(a).min_i32(b); } - GSVector4i sat_i32(const GSVector4i& a) const + GSVector4i sat_i32(const GSVector4i& a) const { return max_i32(a.xyxy()).min_i32(a.zwzw()); } #else - GSVector4i sat_i32(const GSVector4i& a, const GSVector4i& b) const + GSVector4i sat_i32(const GSVector4i& a, const GSVector4i& b) const { GSVector4i v; @@ -300,7 +300,7 @@ public: return v; } - GSVector4i sat_i32(const GSVector4i& a) const + GSVector4i sat_i32(const GSVector4i& a) const { GSVector4i v; @@ -314,24 +314,24 @@ public: #endif - GSVector4i sat_u8(const GSVector4i& a, const GSVector4i& b) const + GSVector4i sat_u8(const GSVector4i& a, const GSVector4i& b) const { return max_u8(a).min_u8(b); } - GSVector4i sat_u8(const GSVector4i& a) const + GSVector4i sat_u8(const GSVector4i& a) const { return max_u8(a.xyxy()).min_u8(a.zwzw()); } #if _M_SSE >= 0x401 - GSVector4i sat_u16(const GSVector4i& a, const GSVector4i& b) const + GSVector4i sat_u16(const GSVector4i& a, const GSVector4i& b) const { return max_u16(a).min_u16(b); } - GSVector4i sat_u16(const GSVector4i& a) const + GSVector4i sat_u16(const GSVector4i& a) const { return max_u16(a.xyxy()).min_u16(a.zwzw()); } @@ -340,12 +340,12 @@ public: #if _M_SSE >= 0x401 - GSVector4i sat_u32(const GSVector4i& a, const GSVector4i& b) const + GSVector4i sat_u32(const GSVector4i& a, const GSVector4i& b) const { return max_u32(a).min_u32(b); } - GSVector4i sat_u32(const GSVector4i& a) const + GSVector4i sat_u32(const GSVector4i& a) const { return max_u32(a.xyxy()).min_u32(a.zwzw()); } @@ -466,9 +466,9 @@ public: #if _M_SSE >= 0x401 return blend16<0xaa>(a); - + #else - + return blend8(a, GSVector4i::xffff0000()); #endif @@ -507,12 +507,12 @@ public: { return GSVector4i(_mm_packs_epi32(m, a)); } - + GSVector4i ps32() const { return GSVector4i(_mm_packs_epi32(m, m)); } - + #if _M_SSE >= 0x401 GSVector4i pu32(const GSVector4i& a) const @@ -572,7 +572,7 @@ public: #if 0 // _M_SSE >= 0x401 // TODO: compiler bug return GSVector4i(_mm_cvtepu8_epi16(m)); - + #else return GSVector4i(_mm_unpacklo_epi8(m, _mm_setzero_si128())); @@ -590,7 +590,7 @@ public: #if 0 //_M_SSE >= 0x401 // TODO: compiler bug return GSVector4i(_mm_cvtepu16_epi32(m)); - + #else return GSVector4i(_mm_unpacklo_epi16(m, _mm_setzero_si128())); @@ -608,7 +608,7 @@ public: #if 0 //_M_SSE >= 0x401 // TODO: compiler bug return GSVector4i(_mm_cvtepu32_epi64(m)); - + #else return GSVector4i(_mm_unpacklo_epi32(m, _mm_setzero_si128())); @@ -940,7 +940,7 @@ public: #if _M_SSE >= 0x301 - if(shift == 0) + if(shift == 0) { return mul16hrs(f); } @@ -1347,7 +1347,7 @@ public: template __forceinline GSVector4i gather32_8(const T* ptr) const { return GSVector4i( - (int)ptr[extract8()], + (int)ptr[extract8()], (int)ptr[extract8()], (int)ptr[extract8()], (int)ptr[extract8()]); @@ -1365,8 +1365,8 @@ public: template __forceinline GSVector4i gather32_32(const T* ptr) const { return GSVector4i( - (int)ptr[extract32<0>()], - (int)ptr[extract32<1>()], + (int)ptr[extract32<0>()], + (int)ptr[extract32<1>()], (int)ptr[extract32<2>()], (int)ptr[extract32<3>()]); } @@ -1374,7 +1374,7 @@ public: template __forceinline GSVector4i gather32_32(const T1* ptr1, const T2* ptr2) const { return GSVector4i( - (int)ptr2[ptr1[extract32<0>()]], + (int)ptr2[ptr1[extract32<0>()]], (int)ptr2[ptr1[extract32<1>()]], (int)ptr2[ptr1[extract32<2>()]], (int)ptr2[ptr1[extract32<3>()]]); @@ -1819,7 +1819,7 @@ public: for(int i = 0; i < size; i++) { - if(!d[i].eq(s[i])) + if(!d[i].eq(s[i])) { return false; } @@ -1877,32 +1877,32 @@ public: return v.alltrue(); } - void operator += (const GSVector4i& v) + void operator += (const GSVector4i& v) { m = _mm_add_epi32(m, v); } - void operator -= (const GSVector4i& v) + void operator -= (const GSVector4i& v) { m = _mm_sub_epi32(m, v); } - void operator += (int i) + void operator += (int i) { *this += GSVector4i(i); } - void operator -= (int i) + void operator -= (int i) { *this -= GSVector4i(i); } - void operator <<= (const int i) + void operator <<= (const int i) { m = _mm_slli_epi32(m, i); } - void operator >>= (const int i) + void operator >>= (const int i) { m = _mm_srli_epi32(m, i); } @@ -1912,12 +1912,12 @@ public: m = _mm_and_si128(m, v); } - void operator |= (const GSVector4i& v) + void operator |= (const GSVector4i& v) { m = _mm_or_si128(m, v); } - void operator ^= (const GSVector4i& v) + void operator ^= (const GSVector4i& v) { m = _mm_xor_si128(m, v); } @@ -1927,7 +1927,7 @@ public: return GSVector4i(_mm_add_epi32(v1, v2)); } - friend GSVector4i operator - (const GSVector4i& v1, const GSVector4i& v2) + friend GSVector4i operator - (const GSVector4i& v1, const GSVector4i& v2) { return GSVector4i(_mm_sub_epi32(v1, v2)); } @@ -1936,83 +1936,83 @@ public: { return v + GSVector4i(i); } - + friend GSVector4i operator - (const GSVector4i& v, int i) { return v - GSVector4i(i); } - - friend GSVector4i operator << (const GSVector4i& v, const int i) + + friend GSVector4i operator << (const GSVector4i& v, const int i) { return GSVector4i(_mm_slli_epi32(v, i)); } - - friend GSVector4i operator >> (const GSVector4i& v, const int i) + + friend GSVector4i operator >> (const GSVector4i& v, const int i) { return GSVector4i(_mm_srli_epi32(v, i)); } - + friend GSVector4i operator & (const GSVector4i& v1, const GSVector4i& v2) { return GSVector4i(_mm_and_si128(v1, v2)); } - + friend GSVector4i operator | (const GSVector4i& v1, const GSVector4i& v2) { return GSVector4i(_mm_or_si128(v1, v2)); } - - friend GSVector4i operator ^ (const GSVector4i& v1, const GSVector4i& v2) + + friend GSVector4i operator ^ (const GSVector4i& v1, const GSVector4i& v2) { return GSVector4i(_mm_xor_si128(v1, v2)); } - - friend GSVector4i operator & (const GSVector4i& v, int i) + + friend GSVector4i operator & (const GSVector4i& v, int i) { return v & GSVector4i(i); } - - friend GSVector4i operator | (const GSVector4i& v, int i) + + friend GSVector4i operator | (const GSVector4i& v, int i) { return v | GSVector4i(i); } - - friend GSVector4i operator ^ (const GSVector4i& v, int i) + + friend GSVector4i operator ^ (const GSVector4i& v, int i) { return v ^ GSVector4i(i); } - - friend GSVector4i operator ~ (const GSVector4i& v) + + friend GSVector4i operator ~ (const GSVector4i& v) { return v ^ (v == v); } - friend GSVector4i operator == (const GSVector4i& v1, const GSVector4i& v2) + friend GSVector4i operator == (const GSVector4i& v1, const GSVector4i& v2) { return GSVector4i(_mm_cmpeq_epi32(v1, v2)); } - - friend GSVector4i operator != (const GSVector4i& v1, const GSVector4i& v2) + + friend GSVector4i operator != (const GSVector4i& v1, const GSVector4i& v2) { return ~(v1 == v2); } - - friend GSVector4i operator > (const GSVector4i& v1, const GSVector4i& v2) + + friend GSVector4i operator > (const GSVector4i& v1, const GSVector4i& v2) { return GSVector4i(_mm_cmpgt_epi32(v1, v2)); } - - friend GSVector4i operator < (const GSVector4i& v1, const GSVector4i& v2) + + friend GSVector4i operator < (const GSVector4i& v1, const GSVector4i& v2) { return GSVector4i(_mm_cmplt_epi32(v1, v2)); } - - friend GSVector4i operator >= (const GSVector4i& v1, const GSVector4i& v2) + + friend GSVector4i operator >= (const GSVector4i& v1, const GSVector4i& v2) { return (v1 > v2) | (v1 == v2); } - - friend GSVector4i operator <= (const GSVector4i& v1, const GSVector4i& v2) + + friend GSVector4i operator <= (const GSVector4i& v1, const GSVector4i& v2) { return (v1 < v2) | (v1 == v2); } @@ -2256,11 +2256,11 @@ public: __aligned16 class GSVector4 { public: - union + union { - struct {float x, y, z, w;}; - struct {float r, g, b, a;}; - struct {float left, top, right, bottom;}; + struct {float x, y, z, w;}; + struct {float r, g, b, a;}; + struct {float left, top, right, bottom;}; float v[4]; float f32[4]; int8 i8[16]; @@ -2306,7 +2306,7 @@ public: m = _mm_cvtepi32_ps(_mm_unpacklo_epi32(_mm_cvtsi32_si128(x), _mm_cvtsi32_si128(y))); } - GSVector4(const GSVector4& v) + GSVector4(const GSVector4& v) { m = v.m; } @@ -2358,7 +2358,7 @@ public: *this = GSVector4(GSVector4i::load((int)u32).u8to32()); } - operator __m128() const + operator __m128() const { return m; } @@ -2370,22 +2370,22 @@ public: static GSVector4 cast(const GSVector4i& v); - GSVector4 abs() const + GSVector4 abs() const { return *this & cast(GSVector4i::x7fffffff()); } - GSVector4 neg() const + GSVector4 neg() const { return *this ^ cast(GSVector4i::x80000000()); } - GSVector4 rcp() const + GSVector4 rcp() const { return GSVector4(_mm_rcp_ps(m)); } - GSVector4 rcpnr() const + GSVector4 rcpnr() const { GSVector4 v = rcp(); @@ -2394,7 +2394,7 @@ public: enum RoundMode {NearestInt = 8, NegInf = 9, PosInf = 10}; - template GSVector4 round() const + template GSVector4 round() const { #if _M_SSE >= 0x401 @@ -2425,22 +2425,22 @@ public: #endif } - GSVector4 floor() const + GSVector4 floor() const { return round(); } - GSVector4 ceil() const + GSVector4 ceil() const { return round(); } - GSVector4 mod2x(const GSVector4& f, const int scale = 256) const + GSVector4 mod2x(const GSVector4& f, const int scale = 256) const { return *this * (f * (2.0f / scale)); } - GSVector4 mod2x(float f, const int scale = 256) const + GSVector4 mod2x(float f, const int scale = 256) const { return mod2x(GSVector4(f), scale); } @@ -2465,12 +2465,12 @@ public: return -b - *this * a; // TODO: _mm_fmnsub_ps } - GSVector4 lerp(const GSVector4& v, const GSVector4& f) const + GSVector4 lerp(const GSVector4& v, const GSVector4& f) const { return *this + (v - *this) * f; } - GSVector4 lerp(const GSVector4& v, float f) const + GSVector4 lerp(const GSVector4& v, float f) const { return lerp(v, GSVector4(f)); } @@ -2494,28 +2494,28 @@ public: } #if _M_SSE >= 0x401 - template GSVector4 dp(const GSVector4& v) const + template GSVector4 dp(const GSVector4& v) const { return GSVector4(_mm_dp_ps(m, v.m, i)); } #endif - GSVector4 sat(const GSVector4& a, const GSVector4& b) const + GSVector4 sat(const GSVector4& a, const GSVector4& b) const { return GSVector4(_mm_min_ps(_mm_max_ps(m, a), b)); } - GSVector4 sat(const GSVector4& a) const + GSVector4 sat(const GSVector4& a) const { return GSVector4(_mm_min_ps(_mm_max_ps(m, a.xyxy()), a.zwzw())); } - GSVector4 sat(const float scale = 255) const + GSVector4 sat(const float scale = 255) const { return sat(zero(), GSVector4(scale)); } - GSVector4 clamp(const float scale = 255) const + GSVector4 clamp(const float scale = 255) const { return min(GSVector4(scale)); } @@ -2556,12 +2556,12 @@ public: GSVector4 l2h(const GSVector4& a) const { return GSVector4(_mm_movelh_ps(m, a)); - } + } GSVector4 h2l(const GSVector4& a) const { return GSVector4(_mm_movehl_ps(m, a)); - } + } GSVector4 andnot(const GSVector4& v) const { @@ -2599,12 +2599,12 @@ public: #endif } - static GSVector4 zero() + static GSVector4 zero() { return GSVector4(_mm_setzero_ps()); } - static GSVector4 xffffffff() + static GSVector4 xffffffff() { return zero() == zero(); } @@ -2701,42 +2701,42 @@ public: return neg(); } - void operator += (const GSVector4& v) + void operator += (const GSVector4& v) { m = _mm_add_ps(m, v); } - void operator -= (const GSVector4& v) + void operator -= (const GSVector4& v) { m = _mm_sub_ps(m, v); } - void operator *= (const GSVector4& v) + void operator *= (const GSVector4& v) { m = _mm_mul_ps(m, v); } - void operator /= (const GSVector4& v) + void operator /= (const GSVector4& v) { m = _mm_div_ps(m, v); } - void operator += (float f) + void operator += (float f) { *this += GSVector4(f); } - void operator -= (float f) + void operator -= (float f) { *this -= GSVector4(f); } - void operator *= (float f) + void operator *= (float f) { *this *= GSVector4(f); } - void operator /= (float f) + void operator /= (float f) { *this /= GSVector4(f); } @@ -2746,22 +2746,22 @@ public: m = _mm_and_ps(m, v); } - void operator |= (const GSVector4& v) + void operator |= (const GSVector4& v) { m = _mm_or_ps(m, v); } - void operator ^= (const GSVector4& v) + void operator ^= (const GSVector4& v) { m = _mm_xor_ps(m, v); } - friend GSVector4 operator + (const GSVector4& v1, const GSVector4& v2) + friend GSVector4 operator + (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_add_ps(v1, v2)); } - friend GSVector4 operator - (const GSVector4& v1, const GSVector4& v2) + friend GSVector4 operator - (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_sub_ps(v1, v2)); } @@ -2771,27 +2771,27 @@ public: return GSVector4(_mm_mul_ps(v1, v2)); } - friend GSVector4 operator / (const GSVector4& v1, const GSVector4& v2) + friend GSVector4 operator / (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_div_ps(v1, v2)); } - friend GSVector4 operator + (const GSVector4& v, float f) + friend GSVector4 operator + (const GSVector4& v, float f) { return v + GSVector4(f); } - friend GSVector4 operator - (const GSVector4& v, float f) + friend GSVector4 operator - (const GSVector4& v, float f) { return v - GSVector4(f); } - friend GSVector4 operator * (const GSVector4& v, float f) + friend GSVector4 operator * (const GSVector4& v, float f) { return v * GSVector4(f); } - friend GSVector4 operator / (const GSVector4& v, float f) + friend GSVector4 operator / (const GSVector4& v, float f) { return v / GSVector4(f); } @@ -2800,43 +2800,43 @@ public: { return GSVector4(_mm_and_ps(v1, v2)); } - + friend GSVector4 operator | (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_or_ps(v1, v2)); } - - friend GSVector4 operator ^ (const GSVector4& v1, const GSVector4& v2) + + friend GSVector4 operator ^ (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_xor_ps(v1, v2)); } - friend GSVector4 operator == (const GSVector4& v1, const GSVector4& v2) + friend GSVector4 operator == (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_cmpeq_ps(v1, v2)); } - friend GSVector4 operator != (const GSVector4& v1, const GSVector4& v2) + friend GSVector4 operator != (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_cmpneq_ps(v1, v2)); } - friend GSVector4 operator > (const GSVector4& v1, const GSVector4& v2) + friend GSVector4 operator > (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_cmpgt_ps(v1, v2)); } - friend GSVector4 operator < (const GSVector4& v1, const GSVector4& v2) + friend GSVector4 operator < (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_cmplt_ps(v1, v2)); } - friend GSVector4 operator >= (const GSVector4& v1, const GSVector4& v2) + friend GSVector4 operator >= (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_cmpge_ps(v1, v2)); } - friend GSVector4 operator <= (const GSVector4& v1, const GSVector4& v2) + friend GSVector4 operator <= (const GSVector4& v1, const GSVector4& v2) { return GSVector4(_mm_cmple_ps(v1, v2)); } diff --git a/plugins/GSdx/GSVertex.h b/plugins/GSdx/GSVertex.h index 9032351680..99a48b37d1 100644 --- a/plugins/GSdx/GSVertex.h +++ b/plugins/GSdx/GSVertex.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -68,7 +68,7 @@ struct GSVertexPT2 GSVector2 t[2]; }; -struct GSVertexNull +struct GSVertexNull { GSVector4 p; }; diff --git a/plugins/GSdx/GSVertexHW.h b/plugins/GSdx/GSVertexHW.h index 641f993ae4..4b640ecf9c 100644 --- a/plugins/GSdx/GSVertexHW.h +++ b/plugins/GSdx/GSVertexHW.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -30,7 +30,7 @@ __aligned16 union GSVertexHW9 { struct { - union + union { struct { @@ -52,7 +52,7 @@ __aligned16 union GSVertexHW9 struct {GSVector4 vf[2];}; GSVertexHW9& operator = (GSVertexHW9& v) {vi[0] = v.vi[0]; vi[1] = v.vi[1]; return *this;} - + float GetQ() {return p.w;} }; @@ -66,19 +66,19 @@ __aligned16 union GSVertexHW11 GIFRegST ST; }; - union + union { union {struct {uint8 r, g, b, a; float q;}; uint32 c0;}; GIFRegRGBAQ RGBAQ; }; - + union { struct {union {struct {uint16 x, y;}; uint32 xy;}; uint32 z;} p; GIFRegXYZ XYZ; }; - union + union { struct {uint32 _pad; union {struct {uint8 ta0, ta1, res, f;}; uint32 c1;};}; GIFRegFOG FOG; diff --git a/plugins/GSdx/GSVertexList.cpp b/plugins/GSdx/GSVertexList.cpp index b51ecaba10..9c30fd7794 100644 --- a/plugins/GSdx/GSVertexList.cpp +++ b/plugins/GSdx/GSVertexList.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,18 +6,18 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ #include "StdAfx.h" -#include "GSVertexList.h" \ No newline at end of file +#include "GSVertexList.h" diff --git a/plugins/GSdx/GSVertexList.h b/plugins/GSdx/GSVertexList.h index c6edc3dc61..daf60e6a57 100644 --- a/plugins/GSdx/GSVertexList.h +++ b/plugins/GSdx/GSVertexList.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSVertexSW.cpp b/plugins/GSdx/GSVertexSW.cpp index ea5dbf29c9..ce4dd64dea 100644 --- a/plugins/GSdx/GSVertexSW.cpp +++ b/plugins/GSdx/GSVertexSW.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSVertexSW.h b/plugins/GSdx/GSVertexSW.h index 28e4644b2a..722efb5dd1 100644 --- a/plugins/GSdx/GSVertexSW.h +++ b/plugins/GSdx/GSVertexSW.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -58,26 +58,26 @@ __aligned16 union GSVertexSW int i; - if(v12.allfalse()) + if(v12.allfalse()) { test = (v01 ^ v02) & (v01 ^ v02.zwxy()); vtl = v0; vbr = v1 + (v2 - v0); - i = 0; + i = 0; } - else if(v02.allfalse()) + else if(v02.allfalse()) { test = (v01 ^ v12) & (v01 ^ v12.zwxy()); vtl = v1; vbr = v0 + (v2 - v1); - i = 1; + i = 1; } - else if(v01.allfalse()) + else if(v01.allfalse()) { test = (v02 ^ v12) & (v02 ^ v12.zwxy()); vtl = v2; vbr = v0 + (v1 - v2); - i = 2; + i = 2; } else { @@ -99,22 +99,22 @@ __aligned16 union GSVertexSW GSVector4 v45 = v4 == v5; GSVector4 v35 = v3 == v5; - if(v34.allfalse()) + if(v34.allfalse()) { test = (v35 ^ v45) & (v35 ^ v45.zwxy()) & (vtl + v5 == v3 + v4) & (vbr == v5); - i = 5; + i = 5; } - else if(v35.allfalse()) + else if(v35.allfalse()) { test = (v34 ^ v45) & (v34 ^ v45.zwxy()) & (vtl + v4 == v3 + v5) & (vbr == v4); - i = 4; + i = 4; } else if(v45.allfalse()) { test = (v34 ^ v35) & (v34 ^ v35.zwxy()) & (vtl + v3 == v5 + v4) & (vbr == v3); - i = 3; + i = 3; } - else + else { return false; } diff --git a/plugins/GSdx/GSVertexTrace.cpp b/plugins/GSdx/GSVertexTrace.cpp index 57f89117ba..30bb54d229 100644 --- a/plugins/GSdx/GSVertexTrace.cpp +++ b/plugins/GSdx/GSVertexTrace.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -55,7 +55,7 @@ void GSVertexTrace::Update(const GSVertexSW* v, int count, GS_PRIM_CLASS primcla } void GSVertexTrace::Update(const GSVertexHW9* v, int count, GS_PRIM_CLASS primclass) -{ +{ m_map_hw9[Hash(primclass)](v, count, m_min, m_max); const GSDrawingContext* context = m_state->m_context; @@ -172,8 +172,8 @@ GSVertexTrace::CGSW::CGSW(uint32 key, void* ptr, size_t maxsize) // min.c = FLT_MAX; // max.c = -FLT_MAX; - movaps(xmm2, xmm0); - movaps(xmm3, xmm1); + movaps(xmm2, xmm0); + movaps(xmm3, xmm1); } // min.p = FLT_MAX; @@ -181,7 +181,7 @@ GSVertexTrace::CGSW::CGSW(uint32 key, void* ptr, size_t maxsize) movaps(xmm4, xmm0); movaps(xmm5, xmm1); - + if(tme) { // min.t = FLT_MAX; @@ -208,9 +208,9 @@ L("loop"); for(int j = 0; j < n; j++) { - if(color && (iip || j == n - 1)) + if(color && (iip || j == n - 1)) { - // min.c = min.c.minv(v[i + j].c); + // min.c = min.c.minv(v[i + j].c); // max.c = max.c.maxv(v[i + j].c); movaps(xmm0, xmmword[edx + j * sizeof(GSVertexSW)]); @@ -219,7 +219,7 @@ L("loop"); maxps(xmm3, xmm0); } - // min.p = min.p.minv(v[i + j].p); + // min.p = min.p.minv(v[i + j].p); // max.p = max.p.maxv(v[i + j].p); movaps(xmm0, xmmword[edx + j * sizeof(GSVertexSW) + 16]); @@ -227,9 +227,9 @@ L("loop"); minps(xmm4, xmm0); maxps(xmm5, xmm0); - if(tme) + if(tme) { - // min.t = min.t.minv(v[i + j].t); + // min.t = min.t.minv(v[i + j].t); // max.t = max.t.maxv(v[i + j].t); movaps(xmm0, xmmword[edx + j * sizeof(GSVertexSW) + 32]); @@ -338,7 +338,7 @@ GSVertexTrace::CGHW9::CGHW9(uint32 key, void* ptr, size_t maxsize) // min.c = 0xffffffff; // max.c = 0; - pcmpeqd(xmm2, xmm2); + pcmpeqd(xmm2, xmm2); pxor(xmm3, xmm3); } @@ -347,7 +347,7 @@ GSVertexTrace::CGHW9::CGHW9(uint32 key, void* ptr, size_t maxsize) movaps(xmm4, xmm0); movaps(xmm5, xmm1); - + if(tme) { // min.t = FLT_MAX; @@ -374,7 +374,7 @@ L("loop"); for(int j = 0; j < n; j++) { - // min.p = min.p.minv(v[i + j].p); + // min.p = min.p.minv(v[i + j].p); // max.p = max.p.maxv(v[i + j].p); movaps(xmm0, xmmword[edx + j * sizeof(GSVertexHW9) + 16]); @@ -393,16 +393,16 @@ L("loop"); movaps(xmm0, xmmword[edx + j * sizeof(GSVertexHW9)]); } - if(color && (iip || j == n - 1)) + if(color && (iip || j == n - 1)) { - // min.c = min.c.min_u8(v[i + j].c); + // min.c = min.c.min_u8(v[i + j].c); // max.c = max.c.min_u8(v[i + j].c); pminub(xmm2, xmm0); pmaxub(xmm3, xmm0); } - if(tme) + if(tme) { shufps(xmm0, xmm0, _MM_SHUFFLE(1, 0, 1, 0)); // avoid FP assist, high part is integral @@ -413,7 +413,7 @@ L("loop"); divps(xmm0, xmm1); } - // min.t = min.t.minv(v[i + j].t); + // min.t = min.t.minv(v[i + j].t); // max.t = max.t.maxv(v[i + j].t); minps(xmm6, xmm0); @@ -532,7 +532,7 @@ GSVertexTrace::CGHW11::CGHW11(uint32 key, void* ptr, size_t maxsize) // min.c = 0xffffffff; // max.c = 0; - pcmpeqd(xmm2, xmm2); + pcmpeqd(xmm2, xmm2); pxor(xmm3, xmm3); } @@ -541,7 +541,7 @@ GSVertexTrace::CGHW11::CGHW11(uint32 key, void* ptr, size_t maxsize) movaps(xmm4, xmm0); movaps(xmm5, xmm1); - + if(tme) { // min.t = FLT_MAX; @@ -594,7 +594,7 @@ L("loop"); } movdqa(xmm0, xmmword[edx + j * sizeof(GSVertexHW11) + 16]); - + if(m_cpu.has(util::Cpu::tSSE41)) { pmovzxwd(xmm1, xmm0); @@ -671,4 +671,4 @@ L("loop"); } ret(); -} \ No newline at end of file +} diff --git a/plugins/GSdx/GSVertexTrace.h b/plugins/GSdx/GSVertexTrace.h index 4ae30596aa..cbc199d528 100644 --- a/plugins/GSdx/GSVertexTrace.h +++ b/plugins/GSdx/GSVertexTrace.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -96,7 +96,7 @@ public: union { - uint32 value; + uint32 value; struct {uint32 r:4, g:4, b:4, a:4, x:1, y:1, z:1, f:1, s:1, t:1, q:1, _pad:1;}; struct {uint32 rgba:16, xyzf:4, stq:4;}; } m_eq; diff --git a/plugins/GSdx/GSWnd.cpp b/plugins/GSdx/GSWnd.cpp index 7ccad2b0de..07da8a22d7 100644 --- a/plugins/GSdx/GSWnd.cpp +++ b/plugins/GSdx/GSWnd.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -83,7 +83,7 @@ LRESULT GSWnd::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) bool GSWnd::Create(const string& title, int w, int h) { if(m_hWnd) return true; - + WNDCLASS wc; memset(&wc, 0, sizeof(wc)); @@ -112,7 +112,7 @@ bool GSWnd::Create(const string& title, int w, int h) bool remote = !!GetSystemMetrics(SM_REMOTESESSION); - if(w <= 0 || h <= 0 || remote) + if(w <= 0 || h <= 0 || remote) { w = r.width() / 3; h = r.width() / 4; @@ -168,7 +168,7 @@ GSVector4i GSWnd::GetClientRect() GSVector4i r; ::GetClientRect(m_hWnd, r); - + return r; } @@ -188,11 +188,11 @@ void GSWnd::Show() if( !m_IsManaged ) return; //SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - + SetForegroundWindow(m_hWnd); - + ShowWindow(m_hWnd, SW_SHOWNORMAL); - + UpdateWindow(m_hWnd); } @@ -208,10 +208,10 @@ void GSWnd::HideFrame() if( !m_IsManaged ) return; SetWindowLong(m_hWnd, GWL_STYLE, GetWindowLong(m_hWnd, GWL_STYLE) & ~(WS_CAPTION|WS_THICKFRAME)); - + SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); - + SetMenu(m_hWnd, NULL); - + m_HasFrame = false; } diff --git a/plugins/GSdx/GSWnd.h b/plugins/GSdx/GSWnd.h index 1ad4cd26ff..9dd1101048 100644 --- a/plugins/GSdx/GSWnd.h +++ b/plugins/GSdx/GSWnd.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/GSdx/GSdx.cpp b/plugins/GSdx/GSdx.cpp index e9e54f7f52..3cdb7e7b26 100644 --- a/plugins/GSdx/GSdx.cpp +++ b/plugins/GSdx/GSdx.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -67,7 +67,7 @@ void GSdxApp::SetConfigDir(const char* dir) { m_ini += '\\'; } - + m_ini += "GSdx.ini"; } } diff --git a/plugins/GSdx/GSdx.h b/plugins/GSdx/GSdx.h index 0ebdfc281c..492fbc6b28 100644 --- a/plugins/GSdx/GSdx.h +++ b/plugins/GSdx/GSdx.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -39,8 +39,8 @@ public: void SetConfig(const char* entry, const char* value); int GetConfig(const char* entry, int value); void SetConfig(const char* entry, int value); - + void SetConfigDir(const char* dir); }; -extern GSdxApp theApp; \ No newline at end of file +extern GSdxApp theApp; diff --git a/plugins/GSdx/baseclasses/amextra.h b/plugins/GSdx/baseclasses/amextra.h index a0f021fa43..6642f5fa40 100644 --- a/plugins/GSdx/baseclasses/amextra.h +++ b/plugins/GSdx/baseclasses/amextra.h @@ -34,7 +34,7 @@ public: HRESULT *phr, LPCWSTR pName); #endif - + // Override methods to track end of stream state STDMETHODIMP EndOfStream(); STDMETHODIMP EndFlush(); diff --git a/plugins/GSdx/baseclasses/amvideo.cpp b/plugins/GSdx/baseclasses/amvideo.cpp index 3a371f0338..35cba88d4c 100644 --- a/plugins/GSdx/baseclasses/amvideo.cpp +++ b/plugins/GSdx/baseclasses/amvideo.cpp @@ -25,16 +25,16 @@ const struct { WORD BitCount; CHAR *pName; WCHAR *wszName; -} BitCountMap[] = { &MEDIASUBTYPE_RGB1, 1, "RGB Monochrome", L"RGB Monochrome", - &MEDIASUBTYPE_RGB4, 4, "RGB VGA", L"RGB VGA", - &MEDIASUBTYPE_RGB8, 8, "RGB 8", L"RGB 8", - &MEDIASUBTYPE_RGB565, 16, "RGB 565 (16 bit)", L"RGB 565 (16 bit)", - &MEDIASUBTYPE_RGB555, 16, "RGB 555 (16 bit)", L"RGB 555 (16 bit)", - &MEDIASUBTYPE_RGB24, 24, "RGB 24", L"RGB 24", +} BitCountMap[] = { &MEDIASUBTYPE_RGB1, 1, "RGB Monochrome", L"RGB Monochrome", + &MEDIASUBTYPE_RGB4, 4, "RGB VGA", L"RGB VGA", + &MEDIASUBTYPE_RGB8, 8, "RGB 8", L"RGB 8", + &MEDIASUBTYPE_RGB565, 16, "RGB 565 (16 bit)", L"RGB 565 (16 bit)", + &MEDIASUBTYPE_RGB555, 16, "RGB 555 (16 bit)", L"RGB 555 (16 bit)", + &MEDIASUBTYPE_RGB24, 24, "RGB 24", L"RGB 24", &MEDIASUBTYPE_RGB32, 32, "RGB 32", L"RGB 32", &MEDIASUBTYPE_ARGB32, 32, "ARGB 32", L"ARGB 32", - &MEDIASUBTYPE_Overlay, 0, "Overlay", L"Overlay", - &GUID_NULL, 0, "UNKNOWN", L"UNKNOWN" + &MEDIASUBTYPE_Overlay, 0, "Overlay", L"Overlay", + &GUID_NULL, 0, "UNKNOWN", L"UNKNOWN" }; // Return the size of the bitmap as defined by this header @@ -164,7 +164,7 @@ int LocateSubtype(const GUID *pSubtype) { break; } - + iPosition++; } @@ -212,11 +212,11 @@ STDAPI_(CHAR *) GetSubtypeName(const GUID *pSubtype) STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader) { - // Everyone has this to start with this + // Everyone has this to start with this LONG Size = SIZE_PREHEADER + pHeader->biSize; ASSERT(pHeader->biSize >= sizeof(BITMAPINFOHEADER)); - + // Does this format use a palette, if the number of colours actually used // is zero then it is set to the maximum that are allowed for that colour // depth (an example is 256 for eight bits). Truecolour formats may also diff --git a/plugins/GSdx/baseclasses/ddmm.h b/plugins/GSdx/baseclasses/ddmm.h index c790754882..4d60e3b10b 100644 --- a/plugins/GSdx/baseclasses/ddmm.h +++ b/plugins/GSdx/baseclasses/ddmm.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // File: DDMM.h // -// Desc: DirectShow base classes - efines routines for using DirectDraw +// Desc: DirectShow base classes - efines routines for using DirectDraw // on a multimonitor system. // // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/plugins/GSdx/baseclasses/msgthrd.h b/plugins/GSdx/baseclasses/msgthrd.h index eb09be2430..88a1cc3959 100644 --- a/plugins/GSdx/baseclasses/msgthrd.h +++ b/plugins/GSdx/baseclasses/msgthrd.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // File: MsgThrd.h // -// Desc: DirectShow base classes - provides support for a worker thread +// Desc: DirectShow base classes - provides support for a worker thread // class to which one can asynchronously post messages. // // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/plugins/GSdx/baseclasses/mtype.cpp b/plugins/GSdx/baseclasses/mtype.cpp index 5d49a6dd84..0d86343e26 100644 --- a/plugins/GSdx/baseclasses/mtype.cpp +++ b/plugins/GSdx/baseclasses/mtype.cpp @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // File: MType.cpp // -// Desc: DirectShow base classes - implements a class that holds and +// Desc: DirectShow base classes - implements a class that holds and // manages media type information. // // Copyright (c) Microsoft Corporation. All rights reserved. @@ -121,7 +121,7 @@ CMediaType::Set(const AM_MEDIA_TYPE& rt) } } - return S_OK; + return S_OK; } diff --git a/plugins/GSdx/baseclasses/outputq.cpp b/plugins/GSdx/baseclasses/outputq.cpp index a034cdb40f..7f7532f72a 100644 --- a/plugins/GSdx/baseclasses/outputq.cpp +++ b/plugins/GSdx/baseclasses/outputq.cpp @@ -181,14 +181,14 @@ COutputQueue::~COutputQueue() DWORD WINAPI COutputQueue::InitialThreadProc(LPVOID pv) { HRESULT hrCoInit = CAMThread::CoInitializeHelper(); - + COutputQueue *pSampleQueue = (COutputQueue *)pv; DWORD dwReturn = pSampleQueue->ThreadProc(); if(hrCoInit == S_OK) { CoUninitialize(); } - + return dwReturn; } diff --git a/plugins/GSdx/baseclasses/outputq.h b/plugins/GSdx/baseclasses/outputq.h index 3869fa74b0..596893730b 100644 --- a/plugins/GSdx/baseclasses/outputq.h +++ b/plugins/GSdx/baseclasses/outputq.h @@ -2,7 +2,7 @@ // File: OutputQ.h // // Desc: DirectShow base classes - defines the COutputQueue class, which -// makes a queue of samples and sends them to an output pin. The +// makes a queue of samples and sends them to an output pin. The // class will optionally send the samples to the pin directly. // // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/plugins/GSdx/baseclasses/renbase.cpp b/plugins/GSdx/baseclasses/renbase.cpp index c725629dfe..8eb8a85dfc 100644 --- a/plugins/GSdx/baseclasses/renbase.cpp +++ b/plugins/GSdx/baseclasses/renbase.cpp @@ -1028,7 +1028,7 @@ HRESULT CBaseRenderer::PrepareReceive(IMediaSample *pMediaSample) // Check our flushing and filter state - // This function must hold the interface lock because it calls + // This function must hold the interface lock because it calls // CBaseInputPin::Receive() and CBaseInputPin::Receive() uses // CBasePin::m_bRunTimeError. HRESULT hr = m_pInputPin->CBaseInputPin::Receive(pMediaSample); @@ -1633,9 +1633,9 @@ STDMETHODIMP CRendererInputPin::Receive(IMediaSample *pSample) CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock); // We do not report errors which occur while the filter is stopping, - // flushing or if the m_bAbort flag is set . Errors are expected to - // occur during these operations and the streaming thread correctly - // handles the errors. + // flushing or if the m_bAbort flag is set . Errors are expected to + // occur during these operations and the streaming thread correctly + // handles the errors. if (!IsStopped() && !IsFlushing() && !m_pRenderer->m_bAbort && !m_bRunTimeError) { // EC_ERRORABORT's first parameter is the error which caused @@ -1649,7 +1649,7 @@ STDMETHODIMP CRendererInputPin::Receive(IMediaSample *pSample) m_pRenderer->NotifyEndOfStream(); } } - + m_bRunTimeError = TRUE; } } @@ -1719,7 +1719,7 @@ HRESULT CRendererInputPin::Active() HRESULT CRendererInputPin::Inactive() { - // The caller must hold the interface lock because + // The caller must hold the interface lock because // this function uses m_bRunTimeError. ASSERT(CritCheckIn(&m_pRenderer->m_InterfaceLock)); diff --git a/plugins/GSdx/baseclasses/schedule.cpp b/plugins/GSdx/baseclasses/schedule.cpp index f377a9ee2b..af8427f9c3 100644 --- a/plugins/GSdx/baseclasses/schedule.cpp +++ b/plugins/GSdx/baseclasses/schedule.cpp @@ -154,7 +154,7 @@ REFERENCE_TIME CAMSchedule::Advise( const REFERENCE_TIME & rtTime ) if (DbgCheckModuleLevel(LOG_TIMING, 4)) DumpLinkedList(); #endif - // Note - DON'T cache the difference, it might overflow + // Note - DON'T cache the difference, it might overflow while ( rtTime >= (rtNextTime = (pAdvise=head.m_next)->m_rtEventTime) && !pAdvise->IsZ() ) { @@ -271,7 +271,7 @@ void CAMSchedule::DumpLinkedList() for ( CAdvisePacket * p = &head ; p ; p = p->m_next , i++ - ) + ) { DbgLog((LOG_TIMING, 1, TEXT("Advise List # %lu, Cookie %d, RefTime %lu"), i, diff --git a/plugins/GSdx/baseclasses/source.cpp b/plugins/GSdx/baseclasses/source.cpp index 8d71f3d65f..4a21d18fbe 100644 --- a/plugins/GSdx/baseclasses/source.cpp +++ b/plugins/GSdx/baseclasses/source.cpp @@ -423,7 +423,7 @@ DWORD CSourceStream::ThreadProc(void) { case CMD_RUN: DbgLog((LOG_ERROR, 1, TEXT("CMD_RUN received before a CMD_PAUSE???"))); // !!! fall through??? - + case CMD_PAUSE: Reply(NOERROR); DoBufferProcessingLoop(); diff --git a/plugins/GSdx/baseclasses/source.h b/plugins/GSdx/baseclasses/source.h index a5f0aeb26d..bee5356837 100644 --- a/plugins/GSdx/baseclasses/source.h +++ b/plugins/GSdx/baseclasses/source.h @@ -67,7 +67,7 @@ public: ); int FindPinNumber(IPin *iPin); - + protected: int m_iPins; // The number of pins on this filter. Updated by CSourceStream diff --git a/plugins/GSdx/baseclasses/strmctl.h b/plugins/GSdx/baseclasses/strmctl.h index d054777c75..99732877c9 100644 --- a/plugins/GSdx/baseclasses/strmctl.h +++ b/plugins/GSdx/baseclasses/strmctl.h @@ -90,7 +90,7 @@ public: // We need a clock to see what time it is. This is for the // "discard in a timely fashion" logic. If we discard everything as // quick as possible, a whole 60 minute file could get discarded in the - // first 10 seconds, and if somebody wants to turn streaming on at 30 + // first 10 seconds, and if somebody wants to turn streaming on at 30 // minutes into the file, and they make the call more than a few seconds // after the graph is run, it may be too late! // So we hold every sample until it's time has gone, then we discard it. diff --git a/plugins/GSdx/baseclasses/sysclock.cpp b/plugins/GSdx/baseclasses/sysclock.cpp index 733e6f8bbb..5b6cf0c7fa 100644 --- a/plugins/GSdx/baseclasses/sysclock.cpp +++ b/plugins/GSdx/baseclasses/sysclock.cpp @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // File: SysClock.cpp // -// Desc: DirectShow base classes - implements a system clock based on +// Desc: DirectShow base classes - implements a system clock based on // IReferenceClock. // // Copyright (c) Microsoft Corporation. All rights reserved. @@ -67,7 +67,7 @@ CSystemClock::GetClassID(CLSID *pClsID) } -STDMETHODIMP +STDMETHODIMP CSystemClock::SetClockDelta(REFERENCE_TIME rtDelta) { return SetTimeDelta(rtDelta); diff --git a/plugins/GSdx/baseclasses/transfrm.h b/plugins/GSdx/baseclasses/transfrm.h index d4873fa533..695e009bd7 100644 --- a/plugins/GSdx/baseclasses/transfrm.h +++ b/plugins/GSdx/baseclasses/transfrm.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // File: Transfrm.h // -// Desc: DirectShow base classes - defines classes from which simple +// Desc: DirectShow base classes - defines classes from which simple // transform codecs may be derived. // // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/plugins/GSdx/baseclasses/transip.cpp b/plugins/GSdx/baseclasses/transip.cpp index ff851fca54..d58fd726dc 100644 --- a/plugins/GSdx/baseclasses/transip.cpp +++ b/plugins/GSdx/baseclasses/transip.cpp @@ -852,7 +852,7 @@ CTransInPlaceInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps) // CTransInPlaceInputPin::CompleteConnect() calls CBaseInputPin::CompleteConnect() -// and then calls CTransInPlaceFilter::CompleteConnect(). It does this because +// and then calls CTransInPlaceFilter::CompleteConnect(). It does this because // CTransInPlaceFilter::CompleteConnect() can reconnect a pin and we do not // want to reconnect a pin if CBaseInputPin::CompleteConnect() fails. HRESULT @@ -949,10 +949,10 @@ CTransInPlaceOutputPin::SetAllocator(IMemAllocator * pAllocator) // CTransInPlaceOutputPin::CompleteConnect() calls CBaseOutputPin::CompleteConnect() -// and then calls CTransInPlaceFilter::CompleteConnect(). It does this because -// CTransInPlaceFilter::CompleteConnect() can reconnect a pin and we do not want to -// reconnect a pin if CBaseOutputPin::CompleteConnect() fails. -// CBaseOutputPin::CompleteConnect() often fails when our output pin is being connected +// and then calls CTransInPlaceFilter::CompleteConnect(). It does this because +// CTransInPlaceFilter::CompleteConnect() can reconnect a pin and we do not want to +// reconnect a pin if CBaseOutputPin::CompleteConnect() fails. +// CBaseOutputPin::CompleteConnect() often fails when our output pin is being connected // to the Video Mixing Renderer. HRESULT CTransInPlaceOutputPin::CompleteConnect(IPin *pReceivePin) diff --git a/plugins/GSdx/baseclasses/wxdebug.cpp b/plugins/GSdx/baseclasses/wxdebug.cpp index 00ab7bb2d9..3b8667dad3 100644 --- a/plugins/GSdx/baseclasses/wxdebug.cpp +++ b/plugins/GSdx/baseclasses/wxdebug.cpp @@ -2,7 +2,7 @@ // File: WXDebug.cpp // // Desc: DirectShow base classes - implements ActiveX system debugging -// facilities. +// facilities. // // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ @@ -395,7 +395,7 @@ DWORD WINAPI MsgBoxThread( pmsg->szTitle, pmsg->szMessage, pmsg->dwFlags); - + return 0; } @@ -513,15 +513,15 @@ void WINAPI DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLi void WINAPI DbgBreakPoint(const TCHAR *pFileName,INT iLine,const TCHAR* szFormatString,...) { - // A debug break point message can have at most 2000 characters if + // A debug break point message can have at most 2000 characters if // ANSI or UNICODE characters are being used. A debug break point message - // can have between 1000 and 2000 double byte characters in it. If a + // can have between 1000 and 2000 double byte characters in it. If a // particular message needs more characters, then the value of this constant // should be increased. const DWORD MAX_BREAK_POINT_MESSAGE_SIZE = 2000; TCHAR szBreakPointMessage[MAX_BREAK_POINT_MESSAGE_SIZE]; - + const DWORD MAX_CHARS_IN_BREAK_POINT_MESSAGE = sizeof(szBreakPointMessage) / sizeof(TCHAR); va_list va; @@ -530,7 +530,7 @@ void WINAPI DbgBreakPoint(const TCHAR *pFileName,INT iLine,const TCHAR* szFormat HRESULT hr = StringCchVPrintf( szBreakPointMessage, MAX_CHARS_IN_BREAK_POINT_MESSAGE, szFormatString, va ); va_end(va); - + if( S_OK != hr ) { DbgBreak( "ERROR in DbgBreakPoint(). The variable length debug message could not be displayed because _vsnprintf() failed." ); return; @@ -580,7 +580,7 @@ BOOL WINAPI DbgCheckModuleLevel(DWORD Type,DWORD Level) // speed up unconditional output. if (0==Level) return(TRUE); - + for (LONG lKeyPos = 0;lKeyPos < iMAXLEVELS;lKeyPos++) { if (Type & Mask) { if (Level <= (m_Levels[lKeyPos] & ~LOG_FORCIBLY_SET)) { @@ -616,10 +616,10 @@ void WINAPI DbgSetAutoRefreshLevels(bool fAuto) } #ifdef UNICODE -// +// // warning -- this function is implemented twice for ansi applications // linking to the unicode library -// +// void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const CHAR *pFormat,...) { /* Check the current level for this type combination */ @@ -748,13 +748,13 @@ void WINAPI DbgKernelAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLi have their own copy of this code. It therefore helps if the module name is included on the output so that the offending code can be easily found */ -// +// // warning -- this function is implemented twice for ansi applications // linking to the unicode library -// +// void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const TCHAR *pFormat,...) { - + /* Check the current level for this type combination */ BOOL bAccept = DbgCheckModuleLevel(Type,Level); @@ -939,18 +939,18 @@ void WINAPI DbgDumpObjectRegister() if(pObject->m_wszName) { #ifdef UNICODE LPCTSTR FORMAT_STRING = TEXT("%5d (%8x) %30s"); - #else + #else LPCTSTR FORMAT_STRING = TEXT("%5d (%8x) %30S"); - #endif + #endif (void)StringCchPrintf(szInfo,NUMELMS(szInfo), FORMAT_STRING, pObject->m_dwCookie, &pObject, pObject->m_wszName); } else { #ifdef UNICODE LPCTSTR FORMAT_STRING = TEXT("%5d (%8x) %30S"); - #else + #else LPCTSTR FORMAT_STRING = TEXT("%5d (%8x) %30s"); - #endif + #endif (void)StringCchPrintf(szInfo,NUMELMS(szInfo),FORMAT_STRING,pObject->m_dwCookie, &pObject, pObject->m_szName); } @@ -1021,7 +1021,7 @@ void WINAPI DbgSetWaitTimeout(DWORD dwTimeout) } // !!! add something to print FOURCC guids? - + // shouldn't this print the hex CLSID? return "Unknown GUID Name"; } @@ -1065,11 +1065,11 @@ CDisp::CDisp(REFCLSID clsid) WCHAR strClass[CHARS_IN_GUID+1]; StringFromGUID2(clsid, strClass, sizeof(strClass) / sizeof(strClass[0])); ASSERT(sizeof(m_String)/sizeof(m_String[0]) >= CHARS_IN_GUID+1); - #ifdef UNICODE + #ifdef UNICODE (void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%s"), strClass); #else (void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%S"), strClass); - #endif + #endif }; #ifdef __STREAMS__ @@ -1149,7 +1149,7 @@ CDisp::CDisp(IPin *pPin) LPCTSTR FORMAT_STRING = TEXT("%S(%s)"); #else LPCTSTR FORMAT_STRING = TEXT("%s(%s)"); - #endif + #endif (void)StringCchPrintf(m_pString, len, FORMAT_STRING, GuidNames[clsid], str); } @@ -1175,7 +1175,7 @@ CDisp::CDisp(IUnknown *pUnk) LPCTSTR FORMAT_STRING = TEXT("%s"); #else LPCTSTR FORMAT_STRING = TEXT("%S"); - #endif + #endif (void)StringCchPrintf(m_pString, len, FORMAT_STRING, fi.achName); } @@ -1345,7 +1345,7 @@ void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel) QueryFilterInfoReleaseGraph(info); // !!! should QueryVendorInfo here! - + DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%x] '%ls'"), pFilter, info.achName)); IEnumPins *pins; @@ -1406,7 +1406,7 @@ void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel) } } - + pFilter->Release(); } diff --git a/plugins/GSdx/baseclasses/wxdebug.h b/plugins/GSdx/baseclasses/wxdebug.h index d87a1a0c60..02d11b9028 100644 --- a/plugins/GSdx/baseclasses/wxdebug.h +++ b/plugins/GSdx/baseclasses/wxdebug.h @@ -351,7 +351,7 @@ public: }; }; - + #if defined(DEBUG) class CAutoTrace { @@ -364,11 +364,11 @@ public: CAutoTrace(const TCHAR* szBlkName, const int level = 15) : _szBlkName(szBlkName), _level(level) {DbgLog((LOG_TRACE, _level, _szEntering, _szBlkName));} - + ~CAutoTrace() {DbgLog((LOG_TRACE, _level, _szLeaving, _szBlkName));} }; - + #if defined (__FUNCTION__) #define AMTRACEFN() CAutoTrace __trace(TEXT(__FUNCTION__)) diff --git a/plugins/GSdx/baseclasses/wxlist.h b/plugins/GSdx/baseclasses/wxlist.h index d7660e0297..fd5c84a004 100644 --- a/plugins/GSdx/baseclasses/wxlist.h +++ b/plugins/GSdx/baseclasses/wxlist.h @@ -59,14 +59,14 @@ const int DEFAULTCACHE = 10; /* Default node object cache size */ to the object that it looks after. All of these pointers can be retrieved or set through member functions. */ -class CBaseList +class CBaseList #ifdef DEBUG : public CBaseObject #endif { /* Making these classes inherit from CBaseObject does nothing functionally but it allows us to check there are no memory - leaks in debug builds. + leaks in debug builds. */ public: diff --git a/plugins/GSdx/baseclasses/wxutil.cpp b/plugins/GSdx/baseclasses/wxutil.cpp index ae08ef67ff..72069596bf 100644 --- a/plugins/GSdx/baseclasses/wxutil.cpp +++ b/plugins/GSdx/baseclasses/wxutil.cpp @@ -458,7 +458,7 @@ lstrcmpiWInternal( c1 -= (WCHAR) (L'A' - L'a'); if (c2 >= L'A' && c2 <= L'Z') c2 -= (WCHAR) (L'A' - L'a'); - + if (c1 != c2) return (int) c1 - (int) c2; } while (*lpString1++ && *lpString2++); @@ -976,7 +976,7 @@ void CCritSec::Lock() // critical section } } - + EnterCriticalSection(&m_CritSec); if (0 == m_lockCount++) { @@ -1193,11 +1193,11 @@ timeSetEvent() if the current operating system supports it. TIME_KILL_SYNCHRONO is supported on Windows XP and later operating systems. Parameters: -- The same parameters as timeSetEvent(). See timeSetEvent()'s documentation in +- The same parameters as timeSetEvent(). See timeSetEvent()'s documentation in the Platform SDK for more information. Return Value: -- The same return value as timeSetEvent(). See timeSetEvent()'s documentation in +- The same return value as timeSetEvent(). See timeSetEvent()'s documentation in the Platform SDK for more information. ******************************************************************************/ @@ -1206,7 +1206,7 @@ MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, LPTIMECALLBACK l #if WINVER >= 0x0501 { static bool fCheckedVersion = false; - static bool fTimeKillSynchronousFlagAvailable = false; + static bool fTimeKillSynchronousFlagAvailable = false; if( !fCheckedVersion ) { fTimeKillSynchronousFlagAvailable = TimeKillSynchronousFlagAvailable(); @@ -1229,11 +1229,11 @@ bool TimeKillSynchronousFlagAvailable( void ) osverinfo.dwOSVersionInfoSize = sizeof(osverinfo); if( GetVersionEx( &osverinfo ) ) { - + // Windows XP's major version is 5 and its' minor version is 1. // timeSetEvent() started supporting the TIME_KILL_SYNCHRONOUS flag // in Windows XP. - if( (osverinfo.dwMajorVersion > 5) || + if( (osverinfo.dwMajorVersion > 5) || ( (osverinfo.dwMajorVersion == 5) && (osverinfo.dwMinorVersion >= 1) ) ) { return true; } diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index 8edb77ee47..55e71dbe9d 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -59,7 +59,7 @@ #define IDD_CONFIG2 10004 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 10005 diff --git a/plugins/GSdx/stdafx.cpp b/plugins/GSdx/stdafx.cpp index 7811c93b2e..1c54dcb5f2 100644 --- a/plugins/GSdx/stdafx.cpp +++ b/plugins/GSdx/stdafx.cpp @@ -11,29 +11,29 @@ string format(const char* fmt, ...) { va_list args; va_start(args, fmt); - + int result = -1, length = 256; - + char* buffer = NULL; - + while(result == -1) { if(buffer) delete [] buffer; - + buffer = new char[length + 1]; - + memset(buffer, 0, length + 1); - + result = _vsnprintf(buffer, length, fmt, args); - + length *= 2; } va_end(args); - + string s(buffer); - + delete [] buffer; - + return s; } diff --git a/plugins/GSdx/stdafx.h b/plugins/GSdx/stdafx.h index 488325e4c4..1bae442104 100644 --- a/plugins/GSdx/stdafx.h +++ b/plugins/GSdx/stdafx.h @@ -9,8 +9,8 @@ #ifdef _WINDOWS // The following macros define the minimum required platform. The minimum required platform -// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run -// your application. The macros work by enabling all features available on platform versions up to and +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and // including the version specified. // Modify the following defines if you have to target a platform prior to the ones specified below. @@ -133,7 +133,7 @@ typedef signed long long int64; #define D3D11_SHADER_MACRO D3D10_SHADER_MACRO #define ID3D11Blob ID3D10Blob -#endif +#endif // sse @@ -196,4 +196,4 @@ typedef signed long long int64; #endif #undef min -#undef max \ No newline at end of file +#undef max diff --git a/plugins/GSdx/vtune/JITProfiling.h b/plugins/GSdx/vtune/JITProfiling.h index 856756b97e..870177f97b 100644 --- a/plugins/GSdx/vtune/JITProfiling.h +++ b/plugins/GSdx/vtune/JITProfiling.h @@ -20,14 +20,14 @@ { // shutdown - iJVM_EVENT_TYPE_SHUTDOWN = 2, // Program exiting + iJVM_EVENT_TYPE_SHUTDOWN = 2, // Program exiting // EventSpecificData NA // JIT profiling iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED=13, // issued after method code jitted // into memory but before code is executed - // EventSpecificData is an iJIT_Method_Load + // EventSpecificData is an iJIT_Method_Load iJVM_EVENT_TYPE_METHOD_UNLOAD_START, // issued before unload. Method code will no // longer be executed, but code and info @@ -37,11 +37,11 @@ // Method Profiling - // method name, Id and stack is supplied + // method name, Id and stack is supplied iJVM_EVENT_TYPE_ENTER_NIDS = 19, // issued when a method is about to be entered // EventSpecificData is iJIT_Method_NIDS - // method name, Id and stack is supplied + // method name, Id and stack is supplied iJVM_EVENT_TYPE_LEAVE_NIDS, // issued when a method is about to be left // EventSpecificData is iJIT_Method_NIDS @@ -56,7 +56,7 @@ iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004, // when turned on the jit must instrument all the currently jited code with calls on method entries iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008, // when turned on the jit must instrument all the currently jited code with calls on method exit - + } iJIT_ModeFlags; @@ -82,11 +82,11 @@ typedef enum _iJDEnvironmentType **********************************/ // structure for the events: - // iJVM_EVENT_TYPE_METHOD_UNLOAD_START + // iJVM_EVENT_TYPE_METHOD_UNLOAD_START -typedef struct _iJIT_Method_Id +typedef struct _iJIT_Method_Id { - unsigned int method_id; // Id of the method (same as the one passed in the iJIT_Method_Load struct + unsigned int method_id; // Id of the method (same as the one passed in the iJIT_Method_Load struct } *piJIT_Method_Id, iJIT_Method_Id; @@ -105,16 +105,16 @@ typedef struct _iJIT_Method_NIDS } *piJIT_Method_NIDS, iJIT_Method_NIDS; // structures for the events: - // iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED + // iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED -typedef struct _LineNumberInfo +typedef struct _LineNumberInfo { unsigned int Offset; // x86 Offset from the begining of the method unsigned int LineNumber; // source line number from the begining of the source file. } *pLineNumberInfo, LineNumberInfo; -typedef struct _iJIT_Method_Load +typedef struct _iJIT_Method_Load { unsigned int method_id; // unique method ID - can be any unique value, (except 0 - 999) char* method_name; // method name (can be with or without the class and signature, in any case the class name will be added to it) @@ -123,7 +123,7 @@ typedef struct _iJIT_Method_Load unsigned int line_number_size; // Line Table size in number of entries - Zero if none pLineNumberInfo line_number_table; // Pointer to the begining of the line numbers info array unsigned int class_id; // unique class ID - char* class_file_name; // class file name + char* class_file_name; // class file name char* source_file_name; // source file name void* user_data; // bits supplied by the user for saving in the JIT file... unsigned int user_data_size; // the size of the user data buffer @@ -134,7 +134,7 @@ typedef struct _iJIT_Method_Load //API Functions -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -147,7 +147,7 @@ void FinalizeThread(); void FinalizeProcess(); unsigned int iJIT_GetNewMethodID(); -#ifdef __cplusplus +#ifdef __cplusplus } #endif diff --git a/plugins/GSnull/GS.cpp b/plugins/GSnull/GS.cpp index d792175352..bbd117a6e9 100644 --- a/plugins/GSnull/GS.cpp +++ b/plugins/GSnull/GS.cpp @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -47,22 +47,22 @@ const char* s_iniFilename = "GSnull.ini"; void (*GSirq)(); -EXPORT_C_(u32) PS2EgetLibType() +EXPORT_C_(u32) PS2EgetLibType() { return PS2E_LT_GS; } -EXPORT_C_(char*) PS2EgetLibName() +EXPORT_C_(char*) PS2EgetLibName() { return libraryName; } -EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) +EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) { return (version<<16) | (revision<<8) | build; } -void __Log(char *fmt, ...) +void __Log(char *fmt, ...) { va_list list; @@ -104,7 +104,7 @@ void SysPrintf(const char *fmt, ...) EXPORT_C_(s32) GSinit() { LoadConfig(); - + #ifdef GS_LOG gsLog = fopen("logs/gsLog.txt", "w"); if (gsLog) setvbuf(gsLog, NULL, _IONBF, 0); @@ -131,14 +131,14 @@ EXPORT_C_(s32) GSopen(void *pDsp, char *Title, int multithread) int err = 0; GS_LOG("GS open\n"); //assert( GSirq != NULL ); - + err = GSOpenWindow(pDsp, Title); SysPrintf("Opening GSnull\n"); return err; } -#ifdef USE_GSOPEN2 +#ifdef USE_GSOPEN2 EXPORT_C_(s32) GSopen2( void *pDsp, u32 flags ) { GS_LOG("GS open2\n"); @@ -159,17 +159,17 @@ EXPORT_C_(void) GSclose() //GSCloseWindow(); } -EXPORT_C_(void) GSirqCallback(void (*callback)()) +EXPORT_C_(void) GSirqCallback(void (*callback)()) { GSirq = callback; } -EXPORT_C_(s32) GSfreeze(int mode, freezeData *data) +EXPORT_C_(s32) GSfreeze(int mode, freezeData *data) { return 0; } -EXPORT_C_(s32) GStest() +EXPORT_C_(s32) GStest() { SysPrintf("Testing GSnull\n"); return 0; @@ -227,7 +227,7 @@ EXPORT_C_(void) GSchangeSaveState(int, const char* filename) EXPORT_C_(void) GSmakeSnapshot(char *path) { - + SysPrintf("Taking a snapshot.\n"); } @@ -258,9 +258,9 @@ EXPORT_C_(int) GSsetupRecording(int start, void* pData) { if (start) SysPrintf("Pretending to record.\n"); - else + else SysPrintf("Pretending to stop recording.\n"); - + return 1; } diff --git a/plugins/GSnull/GS.h b/plugins/GSnull/GS.h index d0c773a875..fefe2ea247 100644 --- a/plugins/GSnull/GS.h +++ b/plugins/GSnull/GS.h @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. diff --git a/plugins/GSnull/GifTransfer.cpp b/plugins/GSnull/GifTransfer.cpp index 3199439292..d6d1787b08 100644 --- a/plugins/GSnull/GifTransfer.cpp +++ b/plugins/GSnull/GifTransfer.cpp @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. diff --git a/plugins/GSnull/GifTransfer.h b/plugins/GSnull/GifTransfer.h index 3a2ca3504e..06898f7094 100644 --- a/plugins/GSnull/GifTransfer.h +++ b/plugins/GSnull/GifTransfer.h @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. diff --git a/plugins/GSnull/Linux/Config.cpp b/plugins/GSnull/Linux/Config.cpp index d292f5748f..4834dcf13f 100644 --- a/plugins/GSnull/Linux/Config.cpp +++ b/plugins/GSnull/Linux/Config.cpp @@ -45,13 +45,13 @@ extern "C" GtkWidget *MsgDlg, *About, *Conf; extern string s_strIniPath; -void OnMsg_Ok() +void OnMsg_Ok() { gtk_widget_destroy(MsgDlg); gtk_main_quit(); } -void cfgSysMessage(char *fmt, ...) +void cfgSysMessage(char *fmt, ...) { GtkWidget *Ok,*Txt; GtkWidget *Box,*Box1; @@ -74,7 +74,7 @@ void cfgSysMessage(char *fmt, ...) gtk_widget_show(Box); Txt = gtk_label_new(msg); - + gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5); gtk_widget_show(Txt); @@ -88,18 +88,18 @@ void cfgSysMessage(char *fmt, ...) GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT); gtk_widget_show(Ok); - gtk_widget_show(MsgDlg); + gtk_widget_show(MsgDlg); gtk_main(); } -void OnAbout_Ok(GtkButton *button, gpointer user_data) +void OnAbout_Ok(GtkButton *button, gpointer user_data) { gtk_widget_destroy(About); gtk_main_quit(); } -void CFGabout() +void CFGabout() { About = create_About(); gtk_widget_show_all(About); @@ -113,13 +113,13 @@ void OnConf_Ok(GtkButton *button, gpointer user_data) { gtk_main_quit(); } -void OnConf_Cancel(GtkButton *button, gpointer user_data) +void OnConf_Cancel(GtkButton *button, gpointer user_data) { gtk_widget_destroy(Conf); gtk_main_quit(); } -void CFGconfigure() +void CFGconfigure() { Conf = create_Config(); @@ -135,14 +135,14 @@ long CFGmessage(char *msg) { return 0; } -void LoadConfig() +void LoadConfig() { FILE *f; char cfg[255]; strcpy(cfg, s_strIniPath.c_str()); f = fopen(cfg, "r"); - if (f == NULL) + if (f == NULL) { printf("failed to open %s\n", s_strIniPath.c_str()); SaveConfig();//save and return @@ -152,19 +152,19 @@ void LoadConfig() fclose(f); } -void SaveConfig() +void SaveConfig() { FILE *f; char cfg[255]; strcpy(cfg, s_strIniPath.c_str()); f = fopen(cfg,"w"); - if (f == NULL) + if (f == NULL) { printf("failed to open %s\n", s_strIniPath.c_str()); return; } - + //fprintf(f, "options = %hhx\n", confOptions); fclose(f); } diff --git a/plugins/GSnull/Linux/GSLinux.cpp b/plugins/GSnull/Linux/GSLinux.cpp index 72af62cbce..6017947cff 100644 --- a/plugins/GSnull/Linux/GSLinux.cpp +++ b/plugins/GSnull/Linux/GSLinux.cpp @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -50,14 +50,14 @@ void GSCloseWindow() } void GSProcessMessages() -{ - if ( GSKeyEvent ) +{ + if ( GSKeyEvent ) { int myKeyEvent = GSKeyEvent; bool myShift = GSShift; GSKeyEvent = 0; - - switch ( myKeyEvent ) + + switch ( myKeyEvent ) { case XK_F5: OnKeyboardF5(myShift); @@ -67,10 +67,10 @@ void GSProcessMessages() break; case XK_F7: OnKeyboardF7(myShift); - break; + break; case XK_F9: OnKeyboardF9(myShift); - break; + break; } } } @@ -78,10 +78,10 @@ void GSProcessMessages() void HandleKeyEvent(keyEvent *ev) { - switch(ev->evt) + switch(ev->evt) { case KEYPRESS: - switch(ev->key) + switch(ev->key) { case XK_F5: case XK_F6: @@ -102,7 +102,7 @@ void HandleKeyEvent(keyEvent *ev) } break; case KEYRELEASE: - switch(ev->key) + switch(ev->key) { case XK_Shift_L: case XK_Shift_R: diff --git a/plugins/GSnull/Linux/GSLinux.h b/plugins/GSnull/Linux/GSLinux.h index 0e4e781631..9b90436315 100644 --- a/plugins/GSnull/Linux/GSLinux.h +++ b/plugins/GSnull/Linux/GSLinux.h @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. diff --git a/plugins/GSnull/Linux/Linux.cpp b/plugins/GSnull/Linux/Linux.cpp index 7bbd963ccf..f630d63366 100644 --- a/plugins/GSnull/Linux/Linux.cpp +++ b/plugins/GSnull/Linux/Linux.cpp @@ -28,7 +28,7 @@ #include "GS.h" #include "Config.h" -void SysMessage(char *fmt, ...) +void SysMessage(char *fmt, ...) { va_list list; char msg[512]; @@ -41,12 +41,12 @@ void SysMessage(char *fmt, ...) cfgSysMessage(msg); } -void GSconfigure() +void GSconfigure() { CFGconfigure(); } -void GSabout() +void GSabout() { CFGabout(); } diff --git a/plugins/GSnull/Registers.h b/plugins/GSnull/Registers.h index a08acb7937..98c2ca7b4b 100644 --- a/plugins/GSnull/Registers.h +++ b/plugins/GSnull/Registers.h @@ -18,7 +18,7 @@ // These enums & structures are copied from GSdx, which got them from sp2dev 0.4.0. -// In fact, after looking at both ZeroGS and GSdx, and seeing how similar this section is on both, +// In fact, after looking at both ZeroGS and GSdx, and seeing how similar this section is on both, // I'm just going to blatantly copy most of GS.h here and localize. // And if this is kept close enough to GSdx's code, if should make porting GSdx to Linux a bit easier... @@ -33,7 +33,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif #define GSdefs #include "PS2Edefs.h" #include "PS2Etypes.h" @@ -69,12 +69,12 @@ enum GS_PRIM_CLASS enum GS_PSM { - PSM_PSMCT32 = 0, // 0000-0000 - PSM_PSMCT24 = 1, // 0000-0001 - PSM_PSMCT16 = 2, // 0000-0010 - PSM_PSMCT16S = 10, // 0000-1010 - PSM_PSMT8 = 19, // 0001-0011 - PSM_PSMT4 = 20, // 0001-0100 + PSM_PSMCT32 = 0, // 0000-0000 + PSM_PSMCT24 = 1, // 0000-0001 + PSM_PSMCT16 = 2, // 0000-0010 + PSM_PSMCT16S = 10, // 0000-1010 + PSM_PSMT8 = 19, // 0001-0011 + PSM_PSMT4 = 20, // 0001-0100 PSM_PSMT8H = 27, // 0001-1011 PSM_PSMT4HL = 36, // 0010-0100 PSM_PSMT4HH = 44, // 0010-1100 @@ -145,7 +145,7 @@ union name \ bool operator != (const union name& r) const {return !((GSVector4i)r).eq(*this);} \ operator GSVector4i() const {return GSVector4i::loadl(this);}*/ \ struct { \ - + #define REG128(name)\ union name \ { \ @@ -404,8 +404,8 @@ REG64_SET(GSReg) GSRegIMR IMR; GSRegPMODE PMODE; GSRegSIGLBLID SIGLBLID; - GSRegSMODE1 SMODE1; - GSRegSMODE2 SMODE2; + GSRegSMODE1 SMODE1; + GSRegSMODE2 SMODE2; REG_SET_END // @@ -694,7 +694,7 @@ REG64_(GIFReg, TEST) u32 _PAD2:32; REG_END2 __forceinline bool DoFirstPass() {return !ATE || ATST != ATST_NEVER;} // not all pixels fail automatically - __forceinline bool DoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL != AFAIL_KEEP;} // pixels may fail, write fb/z + __forceinline bool DoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL != AFAIL_KEEP;} // pixels may fail, write fb/z __forceinline bool NoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL == AFAIL_KEEP;} // pixels may fail, no output REG_END2 diff --git a/plugins/GSnull/Windows/Config.cpp b/plugins/GSnull/Windows/Config.cpp index 12fa150991..326b5100bb 100644 --- a/plugins/GSnull/Windows/Config.cpp +++ b/plugins/GSnull/Windows/Config.cpp @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -12,13 +12,13 @@ * You should have received a copy of the GNU General Public License along with PCSX2. * If not, see . */ - + #include #include "../GS.h" extern HINSTANCE hInst; -void SaveConfig() +void SaveConfig() { Config *Conf1 = &conf; @@ -42,7 +42,7 @@ void LoadConfig() { Config *Conf1 = &conf; char *szTemp; char szIniFile[256], szValue[256]; - + GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); szTemp = strrchr(szIniFile, '\\'); @@ -51,7 +51,7 @@ void LoadConfig() { fp=fopen("inis\\gsnull.ini","rt");//check if gsnull.ini really exists if (!fp) { - CreateDirectory("inis",NULL); + CreateDirectory("inis",NULL); memset(&conf, 0, sizeof(conf)); conf.Log = 0;//default value SaveConfig();//save and return diff --git a/plugins/GSnull/Windows/GSwin.cpp b/plugins/GSnull/Windows/GSwin.cpp index f509afe056..10a8de7896 100644 --- a/plugins/GSnull/Windows/GSwin.cpp +++ b/plugins/GSnull/Windows/GSwin.cpp @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ LRESULT CALLBACK MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int GSOpenWindow(void *pDsp, char *Title) { - WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, + WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, "PS2EMU_GSNULL", NULL }; RegisterClassEx( &wc ); @@ -44,7 +44,7 @@ int GSOpenWindow(void *pDsp, char *Title) GShwnd = CreateWindowEx( WS_EX_CLIENTEDGE, "PS2EMU_GSNULL", Title, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, wc.hInstance, NULL); - if(GShwnd == NULL) + if(GShwnd == NULL) { GS_LOG("Failed to create window. Exiting..."); return -1; @@ -72,4 +72,4 @@ void HandleKeyEvent(keyEvent *ev) EXPORT_C_(s32) GSsetWindowInfo(winInfo *info) { return 0; -} \ No newline at end of file +} diff --git a/plugins/GSnull/Windows/GSwin.h b/plugins/GSnull/Windows/GSwin.h index 8ebc1ff4a7..e80249a5fe 100644 --- a/plugins/GSnull/Windows/GSwin.h +++ b/plugins/GSnull/Windows/GSwin.h @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. diff --git a/plugins/GSnull/Windows/Win32.cpp b/plugins/GSnull/Windows/Win32.cpp index 987fbca64b..4fe389cf2b 100644 --- a/plugins/GSnull/Windows/Win32.cpp +++ b/plugins/GSnull/Windows/Win32.cpp @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -35,7 +35,7 @@ void SysMessage(char *fmt, ...) { } BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { - + switch(uMsg) { case WM_INITDIALOG: LoadConfig(); @@ -77,19 +77,19 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { EXPORT_C_(void) GSconfigure() { DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), - GetActiveWindow(), - (DLGPROC)ConfigureDlgProc); + GetActiveWindow(), + (DLGPROC)ConfigureDlgProc); } EXPORT_C_(void) GSabout() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)AboutDlgProc); } BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT - DWORD dwReason, + DWORD dwReason, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; return TRUE; // very quick :) diff --git a/plugins/GSnull/Windows/resource.h b/plugins/GSnull/Windows/resource.h index 6ea8fead11..21d4221a1e 100644 --- a/plugins/GSnull/Windows/resource.h +++ b/plugins/GSnull/Windows/resource.h @@ -10,7 +10,7 @@ #define IDC_LOGGING 1007 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 105 diff --git a/plugins/GSnull/null/GSnull.cpp b/plugins/GSnull/null/GSnull.cpp index 3c7ae5e862..f4f605fc8e 100644 --- a/plugins/GSnull/null/GSnull.cpp +++ b/plugins/GSnull/null/GSnull.cpp @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -14,7 +14,7 @@ */ #include "../GS.h" - + void OnKeyboardF5(int myShift) { SysPrintf("F5 pressed!\n"); @@ -33,4 +33,4 @@ void OnKeyboardF7(int myShift) void OnKeyboardF9(int myShift) { SysPrintf("F9 pressed!\n"); -} \ No newline at end of file +} diff --git a/plugins/GSnull/null/GSnull.h b/plugins/GSnull/null/GSnull.h index 2a99821b31..933d0cb0c0 100644 --- a/plugins/GSnull/null/GSnull.h +++ b/plugins/GSnull/null/GSnull.h @@ -1,6 +1,6 @@ /* GSnull * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -18,4 +18,4 @@ extern void OnKeyboardF5(int myShift); extern void OnKeyboardF6(int myShift); extern void OnKeyboardF7(int myShift); -extern void OnKeyboardF9(int myShift); \ No newline at end of file +extern void OnKeyboardF9(int myShift); diff --git a/plugins/LilyPad/Config.cpp b/plugins/LilyPad/Config.cpp index ea159a5b09..3144acd96c 100644 --- a/plugins/LilyPad/Config.cpp +++ b/plugins/LilyPad/Config.cpp @@ -151,8 +151,8 @@ void RefreshEnabledDevices(int updateDeviceList) { (dev->type == KEYBOARD && dev->api == config.keyboardApi) || (dev->type == MOUSE && dev->api == config.mouseApi) || (dev->type == OTHER && - ((dev->api == DI && config.gameApis.directInput) || - (dev->api == DS3 && config.gameApis.dualShock3) || + ((dev->api == DI && config.gameApis.directInput) || + (dev->api == DS3 && config.gameApis.dualShock3) || (dev->api == XINPUT && config.gameApis.xInput)))) { if (config.gameApis.dualShock3 && dev->api == DI && dev->displayName && !wcsicmp(dev->displayName, L"DX PLAYSTATION(R)3 Controller")) { @@ -728,7 +728,7 @@ int SaveSettings(wchar_t *file=0) { *c = 0; wcscpy(config.lastSaveConfigPath, file); wcscpy(config.lastSaveConfigFileName, c+1); - *c = '\\'; + *c = '\\'; } } DeleteFileW(file); @@ -816,7 +816,7 @@ u8 GetPrivateProfileBool(wchar_t *s1, wchar_t *s2, int def, wchar_t *ini) { int LoadSettings(int force, wchar_t *file) { if (dm && !force) return 0; - + if( createIniDir ) { CreateDirectory(L"inis", 0); @@ -1330,7 +1330,7 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l // *always* returned NULL anyway. This resulted in hWndButton being null, which meant Device code // used hWnd instead. This may have caused odd behavior since the callbacks were still all eaten // by the initial GetDlgItem(hWnd, cmd) selection made when the timer was initialized. - + InitInfo info = {selected==0x7F, 1, hWndProp, &hWndButtonProc}; Device *dev = dm->GetActiveDevice(&info, &uid, &index, &value); if (dev) { diff --git a/plugins/LilyPad/DirectInput.cpp b/plugins/LilyPad/DirectInput.cpp index a978577b56..6eef837ddb 100644 --- a/plugins/LilyPad/DirectInput.cpp +++ b/plugins/LilyPad/DirectInput.cpp @@ -30,7 +30,7 @@ inline static u32 flipLong(u32 l) { static void GUIDtoString(wchar_t *data, const GUID *pg) { wsprintfW(data, L"%08X-%04X-%04X-%04X-%04X%08X", pg->Data1, (u32)pg->Data2, (u32)pg->Data3, - flipShort(((u16*)pg->Data4)[0]), + flipShort(((u16*)pg->Data4)[0]), flipShort(((u16*)pg->Data4)[1]), flipLong(((u32*)pg->Data4)[1])); } @@ -480,21 +480,21 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput ) if( FAILED(hr) || pIWbemLocator == NULL ) goto LCleanup; - bstrNamespace = SysAllocString( L"\\\\.\\root\\cimv2" );if( bstrNamespace == NULL ) goto LCleanup; - bstrClassName = SysAllocString( L"Win32_PNPEntity" ); if( bstrClassName == NULL ) goto LCleanup; - bstrDeviceID = SysAllocString( L"DeviceID" ); if( bstrDeviceID == NULL ) goto LCleanup; - - // Connect to WMI - hr = pIWbemLocator->ConnectServer( bstrNamespace, NULL, NULL, 0L, + bstrNamespace = SysAllocString( L"\\\\.\\root\\cimv2" );if( bstrNamespace == NULL ) goto LCleanup; + bstrClassName = SysAllocString( L"Win32_PNPEntity" ); if( bstrClassName == NULL ) goto LCleanup; + bstrDeviceID = SysAllocString( L"DeviceID" ); if( bstrDeviceID == NULL ) goto LCleanup; + + // Connect to WMI + hr = pIWbemLocator->ConnectServer( bstrNamespace, NULL, NULL, 0L, 0L, NULL, NULL, &pIWbemServices ); if( FAILED(hr) || pIWbemServices == NULL ) goto LCleanup; - // Switch security level to IMPERSONATE. - CoSetProxyBlanket( pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, - RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE ); + // Switch security level to IMPERSONATE. + CoSetProxyBlanket( pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, + RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE ); - hr = pIWbemServices->CreateInstanceEnum( bstrClassName, 0, NULL, &pEnumDevices ); + hr = pIWbemServices->CreateInstanceEnum( bstrClassName, 0, NULL, &pEnumDevices ); if( FAILED(hr) || pEnumDevices == NULL ) goto LCleanup; @@ -515,7 +515,7 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput ) if( SUCCEEDED( hr ) && var.vt == VT_BSTR && var.bstrVal != NULL ) { // Check if the device ID contains "IG_". If it does, then it's an XInput device - // This information can not be found from DirectInput + // This information can not be found from DirectInput if( wcsstr( var.bstrVal, L"IG_" ) ) { // If it does, then get the VID/PID from var.bstrVal @@ -537,7 +537,7 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput ) goto LCleanup; } } - } + } SAFE_RELEASE( pDevices[iDevice] ); } } diff --git a/plugins/LilyPad/InputManager.h b/plugins/LilyPad/InputManager.h index f4a2fa8af1..63a91b8fcf 100644 --- a/plugins/LilyPad/InputManager.h +++ b/plugins/LilyPad/InputManager.h @@ -183,7 +183,7 @@ struct InitInfo { // For config screen, need to eat button's message handling. //HWND hWndButton; - + WndProcEater* hWndProc; }; diff --git a/plugins/LilyPad/LilyPad.cpp b/plugins/LilyPad/LilyPad.cpp index 037c3e35a2..7e0d93f342 100644 --- a/plugins/LilyPad/LilyPad.cpp +++ b/plugins/LilyPad/LilyPad.cpp @@ -402,7 +402,7 @@ struct EnterScopedSection EnterScopedSection( CRITICAL_SECTION& cs ) : m_cs( cs ) { EnterCriticalSection( &m_cs ); } - + ~EnterScopedSection() { LeaveCriticalSection( &m_cs ); } @@ -984,7 +984,7 @@ s32 CALLBACK PADopen(void *pDsp) { hWndGSProc.Eat(HideCursorProc, 0); } SaveStateChanged(); - + windowThreadId = GetWindowThreadProcessId(hWndTop, 0); } diff --git a/plugins/LilyPad/RawInput.cpp b/plugins/LilyPad/RawInput.cpp index 004aef2f35..9595738560 100644 --- a/plugins/LilyPad/RawInput.cpp +++ b/plugins/LilyPad/RawInput.cpp @@ -69,7 +69,7 @@ static int rawMouseActivatedCount = 0; class RawInputKeyboard : public WindowsKeyboard { public: HANDLE hDevice; - + RawInputKeyboard(HANDLE hDevice, wchar_t *name, wchar_t *instanceID=0) : WindowsKeyboard(RAW, name, instanceID) { this->hDevice = hDevice; } @@ -130,7 +130,7 @@ public: GetMouseCapture(hWndProc->hWndEaten); if (!rawKeyboardActivatedCount) hWndProc->Eat(RawInputWndProc, EATPROC_NO_UPDATE_WHILE_UPDATING_DEVICES); - + if (!GetRawMice(hWndProc->hWndEaten)) { Deactivate(); return 0; diff --git a/plugins/LilyPad/WindowsMessaging.cpp b/plugins/LilyPad/WindowsMessaging.cpp index c4b8f29e43..30245c9044 100644 --- a/plugins/LilyPad/WindowsMessaging.cpp +++ b/plugins/LilyPad/WindowsMessaging.cpp @@ -106,7 +106,7 @@ ExtraWndProcResult WindowsMessagingWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, wmk->CheckKey(VK_RMENU); wmk->CheckKey(VK_LMENU); } - else + else wmk->UpdateKey(wParam, (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN)); return NO_WND_PROC; } diff --git a/plugins/LilyPad/WndProcEater.cpp b/plugins/LilyPad/WndProcEater.cpp index b6ab59984c..f4f4be6b31 100644 --- a/plugins/LilyPad/WndProcEater.cpp +++ b/plugins/LilyPad/WndProcEater.cpp @@ -84,7 +84,7 @@ LRESULT WndProcEater::_OverrideWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR } if (res == CONTINUE_BLISSFULLY) out = CallWindowProc(eatenWndProc, hWnd, uMsg, wParam, lParam); - else if (res == USE_DEFAULT_WND_PROC) + else if (res == USE_DEFAULT_WND_PROC) out = DefWindowProc(hWnd, uMsg, wParam, lParam); } return out; @@ -103,7 +103,7 @@ bool WndProcEater::SetWndHandle(HWND hWnd) if(hWnd == hWndEaten) return true; //printf( "(Lilypad) (Re)-Setting window handle! -> this=0x%08x, hWnd=0x%08x\n", this, hWnd ); - + Release(); SetProp(hWnd, L"LilyHaxxor", (HANDLE)this); diff --git a/plugins/LilyPad/WndProcEater.h b/plugins/LilyPad/WndProcEater.h index 1b3b836734..db724860eb 100644 --- a/plugins/LilyPad/WndProcEater.h +++ b/plugins/LilyPad/WndProcEater.h @@ -35,7 +35,7 @@ public: void Eat(ExtraWndProc proc, DWORD flags); void ReleaseExtraProc(ExtraWndProc proc); void Release(); - + LRESULT _OverrideWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); }; diff --git a/plugins/PadNull/Linux/Config.cpp b/plugins/PadNull/Linux/Config.cpp index 05f91b2528..b2a4aaa105 100644 --- a/plugins/PadNull/Linux/Config.cpp +++ b/plugins/PadNull/Linux/Config.cpp @@ -45,13 +45,13 @@ extern "C" GtkWidget *MsgDlg, *About, *Conf; extern string s_strIniPath; -void OnMsg_Ok() +void OnMsg_Ok() { gtk_widget_destroy(MsgDlg); gtk_main_quit(); } -void SysMessage(char *fmt, ...) +void SysMessage(char *fmt, ...) { GtkWidget *Ok,*Txt; GtkWidget *Box,*Box1; @@ -74,7 +74,7 @@ void SysMessage(char *fmt, ...) gtk_widget_show(Box); Txt = gtk_label_new(msg); - + gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5); gtk_widget_show(Txt); @@ -88,25 +88,25 @@ void SysMessage(char *fmt, ...) GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT); gtk_widget_show(Ok); - gtk_widget_show(MsgDlg); + gtk_widget_show(MsgDlg); gtk_main(); } - -void OnAbout_Ok(GtkButton *button, gpointer user_data) + +void OnAbout_Ok(GtkButton *button, gpointer user_data) { gtk_widget_destroy(About); gtk_main_quit(); } -EXPORT_C_(void) PADabout() +EXPORT_C_(void) PADabout() { About = create_About(); gtk_widget_show_all(About); gtk_main(); } -void OnConf_Ok(GtkButton *button, gpointer user_data) +void OnConf_Ok(GtkButton *button, gpointer user_data) { conf.Log = is_checked(Conf, "check_logging"); SaveConfig(); @@ -115,13 +115,13 @@ void OnConf_Ok(GtkButton *button, gpointer user_data) gtk_main_quit(); } -void OnConf_Cancel(GtkButton *button, gpointer user_data) +void OnConf_Cancel(GtkButton *button, gpointer user_data) { gtk_widget_destroy(Conf); gtk_main_quit(); } -EXPORT_C_(void) PADconfigure() +EXPORT_C_(void) PADconfigure() { LoadConfig(); Conf = create_Config(); @@ -131,14 +131,14 @@ EXPORT_C_(void) PADconfigure() gtk_main(); } -void LoadConfig() +void LoadConfig() { FILE *f; char cfg[255]; strcpy(cfg, s_strIniPath.c_str()); f = fopen(cfg, "r"); - if (f == NULL) + if (f == NULL) { printf("failed to open %s\n", s_strIniPath.c_str()); SaveConfig();//save and return @@ -149,14 +149,14 @@ void LoadConfig() fclose(f); } -void SaveConfig() +void SaveConfig() { FILE *f; char cfg[255]; strcpy(cfg, s_strIniPath.c_str()); f = fopen(cfg,"w"); - if (f == NULL) + if (f == NULL) { printf("failed to open '%s'\n", s_strIniPath.c_str()); return; diff --git a/plugins/PadNull/Linux/PadLinux.cpp b/plugins/PadNull/Linux/PadLinux.cpp index 2337ea5d79..92d4e58bbb 100644 --- a/plugins/PadNull/Linux/PadLinux.cpp +++ b/plugins/PadNull/Linux/PadLinux.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "PadLinux.h" Display *GSdsp; @@ -40,7 +40,7 @@ void _PadUpdate(int pad) event.evt = KEYPRESS; event.key = key; break; - + case KeyRelease: key = XLookupKeysym((XKeyEvent *) &evt, 0); @@ -70,6 +70,6 @@ s32 _PADOpen(void *pDsp) } void _PADClose() -{ +{ XAutoRepeatOn(GSdsp); } diff --git a/plugins/PadNull/Linux/PadLinux.h b/plugins/PadNull/Linux/PadLinux.h index 6b61c90aee..27ec16dfd9 100644 --- a/plugins/PadNull/Linux/PadLinux.h +++ b/plugins/PadNull/Linux/PadLinux.h @@ -15,16 +15,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef __PADLINUX_H__ #define __PADLINUX_H__ - + #include "Pad.h" #include #include - + void _PadUpdate(int pad); s32 _PADOpen(void *pDsp); void _PADClose(); - -#endif \ No newline at end of file + +#endif diff --git a/plugins/PadNull/Pad.cpp b/plugins/PadNull/Pad.cpp index ca4985d9f1..320919f884 100644 --- a/plugins/PadNull/Pad.cpp +++ b/plugins/PadNull/Pad.cpp @@ -36,22 +36,22 @@ Config conf; keyEvent event; static keyEvent s_event; -EXPORT_C_(u32) PS2EgetLibType() +EXPORT_C_(u32) PS2EgetLibType() { return PS2E_LT_PAD; } -EXPORT_C_(char*) PS2EgetLibName() +EXPORT_C_(char*) PS2EgetLibName() { return libraryName; } -EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) +EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) { return (version<<16) | (revision<<8) | build; } -void __Log(const char *fmt, ...) +void __Log(const char *fmt, ...) { va_list list; @@ -61,7 +61,7 @@ void __Log(const char *fmt, ...) va_end(list); } -void __LogToConsole(const char *fmt, ...) +void __LogToConsole(const char *fmt, ...) { va_list list; @@ -74,10 +74,10 @@ void __LogToConsole(const char *fmt, ...) va_end(list); } -EXPORT_C_(s32) PADinit(u32 flags) +EXPORT_C_(s32) PADinit(u32 flags) { LoadConfig(); - + #ifdef PAD_LOG if (padLog == NULL) { @@ -90,7 +90,7 @@ EXPORT_C_(s32) PADinit(u32 flags) return 0; } -EXPORT_C_(void) PADshutdown() +EXPORT_C_(void) PADshutdown() { #ifdef PAD_LOG if (padLog != NULL) @@ -101,14 +101,14 @@ EXPORT_C_(void) PADshutdown() #endif } -EXPORT_C_(s32) PADopen(void *pDsp) +EXPORT_C_(s32) PADopen(void *pDsp) { memset(&event, 0, sizeof(event)); return _PADOpen(pDsp); } -EXPORT_C_(void) PADclose() +EXPORT_C_(void) PADclose() { _PADClose(); } @@ -116,10 +116,10 @@ EXPORT_C_(void) PADclose() // PADkeyEvent is called every vsync (return NULL if no event) EXPORT_C_(keyEvent*) PADkeyEvent() { - + s_event = event; event.evt = 0; - + return &s_event; } @@ -157,12 +157,12 @@ EXPORT_C_(void) PADgsDriverInfo(GSdriverInfo *info) { } -EXPORT_C_(s32) PADfreeze(int mode, freezeData *data) +EXPORT_C_(s32) PADfreeze(int mode, freezeData *data) { return 0; } -EXPORT_C_(s32) PADtest() +EXPORT_C_(s32) PADtest() { return 0; } diff --git a/plugins/PadNull/Pad.h b/plugins/PadNull/Pad.h index fb24ff72ca..9e4c6c1279 100644 --- a/plugins/PadNull/Pad.h +++ b/plugins/PadNull/Pad.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef __PAD_H__ #define __PAD_H__ @@ -44,7 +44,7 @@ #define PAD_LOG __Log -typedef struct +typedef struct { s32 Log; } Config; diff --git a/plugins/PadNull/Windows/Config.cpp b/plugins/PadNull/Windows/Config.cpp index 2f777f7b9b..ce5b332fd8 100644 --- a/plugins/PadNull/Windows/Config.cpp +++ b/plugins/PadNull/Windows/Config.cpp @@ -21,7 +21,7 @@ #include "../Pad.h" extern HINSTANCE hInst; -void SaveConfig() +void SaveConfig() { Config *Conf1 = &conf; @@ -45,7 +45,7 @@ void LoadConfig() { Config *Conf1 = &conf; char *szTemp; char szIniFile[256], szValue[256]; - + GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); szTemp = strrchr(szIniFile, '\\'); @@ -54,7 +54,7 @@ void LoadConfig() { fp=fopen("inis\\fwnull.ini","rt");//check if firewirenull.ini really exists if (!fp) { - CreateDirectory("inis",NULL); + CreateDirectory("inis",NULL); memset(&conf, 0, sizeof(conf)); conf.Log = 0;//default value SaveConfig();//save and return diff --git a/plugins/PadNull/Windows/PadWin.cpp b/plugins/PadNull/Windows/PadWin.cpp index e8d5b11598..6a25aeb335 100644 --- a/plugins/PadNull/Windows/PadWin.cpp +++ b/plugins/PadNull/Windows/PadWin.cpp @@ -24,7 +24,7 @@ HWND GShwnd = NULL; LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) + switch (msg) { case WM_KEYDOWN: if (lParam & 0x40000000)return TRUE; @@ -58,8 +58,8 @@ void _PadUpdate(int pad) s32 _PADOpen(void *pDsp) { GShwnd = (HWND)*(long*)pDsp; - - if (GShwnd != NULL && GSwndProc != NULL) + + if (GShwnd != NULL && GSwndProc != NULL) { // revert SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc)); @@ -71,11 +71,11 @@ s32 _PADOpen(void *pDsp) } void _PADClose() -{ - if (GShwnd != NULL && GSwndProc != NULL) +{ + if (GShwnd != NULL && GSwndProc != NULL) { SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc)); GSwndProc = NULL; GShwnd = NULL; } -} \ No newline at end of file +} diff --git a/plugins/PadNull/Windows/PadWin.h b/plugins/PadNull/Windows/PadWin.h index 5bd2bd73e1..ce49f14fc0 100644 --- a/plugins/PadNull/Windows/PadWin.h +++ b/plugins/PadNull/Windows/PadWin.h @@ -15,16 +15,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef __PADLINUX_H__ #define __PADLINUX_H__ - + #include "../Pad.h" #include #include - + void _PadUpdate(int pad); s32 _PADOpen(void *pDsp); void _PADClose(); - -#endif \ No newline at end of file + +#endif diff --git a/plugins/PadNull/Windows/Win32.cpp b/plugins/PadNull/Windows/Win32.cpp index 106cfafbf5..d2f6da9d01 100644 --- a/plugins/PadNull/Windows/Win32.cpp +++ b/plugins/PadNull/Windows/Win32.cpp @@ -37,7 +37,7 @@ void SysMessage(char *fmt, ...) { } BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { - + switch(uMsg) { case WM_INITDIALOG: LoadConfig(); @@ -52,7 +52,7 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) case IDOK: if (IsDlgButtonChecked(hW, IDC_LOGGING)) conf.Log = 1; - else + else conf.Log = 0; SaveConfig(); EndDialog(hW, FALSE); @@ -80,19 +80,19 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { EXPORT_C_(void) PADconfigure() { DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), - GetActiveWindow(), - (DLGPROC)ConfigureDlgProc); + GetActiveWindow(), + (DLGPROC)ConfigureDlgProc); } EXPORT_C_(void) PADabout() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)AboutDlgProc); } BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT - DWORD dwReason, + DWORD dwReason, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; return TRUE; // very quick :) diff --git a/plugins/PadNull/Windows/resource.h b/plugins/PadNull/Windows/resource.h index 6ea8fead11..21d4221a1e 100644 --- a/plugins/PadNull/Windows/resource.h +++ b/plugins/PadNull/Windows/resource.h @@ -10,7 +10,7 @@ #define IDC_LOGGING 1007 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 105 diff --git a/plugins/PeopsSPU2/adsr.c b/plugins/PeopsSPU2/adsr.c index 88dc30245a..0413b264c9 100644 --- a/plugins/PeopsSPU2/adsr.c +++ b/plugins/PeopsSPU2/adsr.c @@ -76,9 +76,9 @@ INLINE void StartADSR(int ch) // MIX ADSR //////////////////////////////////////////////////////////////////////// INLINE int MixADSR(int ch) // MIX ADSR -{ +{ if(s_chan[ch].bStop) // should be stopped: - { + { if(s_chan[ch].bIgnoreLoop==0){ s_chan[ch].ADSRX.EnvelopeVol=0; s_chan[ch].bOn=0; @@ -107,7 +107,7 @@ INLINE int MixADSR(int ch) // MIX ADSR s_chan[ch].ADSRX.EnvelopeVol-=RateTable[(4*(s_chan[ch].ADSRX.ReleaseRate^0x1F))-0x0C + 32]; } - if(s_chan[ch].ADSRX.EnvelopeVol<0) + if(s_chan[ch].ADSRX.EnvelopeVol<0) { s_chan[ch].ADSRX.EnvelopeVol=0; s_chan[ch].bOn=0; @@ -127,7 +127,7 @@ INLINE int MixADSR(int ch) // MIX ADSR { if(s_chan[ch].ADSRX.AttackModeExp) { - if(s_chan[ch].ADSRX.EnvelopeVol<0x60000000) + if(s_chan[ch].ADSRX.EnvelopeVol<0x60000000) s_chan[ch].ADSRX.EnvelopeVol+=RateTable[(s_chan[ch].ADSRX.AttackRate^0x7F)-0x10 + 32]; else s_chan[ch].ADSRX.EnvelopeVol+=RateTable[(s_chan[ch].ADSRX.AttackRate^0x7F)-0x18 + 32]; @@ -137,7 +137,7 @@ INLINE int MixADSR(int ch) // MIX ADSR s_chan[ch].ADSRX.EnvelopeVol+=RateTable[(s_chan[ch].ADSRX.AttackRate^0x7F)-0x10 + 32]; } - if(s_chan[ch].ADSRX.EnvelopeVol<0) + if(s_chan[ch].ADSRX.EnvelopeVol<0) { s_chan[ch].ADSRX.EnvelopeVol=0x7FFFFFFF; s_chan[ch].ADSRX.State=1; @@ -177,7 +177,7 @@ INLINE int MixADSR(int ch) // MIX ADSR { if(s_chan[ch].ADSRX.SustainModeExp) { - if(s_chan[ch].ADSRX.EnvelopeVol<0x60000000) + if(s_chan[ch].ADSRX.EnvelopeVol<0x60000000) s_chan[ch].ADSRX.EnvelopeVol+=RateTable[(s_chan[ch].ADSRX.SustainRate^0x7F)-0x10 + 32]; else s_chan[ch].ADSRX.EnvelopeVol+=RateTable[(s_chan[ch].ADSRX.SustainRate^0x7F)-0x18 + 32]; @@ -187,7 +187,7 @@ INLINE int MixADSR(int ch) // MIX ADSR s_chan[ch].ADSRX.EnvelopeVol+=RateTable[(s_chan[ch].ADSRX.SustainRate^0x7F)-0x10 + 32]; } - if(s_chan[ch].ADSRX.EnvelopeVol<0) + if(s_chan[ch].ADSRX.EnvelopeVol<0) { s_chan[ch].ADSRX.EnvelopeVol=0x7FFFFFFF; } @@ -213,7 +213,7 @@ INLINE int MixADSR(int ch) // MIX ADSR s_chan[ch].ADSRX.EnvelopeVol-=RateTable[((s_chan[ch].ADSRX.SustainRate^0x7F))-0x0F + 32]; } - if(s_chan[ch].ADSRX.EnvelopeVol<0) + if(s_chan[ch].ADSRX.EnvelopeVol<0) { s_chan[ch].ADSRX.EnvelopeVol=0; } @@ -234,7 +234,7 @@ PSX SPU Envelope Timings ~~~~~~~~~~~~~~~~~~~~~~~~ First, here is an extract from doomed's SPU doc, which explains the basics -of the SPU "volume envelope": +of the SPU "volume envelope": *** doomed doc extract start *** @@ -308,7 +308,7 @@ ADSRvol Returns the current envelope volume when read. -- James' Note: return range: 0 -> 32767 -*** doomed doc extract end *** +*** doomed doc extract end *** By using a small PSX proggie to visualise the envelope as it was played, the following results for envelope timing were obtained: @@ -364,7 +364,7 @@ the following results for envelope timing were obtained: Substituting, we get: k = 0.00146 Further info on logarithmic nature: - frames to decay to sustain level 3 = 3 * frames to decay to + frames to decay to sustain level 3 = 3 * frames to decay to sustain level 9 Also no. of frames to 25% volume = roughly 1.85 * no. of frames to @@ -426,7 +426,7 @@ the following results for envelope timing were obtained: ------------------------------------ -Other notes: +Other notes: Log stuff not figured out. You may get some clues from the "Decay rate" stuff above. For emu purposes it may not be important - use linear @@ -464,7 +464,7 @@ every one millisecond lT=s_chan[ch].ADSR.lTime- // -> how much time is past? s_chan[ch].ADSR.ReleaseStartTime; l1=s_chan[ch].ADSR.ReleaseTime; - + if(lT we still have to release { v=v-((v*lT)/l1); // --> calc new volume @@ -477,12 +477,12 @@ every one millisecond v=0;s_chan[ch].bOn=0;s_chan[ch].ADSR.ReleaseVol=0;s_chan[ch].bNoise=0; } } - else + else {//--------------------------------------------------// not in release phase: v=1024; lT=s_chan[ch].ADSR.lTime; l1=s_chan[ch].ADSR.AttackTime; - + if(lT1024) v=1024; // adjust volume - if(v<0) v=0; + if(v<0) v=0; s_chan[ch].ADSR.lVolume=v; // store act volume return v; // return the volume factor diff --git a/plugins/PeopsSPU2/alsa.c b/plugins/PeopsSPU2/alsa.c index de731b8daf..dcf1eca524 100644 --- a/plugins/PeopsSPU2/alsa.c +++ b/plugins/PeopsSPU2/alsa.c @@ -83,7 +83,7 @@ void SetupSound(void) buffer_time=500000; period_time=buffer_time/4; - if((err=snd_pcm_open(&handle, "default", + if((err=snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK))<0) { printf("Audio open error: %s\n", snd_strerror(err)); diff --git a/plugins/PeopsSPU2/cfg.c b/plugins/PeopsSPU2/cfg.c index c4a08fa8d4..1dfbde7434 100644 --- a/plugins/PeopsSPU2/cfg.c +++ b/plugins/PeopsSPU2/cfg.c @@ -76,8 +76,8 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) //////////////////////////////////////////////////////////////////////// // timer mode 2 (spuupdate sync mode) can be enabled for windows -// by setting MAXMODE to 2. -// Attention: that mode is not much tested, maybe the dsound buffers +// by setting MAXMODE to 2. +// Attention: that mode is not much tested, maybe the dsound buffers // need to get adjusted to use that mode safely. Also please note: // sync sound updates will _always_ cause glitches, if the system is // busy by, for example, long lasting cdrom accesses. OK, you have @@ -159,12 +159,12 @@ void WriteConfig(void) // INIT WIN CFG DIALOG //////////////////////////////////////////////////////////////////////// -BOOL OnInitDSoundDialog(HWND hW) +BOOL OnInitDSoundDialog(HWND hW) { HWND hWC; ReadConfig(); - + hWC=GetDlgItem(hW,IDC_VOLUME); ComboBox_AddString(hWC, "0: Mute"); ComboBox_AddString(hWC, "1: low"); @@ -187,15 +187,15 @@ BOOL OnInitDSoundDialog(HWND hW) ComboBox_AddString(hWC, "2: Gaussian interpolation (good quality)"); ComboBox_AddString(hWC, "3: Cubic interpolation (better treble)"); ComboBox_SetCurSel(hWC,iUseInterpolation); - - return TRUE; + + return TRUE; } //////////////////////////////////////////////////////////////////////// // WIN CFG DLG OK //////////////////////////////////////////////////////////////////////// -void OnDSoundOK(HWND hW) +void OnDSoundOK(HWND hW) { HWND hWC; @@ -226,7 +226,7 @@ void OnDSoundOK(HWND hW) // WIN CFG DLG CANCEL //////////////////////////////////////////////////////////////////////// -void OnDSoundCancel(HWND hW) +void OnDSoundCancel(HWND hW) { EndDialog(hW,FALSE); } diff --git a/plugins/PeopsSPU2/debug.c b/plugins/PeopsSPU2/debug.c index bd1d98ea3e..df04b7a7a4 100644 --- a/plugins/PeopsSPU2/debug.c +++ b/plugins/PeopsSPU2/debug.c @@ -79,7 +79,7 @@ int iCoreOffset=0; //////////////////////////////////////////////////////////////////////// // display the sound data waves: no subclassing used, so the // area will not be redrawn... but faster that way, and good enuff -// for debugging purposes +// for debugging purposes void DisplayStreamInfos(HWND hW) { @@ -87,7 +87,7 @@ void DisplayStreamInfos(HWND hW) HDC hdc;RECT r;HBRUSH hBO;int ch,dy,i,j,id; //----------------------------------------------------// - + GetClientRect(hWS,&r); // get size of stream display hdc=GetDC(hWS); // device context r.right--; // leave the right border intact @@ -161,9 +161,9 @@ void DisplayADSRInfos(HWND hW) PatBlt(hdc,0,0,r.right,r.bottom,PATCOPY); r.left++;r.right-=2;r.top++;r.bottom-=2; // shrink the display rect for better optics - //----------------------------------------------------// + //----------------------------------------------------// - ia=min(s_chan[ch].ADSR.AttackTime,10000); // get adsr, but limit it for drawing + ia=min(s_chan[ch].ADSR.AttackTime,10000); // get adsr, but limit it for drawing id=min(s_chan[ch].ADSR.DecayTime,10000); is=min(s_chan[ch].ADSR.SustainTime,10000); ir=min(s_chan[ch].ADSR.ReleaseTime,10000); @@ -197,15 +197,15 @@ void DisplayADSRInfos(HWND hW) LineTo(hdc,dn,dy); // line to DxPos,SLevel SelectObject(hdc,hPAdsr[3]); // sel S pen - if(s_chan[ch].ADSR.SustainTime>10000) + if(s_chan[ch].ADSR.SustainTime>10000) dm=1; // we have to fake the S values... S will else // inc/decrease until channel stop... - if(s_chan[ch].ADSR.SustainTime==0) + if(s_chan[ch].ADSR.SustainTime==0) dm=0; // we dunno here when this will happen, - else + else dm=21-(((s_chan[ch].ADSR.SustainTime/500))); // so we do some more or less angled line, dy=dy-(s_chan[ch].ADSR.SustainModeDec*dm); // roughly depending on the S time - if(dy>r.bottom) dy=r.bottom; + if(dy>r.bottom) dy=r.bottom; if(dy>1); SetDlgItemText(hW,IDC_CI10,szB); if(s_chan[ch].pCurr==(unsigned char *)-1) SetDlgItemText(hW,IDC_CI11,"FFFFFFFF"); - else + else { wsprintf(szB,"%08lX",((unsigned long)s_chan[ch].pCurr-(unsigned long)spuMemC)>>1); SetDlgItemText(hW,IDC_CI11,szB); @@ -270,23 +270,23 @@ void DisplayChannelInfos(HWND hW) SetDlgItemText(hW,IDC_CI19,szB); // generic infos - /*if(pSpuIrq[ch]==0) + /*if(pSpuIrq[ch]==0) SetDlgItemText(hW,IDC_STA1,"FFFFFFFF"); else {*/ wsprintf(szB,"%08lX",((unsigned long)pSpuIrq[ch/24]-(unsigned long)spuMemC)>>1); SetDlgItemText(hW,IDC_STA1,szB); /*}*/ - + wsprintf(szB,"%04X",spuCtrl2[ch/24]); SetDlgItemText(hW,IDC_STA2,szB); wsprintf(szB,"%04X",spuStat2[ch/24]); SetDlgItemText(hW,IDC_STA3,szB); - + wsprintf(szB,"%08lX",spuAddr2[ch/24]); SetDlgItemText(hW,IDC_STA4,szB); } - + //////////////////////////////////////////////////////////////////////// // display everything (called in dialog timer for value refreshing) @@ -324,7 +324,7 @@ BOOL CALLBACK DebugDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) // create brushes/pens hBStream[0]=CreateSolidBrush(GetSysColor(COLOR_3DFACE)); hPAdsr[0]=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DFACE)); - for(i=1;i<6;i++) + for(i=1;i<6;i++) { hBStream[i]=CreateSolidBrush(crStreamCol[i]); hPAdsr[i]=CreatePen(PS_SOLID,0,crAdsrCol[i]); @@ -360,7 +360,7 @@ BOOL CALLBACK DebugDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) if(IsDlgButtonChecked(hW,IDC_CORE1)) // -> sel correct half of channels iCoreOffset=0; else iCoreOffset=24; - + for(i=IDC_MUTE1;i<=IDC_MUTE24;i++) { if(s_chan[i-IDC_MUTE1+iCoreOffset].iMute) @@ -376,16 +376,16 @@ BOOL CALLBACK DebugDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { if(IsDlgButtonChecked(hW,wParam)) // -> mute/unmute it s_chan[wParam-IDC_MUTE1+iCoreOffset].iMute=1; - else + else s_chan[wParam-IDC_MUTE1+iCoreOffset].iMute=0; } // all mute/unmute - if(wParam==IDC_MUTEOFF) SendMessage(hW,WM_MUTE,0,0); + if(wParam==IDC_MUTEOFF) SendMessage(hW,WM_MUTE,0,0); if(wParam==IDC_MUTEON) SendMessage(hW,WM_MUTE,1,0); if(wParam>=IDC_CHAN1 && wParam<=IDC_CHAN24) // sel channel { - if(IsDlgButtonChecked(hW,wParam)) + if(IsDlgButtonChecked(hW,wParam)) { iSelChannel=wParam-IDC_CHAN1; SetDlgItemInt(hW,IDC_CHANNUM,iSelChannel+1,FALSE); @@ -399,7 +399,7 @@ BOOL CALLBACK DebugDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) for(i=IDC_MUTE1;i<=IDC_MUTE24;i++) { CheckDlgButton(hW,i,wParam); - if(wParam) + if(wParam) s_chan[i-IDC_MUTE1+iCoreOffset].iMute=1; else s_chan[i-IDC_MUTE1+iCoreOffset].iMute=0; @@ -412,7 +412,7 @@ BOOL CALLBACK DebugDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) //--------------------------------------------------// setcursor case WM_SETCURSOR: { - SetCursor(LoadCursor(NULL,IDC_ARROW)); // force the arrow + SetCursor(LoadCursor(NULL,IDC_ARROW)); // force the arrow return TRUE; } //--------------------------------------------------// @@ -430,7 +430,7 @@ void logprintf(LPCTSTR pFormat, ...) else { va_list list; - + va_start(list,pFormat); vfprintf(LogFile, pFormat, list); va_end(list); diff --git a/plugins/PeopsSPU2/dma.c b/plugins/PeopsSPU2/dma.c index e850460d7e..97a4a14487 100644 --- a/plugins/PeopsSPU2/dma.c +++ b/plugins/PeopsSPU2/dma.c @@ -52,10 +52,10 @@ EXPORT_GCC void CALLBACK SPU2readDMA4Mem(unsigned short * pusPSXMem,int iSize) { int i; #ifdef _WINDOWS - if(iDebugMode==1) + if(iDebugMode==1) { logprintf("READDMA4 %X - %X\r\n",spuAddr2[0],iSize); - + if(spuAddr2[0]<=0x1fff) logprintf("# OUTPUT AREA ACCESS #############\r\n"); } @@ -76,7 +76,7 @@ EXPORT_GCC void CALLBACK SPU2readDMA4Mem(unsigned short * pusPSXMem,int iSize) } spuAddr2[0]+=19; //Transfer Local To Host TSAH/L + Data Size + 20 (already +1'd) - + iSpuAsyncWait=0; @@ -96,10 +96,10 @@ EXPORT_GCC void CALLBACK SPU2readDMA7Mem(unsigned short * pusPSXMem,int iSize) { int i; #ifdef _WINDOWS - if(iDebugMode==1) - { + if(iDebugMode==1) + { logprintf("READDMA7 %X - %X\r\n",spuAddr2[1],iSize); - + if(spuAddr2[1]<=0x1fff) logprintf("# OUTPUT AREA ACCESS #############\r\n"); } @@ -140,10 +140,10 @@ spuAddr2[1]+=19; //Transfer Local To Host TSAH/L + Data Size + 20 (already +1'd) // AutoDMA's are used to transfer to the DIRECT INPUT area of the spu2 memory -// Left and Right channels are always interleaved together in the transfer so +// Left and Right channels are always interleaved together in the transfer so // the AutoDMA's deinterleaves them and transfers them. An interrupt is -// generated when half of the buffer (256 short-words for left and 256 -// short-words for right ) has been transferred. Another interrupt occurs at +// generated when half of the buffer (256 short-words for left and 256 +// short-words for right ) has been transferred. Another interrupt occurs at // the end of the transfer. int ADMAS4Write() @@ -160,11 +160,11 @@ int ADMAS4Write() if(Adma4.ADMAPos == 512) Adma4.ADMAPos = 0; #ifdef _WINDOWS - if(iDebugMode==1) + if(iDebugMode==1) { logprintf("ADMAWRITE4 %X - %X\r\n",spuAddr2[0],Adma4.AmountLeft); if(Adma4.AmountLeft<512) logprintf("FUCK YOU %X\r\n",Adma4.AmountLeft); - } + } #endif // SPU2 Deinterleaves the Left and Right Channels @@ -178,8 +178,8 @@ int ADMAS4Write() //MemAddr[0] += 1024; Adma4.AmountLeft-= Adma4.TransferAmount; spuStat2[0]&=~0x80; - - if(Adma4.AmountLeft == 0) + + if(Adma4.AmountLeft == 0) { if(Adma4.IRQ == 0){ Adma4.IRQ = 1; @@ -204,11 +204,11 @@ int ADMAS7Write() if(Adma7.ADMAPos == 512) Adma7.ADMAPos = 0; #ifdef _WINDOWS - if(iDebugMode==1) + if(iDebugMode==1) { logprintf("ADMAWRITE7 %X - %X\r\n",spuAddr2[1],Adma7.AmountLeft); if(Adma7.AmountLeft<512) logprintf("FUCK YOU %X\r\n",Adma7.AmountLeft); - } + } #endif // SPU2 Deinterleaves the Left and Right Channels @@ -222,8 +222,8 @@ int ADMAS7Write() //MemAddr[1] += 1024; Adma7.AmountLeft-=Adma7.TransferAmount; spuStat2[1]&=~0x80; - - if(Adma7.AmountLeft == 0) + + if(Adma7.AmountLeft == 0) { if(Adma7.IRQ == 0){ Adma7.IRQ = 1; @@ -257,10 +257,10 @@ EXPORT_GCC void CALLBACK SPU2writeDMA4Mem(short * pMem,unsigned int iSize) } #ifdef _WINDOWS - if(iDebugMode==1) + if(iDebugMode==1) { logprintf("WRITEDMA4 %X - %X\r\n",spuAddr2[0],iSize); - } + } #endif memcpy((unsigned char*)(spuMem+spuAddr2[0]),(unsigned char*)pMem,iSize<<1); @@ -270,9 +270,9 @@ EXPORT_GCC void CALLBACK SPU2writeDMA4Mem(short * pMem,unsigned int iSize) irqCallbackSPU2(); } spuAddr2[0] += iSize; - + if(spuAddr2[0]>0x23FF) spuAddr2[0] = 0x2000; - + MemAddr[0] += iSize<<1; spuStat2[0]&=~0x80; SPUStartCycle[0] = SPUCycles; @@ -335,10 +335,10 @@ EXPORT_GCC void CALLBACK SPU2writeDMA7Mem(unsigned short * pMem,int iSize) return; } #ifdef _WINDOWS - if(iDebugMode==1) + if(iDebugMode==1) { logprintf("WRITEDMA7 %X - %X\r\n",spuAddr2[1],iSize); - } + } #endif memcpy((short*)(spuMem+spuAddr2[1]),(short*)pMem,iSize<<1); @@ -348,14 +348,14 @@ EXPORT_GCC void CALLBACK SPU2writeDMA7Mem(unsigned short * pMem,int iSize) irqCallbackSPU2(); } spuAddr2[1] += iSize; - + if(spuAddr2[1]>0x27FF) spuAddr2[1] = 0x2400; - + MemAddr[1] += iSize<<1; spuStat2[1]&=~0x80; SPUStartCycle[1] = SPUCycles; SPUTargetCycle[1] = 1;//iSize; - interrupt |= (1<<2); + interrupt |= (1<<2); } @@ -363,7 +363,7 @@ EXPORT_GCC void CALLBACK SPU2writeDMA7Mem(unsigned short * pMem,int iSize) // INTERRUPTS //////////////////////////////////////////////////////////////////////// -void InterruptDMA4(void) +void InterruptDMA4(void) { // taken from linuzappz NULL spu2 // spu2Rs16(CORE0_ATTR)&= ~0x30; @@ -377,13 +377,13 @@ void InterruptDMA4(void) spuCtrl2[0]&=~0x30; spuStat2[0]|=0x80; } - -EXPORT_GCC void CALLBACK SPU2interruptDMA4(void) + +EXPORT_GCC void CALLBACK SPU2interruptDMA4(void) { InterruptDMA4(); } -void InterruptDMA7(void) +void InterruptDMA7(void) { // taken from linuzappz NULL spu2 // spu2Rs16(CORE1_ATTR)&= ~0x30; @@ -398,7 +398,7 @@ void InterruptDMA7(void) spuCtrl2[1]&=~0x30; } -EXPORT_GCC void CALLBACK SPU2interruptDMA7(void) +EXPORT_GCC void CALLBACK SPU2interruptDMA7(void) { InterruptDMA7(); } @@ -411,4 +411,4 @@ EXPORT_GCC void CALLBACK SPU2WriteMemAddr(int core, unsigned long value) EXPORT_GCC unsigned long CALLBACK SPU2ReadMemAddr(int core) { return MemAddr[core]; -} \ No newline at end of file +} diff --git a/plugins/PeopsSPU2/dma.h b/plugins/PeopsSPU2/dma.h index f56d10166b..8cef33ea05 100644 --- a/plugins/PeopsSPU2/dma.h +++ b/plugins/PeopsSPU2/dma.h @@ -25,4 +25,4 @@ //*************************************************************************// void InterruptDMA4(void); -void InterruptDMA7(void); +void InterruptDMA7(void); diff --git a/plugins/PeopsSPU2/dsound.c b/plugins/PeopsSPU2/dsound.c index 7c9aad6d82..762ef58090 100644 --- a/plugins/PeopsSPU2/dsound.c +++ b/plugins/PeopsSPU2/dsound.c @@ -39,9 +39,9 @@ #ifdef _WINDOWS #define _LPCWAVEFORMATEX_DEFINED #include "dsound.h" - + #include "record.h" - + //////////////////////////////////////////////////////////////////////// // dsound globals //////////////////////////////////////////////////////////////////////// @@ -68,7 +68,7 @@ void SetupSound(void) HRESULT dsval;WAVEFORMATEX pcmwf; dsval = DirectSoundCreate(NULL,&lpDS,NULL); - if(dsval!=DS_OK) + if(dsval!=DS_OK) { MessageBox(hWMain,"DirectSoundCreate!","Error",MB_OK); return; @@ -85,12 +85,12 @@ void SetupSound(void) memset(&dsbd,0,sizeof(DSBUFFERDESC)); dsbd.dwSize = sizeof(DSBUFFERDESC); // NT4 hack! sizeof(dsbd); - dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; - dsbd.dwBufferBytes = 0; + dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; + dsbd.dwBufferBytes = 0; dsbd.lpwfxFormat = NULL; dsval=IDirectSound_CreateSoundBuffer(lpDS,&dsbd,&lpDSBPRIMARY,NULL); - if(dsval!=DS_OK) + if(dsval!=DS_OK) { MessageBox(hWMain, "CreateSoundBuffer (Primary)", "Error",MB_OK); return; @@ -99,16 +99,16 @@ void SetupSound(void) memset(&pcmwf, 0, sizeof(WAVEFORMATEX)); pcmwf.wFormatTag = WAVE_FORMAT_PCM; - pcmwf.nChannels = 2; + pcmwf.nChannels = 2; pcmwf.nBlockAlign = 4; pcmwf.nSamplesPerSec = 48000; - + pcmwf.nAvgBytesPerSec = pcmwf.nSamplesPerSec * pcmwf.nBlockAlign; pcmwf.wBitsPerSample = 16; dsval=IDirectSoundBuffer_SetFormat(lpDSBPRIMARY,&pcmwf); - if(dsval!=DS_OK) + if(dsval!=DS_OK) { MessageBox(hWMain, "SetFormat!", "Error",MB_OK); return; @@ -126,11 +126,11 @@ void SetupSound(void) dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf; dsval=IDirectSound_CreateSoundBuffer(lpDS,&dsbdesc,&lpDSBSECONDARY1,NULL); - if(dsval!=DS_OK) + if(dsval!=DS_OK) { dsbdesc.dwFlags = DSBCAPS_LOCSOFTWARE | DSBCAPS_STICKYFOCUS | DSBCAPS_GETCURRENTPOSITION2; dsval=IDirectSound_CreateSoundBuffer(lpDS,&dsbdesc,&lpDSBSECONDARY1,NULL); - if(dsval!=DS_OK) + if(dsval!=DS_OK) { MessageBox(hWMain,"CreateSoundBuffer (Secondary1)", "Error",MB_OK); return; @@ -140,14 +140,14 @@ void SetupSound(void) dsval=IDirectSoundBuffer_Play(lpDSBPRIMARY,0,0,DSBPLAY_LOOPING); - if(dsval!=DS_OK) + if(dsval!=DS_OK) { MessageBox(hWMain,"Play (Primary)","Error",MB_OK); return; } dsval=IDirectSoundBuffer_Play(lpDSBSECONDARY1,0,0,DSBPLAY_LOOPING); - if(dsval!=DS_OK) + if(dsval!=DS_OK) { MessageBox(hWMain,"Play (Secondary1)","Error",MB_OK); return; @@ -160,12 +160,12 @@ void SetupSound(void) //////////////////////////////////////////////////////////////////////// void RemoveSound(void) -{ +{ int iRes; if(iDoRecord) RecordStop(); - if(lpDSBSECONDARY1!=NULL) + if(lpDSBSECONDARY1!=NULL) { IDirectSoundBuffer_Stop(lpDSBSECONDARY1); iRes=IDirectSoundBuffer_Release(lpDSBSECONDARY1); @@ -174,7 +174,7 @@ void RemoveSound(void) lpDSBSECONDARY1=NULL; } - if(lpDSBPRIMARY!=NULL) + if(lpDSBPRIMARY!=NULL) { IDirectSoundBuffer_Stop(lpDSBPRIMARY); iRes=IDirectSoundBuffer_Release(lpDSBPRIMARY); @@ -183,7 +183,7 @@ void RemoveSound(void) lpDSBPRIMARY=NULL; } - if(lpDS!=NULL) + if(lpDS!=NULL) { iRes=IDirectSound_Release(lpDS); // FF says such a loop is bad... Demo says it's good... Pete doesn't care @@ -218,7 +218,7 @@ unsigned long SoundGetBytesBuffered(void) void SoundFeedVoiceData(unsigned char* pSound,long lBytes) { LPVOID lpvPtr1, lpvPtr2; - unsigned long dwBytes1,dwBytes2; + unsigned long dwBytes1,dwBytes2; unsigned long *lpSS, *lpSD; unsigned long dw,cplay,cwrite; HRESULT hr; @@ -238,7 +238,7 @@ void SoundFeedVoiceData(unsigned char* pSound,long lBytes) if(LastWrite==0xffffffff) LastWrite=cwrite; hr=IDirectSoundBuffer_Lock(lpDSBSECONDARY1,LastWrite,lBytes, - &lpvPtr1, &dwBytes1, + &lpvPtr1, &dwBytes1, &lpvPtr2, &dwBytes2, 0); diff --git a/plugins/PeopsSPU2/externals.h b/plugins/PeopsSPU2/externals.h index 9b74b85d8d..40e2c248e1 100644 --- a/plugins/PeopsSPU2/externals.h +++ b/plugins/PeopsSPU2/externals.h @@ -53,10 +53,10 @@ // sound buffer sizes // 500 ms complete sound buffer #define SOUNDSIZE 76800 - + // 200 ms test buffer... if less than that is buffered, a new upload will happen #define TESTSIZE 26304//13152 - + // num of channels #define MAXCHAN 48 #define HLFCHAN 24 @@ -100,8 +100,8 @@ typedef struct int ReleaseModeExp; unsigned long ReleaseVal; long ReleaseTime; - long ReleaseStartTime; - long ReleaseVol; + long ReleaseStartTime; + long ReleaseVol; long lTime; long lVolume; } ADSRInfo; @@ -123,7 +123,7 @@ typedef struct long lDummy1; long lDummy2; } ADSRInfoEx; - + /////////////////////////////////////////////////////////// // Tmp Flags @@ -156,18 +156,18 @@ typedef struct unsigned char * pLoop; // loop ptr in sound mem int iStartAdr; - int iLoopAdr; - int iNextAdr; + int iLoopAdr; + int iNextAdr; int bOn; // is channel active (sample playing?) int bStop; // is channel stopped (sample _can_ still be playing, ADSR Release phase) int bEndPoint; // end point reached int bReverbL; // can we do reverb on this channel? must have ctrl register bit, to get active - int bReverbR; - + int bReverbR; + int bVolumeL; // Volume on/off int bVolumeR; - + int iActFreq; // current psx pitch int iUsedFreq; // current pc pitch int iLeftVolume; // left volume @@ -183,7 +183,7 @@ typedef struct int bRVBActive; // reverb active flag int bNoise; // noise active flag int bFMod; // freq mod (0=off, 1=sound channel, 2=freq channel) - int iOldNoise; // old noise val for this channel + int iOldNoise; // old noise val for this channel ADSRInfo ADSR; // active ADSR settings ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start) @@ -252,7 +252,7 @@ extern HINSTANCE hInst; // psx buffers / addresses -extern unsigned short regArea[]; +extern unsigned short regArea[]; extern unsigned short spuMem[]; extern unsigned char * spuMemC; extern unsigned char * pSpuIrq[]; @@ -283,7 +283,7 @@ extern unsigned long spuAddr2[]; extern unsigned long spuRvbAddr2[]; extern unsigned long spuRvbAEnd2[]; -extern int bEndThread; +extern int bEndThread; extern int bThreadEnded; extern int bSpuInit; diff --git a/plugins/PeopsSPU2/freeze.c b/plugins/PeopsSPU2/freeze.c index 5496a96d05..a722dd124d 100644 --- a/plugins/PeopsSPU2/freeze.c +++ b/plugins/PeopsSPU2/freeze.c @@ -29,7 +29,7 @@ // - fix to prevent the new interpolations from crashing when loading a save state // // 2003/01/06 - Pete -// - small changes for version 1.3 adsr save state loading +// - small changes for version 1.3 adsr save state loading // // 2002/05/15 - Pete // - generic cleanup for the Peops release @@ -76,7 +76,7 @@ typedef struct unsigned long dummy2; unsigned long dummy3; - SPUCHAN s_chan[MAXCHAN]; + SPUCHAN s_chan[MAXCHAN]; } SPUOSSFreeze_t; @@ -102,9 +102,9 @@ EXPORT_GCC long CALLBACK SPU2freeze(unsigned long ulFreezeMode,SPUFreeze_t * pFt if(ulFreezeMode==2) return 0; // emu just asking for size? bye if(!pFt->data) return 0; - + pF=(SPUFreeze_Ex_t *)pFt->data; - + memset(pF,0,pFt->size); strcpy(pF->szSPUName,"PBOSS2"); @@ -161,7 +161,7 @@ EXPORT_GCC long CALLBACK SPU2freeze(unsigned long ulFreezeMode,SPUFreeze_t * pFt memcpy(spuMem,pF->cSPURam,2*1024*1024); // get ram memcpy(regArea,pF->cSPUPort,64*1024); - if(!strcmp(pF->szSPUName,"PBOSS2") && + if(!strcmp(pF->szSPUName,"PBOSS2") && pF->ulFreezeVersion==1) LoadStateV1(pF); else LoadStateUnknown(pF); @@ -238,7 +238,7 @@ void LoadStateUnknown(SPUFreeze_Ex_t * pF) dwNewChannel2[1]=0; dwEndChannel2[0]=0; dwEndChannel2[1]=0; - + pSpuIrq[0]=0; pSpuIrq[1]=0; } diff --git a/plugins/PeopsSPU2/gauss_i.h b/plugins/PeopsSPU2/gauss_i.h index 7cc957308a..a555b4ad54 100644 --- a/plugins/PeopsSPU2/gauss_i.h +++ b/plugins/PeopsSPU2/gauss_i.h @@ -5,7 +5,7 @@ copyright : (C) 2003 by Chris Moeller, eh, whatever email : chris@kode54.tk ***************************************************************************/ - + /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * @@ -15,7 +15,7 @@ * additional informations. * * * ***************************************************************************/ - + //*************************************************************************// // History of changes: // @@ -31,132 +31,132 @@ #define GAUSS_H const int gauss[]={ - 0x172, 0x519, 0x176, 0x000, 0x16E, 0x519, 0x17A, 0x000, - 0x16A, 0x518, 0x17D, 0x000, 0x166, 0x518, 0x181, 0x000, - 0x162, 0x518, 0x185, 0x000, 0x15F, 0x518, 0x189, 0x000, - 0x15B, 0x518, 0x18D, 0x000, 0x157, 0x517, 0x191, 0x000, - 0x153, 0x517, 0x195, 0x000, 0x150, 0x517, 0x19A, 0x000, - 0x14C, 0x516, 0x19E, 0x000, 0x148, 0x516, 0x1A2, 0x000, - 0x145, 0x515, 0x1A6, 0x000, 0x141, 0x514, 0x1AA, 0x000, - 0x13E, 0x514, 0x1AE, 0x000, 0x13A, 0x513, 0x1B2, 0x000, - 0x137, 0x512, 0x1B7, 0x001, 0x133, 0x511, 0x1BB, 0x001, - 0x130, 0x511, 0x1BF, 0x001, 0x12C, 0x510, 0x1C3, 0x001, - 0x129, 0x50F, 0x1C8, 0x001, 0x125, 0x50E, 0x1CC, 0x001, - 0x122, 0x50D, 0x1D0, 0x001, 0x11E, 0x50C, 0x1D5, 0x001, - 0x11B, 0x50B, 0x1D9, 0x001, 0x118, 0x50A, 0x1DD, 0x001, - 0x114, 0x508, 0x1E2, 0x001, 0x111, 0x507, 0x1E6, 0x002, - 0x10E, 0x506, 0x1EB, 0x002, 0x10B, 0x504, 0x1EF, 0x002, - 0x107, 0x503, 0x1F3, 0x002, 0x104, 0x502, 0x1F8, 0x002, - 0x101, 0x500, 0x1FC, 0x002, 0x0FE, 0x4FF, 0x201, 0x002, - 0x0FB, 0x4FD, 0x205, 0x003, 0x0F8, 0x4FB, 0x20A, 0x003, - 0x0F5, 0x4FA, 0x20F, 0x003, 0x0F2, 0x4F8, 0x213, 0x003, - 0x0EF, 0x4F6, 0x218, 0x003, 0x0EC, 0x4F5, 0x21C, 0x004, - 0x0E9, 0x4F3, 0x221, 0x004, 0x0E6, 0x4F1, 0x226, 0x004, - 0x0E3, 0x4EF, 0x22A, 0x004, 0x0E0, 0x4ED, 0x22F, 0x004, - 0x0DD, 0x4EB, 0x233, 0x005, 0x0DA, 0x4E9, 0x238, 0x005, - 0x0D7, 0x4E7, 0x23D, 0x005, 0x0D4, 0x4E5, 0x241, 0x005, - 0x0D2, 0x4E3, 0x246, 0x006, 0x0CF, 0x4E0, 0x24B, 0x006, - 0x0CC, 0x4DE, 0x250, 0x006, 0x0C9, 0x4DC, 0x254, 0x006, - 0x0C7, 0x4D9, 0x259, 0x007, 0x0C4, 0x4D7, 0x25E, 0x007, - 0x0C1, 0x4D5, 0x263, 0x007, 0x0BF, 0x4D2, 0x267, 0x008, - 0x0BC, 0x4D0, 0x26C, 0x008, 0x0BA, 0x4CD, 0x271, 0x008, - 0x0B7, 0x4CB, 0x276, 0x009, 0x0B4, 0x4C8, 0x27B, 0x009, - 0x0B2, 0x4C5, 0x280, 0x009, 0x0AF, 0x4C3, 0x284, 0x00A, - 0x0AD, 0x4C0, 0x289, 0x00A, 0x0AB, 0x4BD, 0x28E, 0x00A, - 0x0A8, 0x4BA, 0x293, 0x00B, 0x0A6, 0x4B7, 0x298, 0x00B, - 0x0A3, 0x4B5, 0x29D, 0x00B, 0x0A1, 0x4B2, 0x2A2, 0x00C, - 0x09F, 0x4AF, 0x2A6, 0x00C, 0x09C, 0x4AC, 0x2AB, 0x00D, - 0x09A, 0x4A9, 0x2B0, 0x00D, 0x098, 0x4A6, 0x2B5, 0x00E, - 0x096, 0x4A2, 0x2BA, 0x00E, 0x093, 0x49F, 0x2BF, 0x00F, - 0x091, 0x49C, 0x2C4, 0x00F, 0x08F, 0x499, 0x2C9, 0x00F, - 0x08D, 0x496, 0x2CE, 0x010, 0x08B, 0x492, 0x2D3, 0x010, - 0x089, 0x48F, 0x2D8, 0x011, 0x086, 0x48C, 0x2DC, 0x011, - 0x084, 0x488, 0x2E1, 0x012, 0x082, 0x485, 0x2E6, 0x013, - 0x080, 0x481, 0x2EB, 0x013, 0x07E, 0x47E, 0x2F0, 0x014, - 0x07C, 0x47A, 0x2F5, 0x014, 0x07A, 0x477, 0x2FA, 0x015, - 0x078, 0x473, 0x2FF, 0x015, 0x076, 0x470, 0x304, 0x016, - 0x075, 0x46C, 0x309, 0x017, 0x073, 0x468, 0x30E, 0x017, - 0x071, 0x465, 0x313, 0x018, 0x06F, 0x461, 0x318, 0x018, - 0x06D, 0x45D, 0x31D, 0x019, 0x06B, 0x459, 0x322, 0x01A, - 0x06A, 0x455, 0x326, 0x01B, 0x068, 0x452, 0x32B, 0x01B, - 0x066, 0x44E, 0x330, 0x01C, 0x064, 0x44A, 0x335, 0x01D, - 0x063, 0x446, 0x33A, 0x01D, 0x061, 0x442, 0x33F, 0x01E, - 0x05F, 0x43E, 0x344, 0x01F, 0x05E, 0x43A, 0x349, 0x020, - 0x05C, 0x436, 0x34E, 0x020, 0x05A, 0x432, 0x353, 0x021, - 0x059, 0x42E, 0x357, 0x022, 0x057, 0x42A, 0x35C, 0x023, - 0x056, 0x425, 0x361, 0x024, 0x054, 0x421, 0x366, 0x024, - 0x053, 0x41D, 0x36B, 0x025, 0x051, 0x419, 0x370, 0x026, - 0x050, 0x415, 0x374, 0x027, 0x04E, 0x410, 0x379, 0x028, - 0x04D, 0x40C, 0x37E, 0x029, 0x04C, 0x408, 0x383, 0x02A, - 0x04A, 0x403, 0x388, 0x02B, 0x049, 0x3FF, 0x38C, 0x02C, - 0x047, 0x3FB, 0x391, 0x02D, 0x046, 0x3F6, 0x396, 0x02E, - 0x045, 0x3F2, 0x39B, 0x02F, 0x043, 0x3ED, 0x39F, 0x030, - 0x042, 0x3E9, 0x3A4, 0x031, 0x041, 0x3E5, 0x3A9, 0x032, - 0x040, 0x3E0, 0x3AD, 0x033, 0x03E, 0x3DC, 0x3B2, 0x034, - 0x03D, 0x3D7, 0x3B7, 0x035, 0x03C, 0x3D2, 0x3BB, 0x036, - 0x03B, 0x3CE, 0x3C0, 0x037, 0x03A, 0x3C9, 0x3C5, 0x038, - 0x038, 0x3C5, 0x3C9, 0x03A, 0x037, 0x3C0, 0x3CE, 0x03B, - 0x036, 0x3BB, 0x3D2, 0x03C, 0x035, 0x3B7, 0x3D7, 0x03D, - 0x034, 0x3B2, 0x3DC, 0x03E, 0x033, 0x3AD, 0x3E0, 0x040, - 0x032, 0x3A9, 0x3E5, 0x041, 0x031, 0x3A4, 0x3E9, 0x042, - 0x030, 0x39F, 0x3ED, 0x043, 0x02F, 0x39B, 0x3F2, 0x045, - 0x02E, 0x396, 0x3F6, 0x046, 0x02D, 0x391, 0x3FB, 0x047, - 0x02C, 0x38C, 0x3FF, 0x049, 0x02B, 0x388, 0x403, 0x04A, - 0x02A, 0x383, 0x408, 0x04C, 0x029, 0x37E, 0x40C, 0x04D, - 0x028, 0x379, 0x410, 0x04E, 0x027, 0x374, 0x415, 0x050, - 0x026, 0x370, 0x419, 0x051, 0x025, 0x36B, 0x41D, 0x053, - 0x024, 0x366, 0x421, 0x054, 0x024, 0x361, 0x425, 0x056, - 0x023, 0x35C, 0x42A, 0x057, 0x022, 0x357, 0x42E, 0x059, - 0x021, 0x353, 0x432, 0x05A, 0x020, 0x34E, 0x436, 0x05C, - 0x020, 0x349, 0x43A, 0x05E, 0x01F, 0x344, 0x43E, 0x05F, - 0x01E, 0x33F, 0x442, 0x061, 0x01D, 0x33A, 0x446, 0x063, - 0x01D, 0x335, 0x44A, 0x064, 0x01C, 0x330, 0x44E, 0x066, - 0x01B, 0x32B, 0x452, 0x068, 0x01B, 0x326, 0x455, 0x06A, - 0x01A, 0x322, 0x459, 0x06B, 0x019, 0x31D, 0x45D, 0x06D, - 0x018, 0x318, 0x461, 0x06F, 0x018, 0x313, 0x465, 0x071, - 0x017, 0x30E, 0x468, 0x073, 0x017, 0x309, 0x46C, 0x075, - 0x016, 0x304, 0x470, 0x076, 0x015, 0x2FF, 0x473, 0x078, - 0x015, 0x2FA, 0x477, 0x07A, 0x014, 0x2F5, 0x47A, 0x07C, - 0x014, 0x2F0, 0x47E, 0x07E, 0x013, 0x2EB, 0x481, 0x080, - 0x013, 0x2E6, 0x485, 0x082, 0x012, 0x2E1, 0x488, 0x084, - 0x011, 0x2DC, 0x48C, 0x086, 0x011, 0x2D8, 0x48F, 0x089, - 0x010, 0x2D3, 0x492, 0x08B, 0x010, 0x2CE, 0x496, 0x08D, - 0x00F, 0x2C9, 0x499, 0x08F, 0x00F, 0x2C4, 0x49C, 0x091, - 0x00F, 0x2BF, 0x49F, 0x093, 0x00E, 0x2BA, 0x4A2, 0x096, - 0x00E, 0x2B5, 0x4A6, 0x098, 0x00D, 0x2B0, 0x4A9, 0x09A, - 0x00D, 0x2AB, 0x4AC, 0x09C, 0x00C, 0x2A6, 0x4AF, 0x09F, - 0x00C, 0x2A2, 0x4B2, 0x0A1, 0x00B, 0x29D, 0x4B5, 0x0A3, - 0x00B, 0x298, 0x4B7, 0x0A6, 0x00B, 0x293, 0x4BA, 0x0A8, - 0x00A, 0x28E, 0x4BD, 0x0AB, 0x00A, 0x289, 0x4C0, 0x0AD, - 0x00A, 0x284, 0x4C3, 0x0AF, 0x009, 0x280, 0x4C5, 0x0B2, - 0x009, 0x27B, 0x4C8, 0x0B4, 0x009, 0x276, 0x4CB, 0x0B7, - 0x008, 0x271, 0x4CD, 0x0BA, 0x008, 0x26C, 0x4D0, 0x0BC, - 0x008, 0x267, 0x4D2, 0x0BF, 0x007, 0x263, 0x4D5, 0x0C1, - 0x007, 0x25E, 0x4D7, 0x0C4, 0x007, 0x259, 0x4D9, 0x0C7, - 0x006, 0x254, 0x4DC, 0x0C9, 0x006, 0x250, 0x4DE, 0x0CC, - 0x006, 0x24B, 0x4E0, 0x0CF, 0x006, 0x246, 0x4E3, 0x0D2, - 0x005, 0x241, 0x4E5, 0x0D4, 0x005, 0x23D, 0x4E7, 0x0D7, - 0x005, 0x238, 0x4E9, 0x0DA, 0x005, 0x233, 0x4EB, 0x0DD, - 0x004, 0x22F, 0x4ED, 0x0E0, 0x004, 0x22A, 0x4EF, 0x0E3, - 0x004, 0x226, 0x4F1, 0x0E6, 0x004, 0x221, 0x4F3, 0x0E9, - 0x004, 0x21C, 0x4F5, 0x0EC, 0x003, 0x218, 0x4F6, 0x0EF, - 0x003, 0x213, 0x4F8, 0x0F2, 0x003, 0x20F, 0x4FA, 0x0F5, - 0x003, 0x20A, 0x4FB, 0x0F8, 0x003, 0x205, 0x4FD, 0x0FB, - 0x002, 0x201, 0x4FF, 0x0FE, 0x002, 0x1FC, 0x500, 0x101, - 0x002, 0x1F8, 0x502, 0x104, 0x002, 0x1F3, 0x503, 0x107, - 0x002, 0x1EF, 0x504, 0x10B, 0x002, 0x1EB, 0x506, 0x10E, - 0x002, 0x1E6, 0x507, 0x111, 0x001, 0x1E2, 0x508, 0x114, - 0x001, 0x1DD, 0x50A, 0x118, 0x001, 0x1D9, 0x50B, 0x11B, - 0x001, 0x1D5, 0x50C, 0x11E, 0x001, 0x1D0, 0x50D, 0x122, - 0x001, 0x1CC, 0x50E, 0x125, 0x001, 0x1C8, 0x50F, 0x129, - 0x001, 0x1C3, 0x510, 0x12C, 0x001, 0x1BF, 0x511, 0x130, - 0x001, 0x1BB, 0x511, 0x133, 0x001, 0x1B7, 0x512, 0x137, - 0x000, 0x1B2, 0x513, 0x13A, 0x000, 0x1AE, 0x514, 0x13E, - 0x000, 0x1AA, 0x514, 0x141, 0x000, 0x1A6, 0x515, 0x145, - 0x000, 0x1A2, 0x516, 0x148, 0x000, 0x19E, 0x516, 0x14C, - 0x000, 0x19A, 0x517, 0x150, 0x000, 0x195, 0x517, 0x153, - 0x000, 0x191, 0x517, 0x157, 0x000, 0x18D, 0x518, 0x15B, - 0x000, 0x189, 0x518, 0x15F, 0x000, 0x185, 0x518, 0x162, - 0x000, 0x181, 0x518, 0x166, 0x000, 0x17D, 0x518, 0x16A, + 0x172, 0x519, 0x176, 0x000, 0x16E, 0x519, 0x17A, 0x000, + 0x16A, 0x518, 0x17D, 0x000, 0x166, 0x518, 0x181, 0x000, + 0x162, 0x518, 0x185, 0x000, 0x15F, 0x518, 0x189, 0x000, + 0x15B, 0x518, 0x18D, 0x000, 0x157, 0x517, 0x191, 0x000, + 0x153, 0x517, 0x195, 0x000, 0x150, 0x517, 0x19A, 0x000, + 0x14C, 0x516, 0x19E, 0x000, 0x148, 0x516, 0x1A2, 0x000, + 0x145, 0x515, 0x1A6, 0x000, 0x141, 0x514, 0x1AA, 0x000, + 0x13E, 0x514, 0x1AE, 0x000, 0x13A, 0x513, 0x1B2, 0x000, + 0x137, 0x512, 0x1B7, 0x001, 0x133, 0x511, 0x1BB, 0x001, + 0x130, 0x511, 0x1BF, 0x001, 0x12C, 0x510, 0x1C3, 0x001, + 0x129, 0x50F, 0x1C8, 0x001, 0x125, 0x50E, 0x1CC, 0x001, + 0x122, 0x50D, 0x1D0, 0x001, 0x11E, 0x50C, 0x1D5, 0x001, + 0x11B, 0x50B, 0x1D9, 0x001, 0x118, 0x50A, 0x1DD, 0x001, + 0x114, 0x508, 0x1E2, 0x001, 0x111, 0x507, 0x1E6, 0x002, + 0x10E, 0x506, 0x1EB, 0x002, 0x10B, 0x504, 0x1EF, 0x002, + 0x107, 0x503, 0x1F3, 0x002, 0x104, 0x502, 0x1F8, 0x002, + 0x101, 0x500, 0x1FC, 0x002, 0x0FE, 0x4FF, 0x201, 0x002, + 0x0FB, 0x4FD, 0x205, 0x003, 0x0F8, 0x4FB, 0x20A, 0x003, + 0x0F5, 0x4FA, 0x20F, 0x003, 0x0F2, 0x4F8, 0x213, 0x003, + 0x0EF, 0x4F6, 0x218, 0x003, 0x0EC, 0x4F5, 0x21C, 0x004, + 0x0E9, 0x4F3, 0x221, 0x004, 0x0E6, 0x4F1, 0x226, 0x004, + 0x0E3, 0x4EF, 0x22A, 0x004, 0x0E0, 0x4ED, 0x22F, 0x004, + 0x0DD, 0x4EB, 0x233, 0x005, 0x0DA, 0x4E9, 0x238, 0x005, + 0x0D7, 0x4E7, 0x23D, 0x005, 0x0D4, 0x4E5, 0x241, 0x005, + 0x0D2, 0x4E3, 0x246, 0x006, 0x0CF, 0x4E0, 0x24B, 0x006, + 0x0CC, 0x4DE, 0x250, 0x006, 0x0C9, 0x4DC, 0x254, 0x006, + 0x0C7, 0x4D9, 0x259, 0x007, 0x0C4, 0x4D7, 0x25E, 0x007, + 0x0C1, 0x4D5, 0x263, 0x007, 0x0BF, 0x4D2, 0x267, 0x008, + 0x0BC, 0x4D0, 0x26C, 0x008, 0x0BA, 0x4CD, 0x271, 0x008, + 0x0B7, 0x4CB, 0x276, 0x009, 0x0B4, 0x4C8, 0x27B, 0x009, + 0x0B2, 0x4C5, 0x280, 0x009, 0x0AF, 0x4C3, 0x284, 0x00A, + 0x0AD, 0x4C0, 0x289, 0x00A, 0x0AB, 0x4BD, 0x28E, 0x00A, + 0x0A8, 0x4BA, 0x293, 0x00B, 0x0A6, 0x4B7, 0x298, 0x00B, + 0x0A3, 0x4B5, 0x29D, 0x00B, 0x0A1, 0x4B2, 0x2A2, 0x00C, + 0x09F, 0x4AF, 0x2A6, 0x00C, 0x09C, 0x4AC, 0x2AB, 0x00D, + 0x09A, 0x4A9, 0x2B0, 0x00D, 0x098, 0x4A6, 0x2B5, 0x00E, + 0x096, 0x4A2, 0x2BA, 0x00E, 0x093, 0x49F, 0x2BF, 0x00F, + 0x091, 0x49C, 0x2C4, 0x00F, 0x08F, 0x499, 0x2C9, 0x00F, + 0x08D, 0x496, 0x2CE, 0x010, 0x08B, 0x492, 0x2D3, 0x010, + 0x089, 0x48F, 0x2D8, 0x011, 0x086, 0x48C, 0x2DC, 0x011, + 0x084, 0x488, 0x2E1, 0x012, 0x082, 0x485, 0x2E6, 0x013, + 0x080, 0x481, 0x2EB, 0x013, 0x07E, 0x47E, 0x2F0, 0x014, + 0x07C, 0x47A, 0x2F5, 0x014, 0x07A, 0x477, 0x2FA, 0x015, + 0x078, 0x473, 0x2FF, 0x015, 0x076, 0x470, 0x304, 0x016, + 0x075, 0x46C, 0x309, 0x017, 0x073, 0x468, 0x30E, 0x017, + 0x071, 0x465, 0x313, 0x018, 0x06F, 0x461, 0x318, 0x018, + 0x06D, 0x45D, 0x31D, 0x019, 0x06B, 0x459, 0x322, 0x01A, + 0x06A, 0x455, 0x326, 0x01B, 0x068, 0x452, 0x32B, 0x01B, + 0x066, 0x44E, 0x330, 0x01C, 0x064, 0x44A, 0x335, 0x01D, + 0x063, 0x446, 0x33A, 0x01D, 0x061, 0x442, 0x33F, 0x01E, + 0x05F, 0x43E, 0x344, 0x01F, 0x05E, 0x43A, 0x349, 0x020, + 0x05C, 0x436, 0x34E, 0x020, 0x05A, 0x432, 0x353, 0x021, + 0x059, 0x42E, 0x357, 0x022, 0x057, 0x42A, 0x35C, 0x023, + 0x056, 0x425, 0x361, 0x024, 0x054, 0x421, 0x366, 0x024, + 0x053, 0x41D, 0x36B, 0x025, 0x051, 0x419, 0x370, 0x026, + 0x050, 0x415, 0x374, 0x027, 0x04E, 0x410, 0x379, 0x028, + 0x04D, 0x40C, 0x37E, 0x029, 0x04C, 0x408, 0x383, 0x02A, + 0x04A, 0x403, 0x388, 0x02B, 0x049, 0x3FF, 0x38C, 0x02C, + 0x047, 0x3FB, 0x391, 0x02D, 0x046, 0x3F6, 0x396, 0x02E, + 0x045, 0x3F2, 0x39B, 0x02F, 0x043, 0x3ED, 0x39F, 0x030, + 0x042, 0x3E9, 0x3A4, 0x031, 0x041, 0x3E5, 0x3A9, 0x032, + 0x040, 0x3E0, 0x3AD, 0x033, 0x03E, 0x3DC, 0x3B2, 0x034, + 0x03D, 0x3D7, 0x3B7, 0x035, 0x03C, 0x3D2, 0x3BB, 0x036, + 0x03B, 0x3CE, 0x3C0, 0x037, 0x03A, 0x3C9, 0x3C5, 0x038, + 0x038, 0x3C5, 0x3C9, 0x03A, 0x037, 0x3C0, 0x3CE, 0x03B, + 0x036, 0x3BB, 0x3D2, 0x03C, 0x035, 0x3B7, 0x3D7, 0x03D, + 0x034, 0x3B2, 0x3DC, 0x03E, 0x033, 0x3AD, 0x3E0, 0x040, + 0x032, 0x3A9, 0x3E5, 0x041, 0x031, 0x3A4, 0x3E9, 0x042, + 0x030, 0x39F, 0x3ED, 0x043, 0x02F, 0x39B, 0x3F2, 0x045, + 0x02E, 0x396, 0x3F6, 0x046, 0x02D, 0x391, 0x3FB, 0x047, + 0x02C, 0x38C, 0x3FF, 0x049, 0x02B, 0x388, 0x403, 0x04A, + 0x02A, 0x383, 0x408, 0x04C, 0x029, 0x37E, 0x40C, 0x04D, + 0x028, 0x379, 0x410, 0x04E, 0x027, 0x374, 0x415, 0x050, + 0x026, 0x370, 0x419, 0x051, 0x025, 0x36B, 0x41D, 0x053, + 0x024, 0x366, 0x421, 0x054, 0x024, 0x361, 0x425, 0x056, + 0x023, 0x35C, 0x42A, 0x057, 0x022, 0x357, 0x42E, 0x059, + 0x021, 0x353, 0x432, 0x05A, 0x020, 0x34E, 0x436, 0x05C, + 0x020, 0x349, 0x43A, 0x05E, 0x01F, 0x344, 0x43E, 0x05F, + 0x01E, 0x33F, 0x442, 0x061, 0x01D, 0x33A, 0x446, 0x063, + 0x01D, 0x335, 0x44A, 0x064, 0x01C, 0x330, 0x44E, 0x066, + 0x01B, 0x32B, 0x452, 0x068, 0x01B, 0x326, 0x455, 0x06A, + 0x01A, 0x322, 0x459, 0x06B, 0x019, 0x31D, 0x45D, 0x06D, + 0x018, 0x318, 0x461, 0x06F, 0x018, 0x313, 0x465, 0x071, + 0x017, 0x30E, 0x468, 0x073, 0x017, 0x309, 0x46C, 0x075, + 0x016, 0x304, 0x470, 0x076, 0x015, 0x2FF, 0x473, 0x078, + 0x015, 0x2FA, 0x477, 0x07A, 0x014, 0x2F5, 0x47A, 0x07C, + 0x014, 0x2F0, 0x47E, 0x07E, 0x013, 0x2EB, 0x481, 0x080, + 0x013, 0x2E6, 0x485, 0x082, 0x012, 0x2E1, 0x488, 0x084, + 0x011, 0x2DC, 0x48C, 0x086, 0x011, 0x2D8, 0x48F, 0x089, + 0x010, 0x2D3, 0x492, 0x08B, 0x010, 0x2CE, 0x496, 0x08D, + 0x00F, 0x2C9, 0x499, 0x08F, 0x00F, 0x2C4, 0x49C, 0x091, + 0x00F, 0x2BF, 0x49F, 0x093, 0x00E, 0x2BA, 0x4A2, 0x096, + 0x00E, 0x2B5, 0x4A6, 0x098, 0x00D, 0x2B0, 0x4A9, 0x09A, + 0x00D, 0x2AB, 0x4AC, 0x09C, 0x00C, 0x2A6, 0x4AF, 0x09F, + 0x00C, 0x2A2, 0x4B2, 0x0A1, 0x00B, 0x29D, 0x4B5, 0x0A3, + 0x00B, 0x298, 0x4B7, 0x0A6, 0x00B, 0x293, 0x4BA, 0x0A8, + 0x00A, 0x28E, 0x4BD, 0x0AB, 0x00A, 0x289, 0x4C0, 0x0AD, + 0x00A, 0x284, 0x4C3, 0x0AF, 0x009, 0x280, 0x4C5, 0x0B2, + 0x009, 0x27B, 0x4C8, 0x0B4, 0x009, 0x276, 0x4CB, 0x0B7, + 0x008, 0x271, 0x4CD, 0x0BA, 0x008, 0x26C, 0x4D0, 0x0BC, + 0x008, 0x267, 0x4D2, 0x0BF, 0x007, 0x263, 0x4D5, 0x0C1, + 0x007, 0x25E, 0x4D7, 0x0C4, 0x007, 0x259, 0x4D9, 0x0C7, + 0x006, 0x254, 0x4DC, 0x0C9, 0x006, 0x250, 0x4DE, 0x0CC, + 0x006, 0x24B, 0x4E0, 0x0CF, 0x006, 0x246, 0x4E3, 0x0D2, + 0x005, 0x241, 0x4E5, 0x0D4, 0x005, 0x23D, 0x4E7, 0x0D7, + 0x005, 0x238, 0x4E9, 0x0DA, 0x005, 0x233, 0x4EB, 0x0DD, + 0x004, 0x22F, 0x4ED, 0x0E0, 0x004, 0x22A, 0x4EF, 0x0E3, + 0x004, 0x226, 0x4F1, 0x0E6, 0x004, 0x221, 0x4F3, 0x0E9, + 0x004, 0x21C, 0x4F5, 0x0EC, 0x003, 0x218, 0x4F6, 0x0EF, + 0x003, 0x213, 0x4F8, 0x0F2, 0x003, 0x20F, 0x4FA, 0x0F5, + 0x003, 0x20A, 0x4FB, 0x0F8, 0x003, 0x205, 0x4FD, 0x0FB, + 0x002, 0x201, 0x4FF, 0x0FE, 0x002, 0x1FC, 0x500, 0x101, + 0x002, 0x1F8, 0x502, 0x104, 0x002, 0x1F3, 0x503, 0x107, + 0x002, 0x1EF, 0x504, 0x10B, 0x002, 0x1EB, 0x506, 0x10E, + 0x002, 0x1E6, 0x507, 0x111, 0x001, 0x1E2, 0x508, 0x114, + 0x001, 0x1DD, 0x50A, 0x118, 0x001, 0x1D9, 0x50B, 0x11B, + 0x001, 0x1D5, 0x50C, 0x11E, 0x001, 0x1D0, 0x50D, 0x122, + 0x001, 0x1CC, 0x50E, 0x125, 0x001, 0x1C8, 0x50F, 0x129, + 0x001, 0x1C3, 0x510, 0x12C, 0x001, 0x1BF, 0x511, 0x130, + 0x001, 0x1BB, 0x511, 0x133, 0x001, 0x1B7, 0x512, 0x137, + 0x000, 0x1B2, 0x513, 0x13A, 0x000, 0x1AE, 0x514, 0x13E, + 0x000, 0x1AA, 0x514, 0x141, 0x000, 0x1A6, 0x515, 0x145, + 0x000, 0x1A2, 0x516, 0x148, 0x000, 0x19E, 0x516, 0x14C, + 0x000, 0x19A, 0x517, 0x150, 0x000, 0x195, 0x517, 0x153, + 0x000, 0x191, 0x517, 0x157, 0x000, 0x18D, 0x518, 0x15B, + 0x000, 0x189, 0x518, 0x15F, 0x000, 0x185, 0x518, 0x162, + 0x000, 0x181, 0x518, 0x166, 0x000, 0x17D, 0x518, 0x16A, 0x000, 0x17A, 0x519, 0x16E, 0x000, 0x176, 0x519, 0x172}; #endif diff --git a/plugins/PeopsSPU2/oss.c b/plugins/PeopsSPU2/oss.c index 8f83363e29..e697bbcad4 100644 --- a/plugins/PeopsSPU2/oss.c +++ b/plugins/PeopsSPU2/oss.c @@ -101,7 +101,7 @@ void SetupSound(void) if(ioctl(oss_audio_fd,SNDCTL_DSP_SETFRAGMENT,&myfrag)==-1) { printf("Sound set fragment failed!\n"); - return; + return; } format = AFMT_S16_LE; diff --git a/plugins/PeopsSPU2/psemuxa.h b/plugins/PeopsSPU2/psemuxa.h index 11482750e1..0b4453f04e 100644 --- a/plugins/PeopsSPU2/psemuxa.h +++ b/plugins/PeopsSPU2/psemuxa.h @@ -12,7 +12,7 @@ typedef struct } ADPCM_Decode_t; typedef struct -{ +{ int freq; int nbits; int stereo; diff --git a/plugins/PeopsSPU2/record.c b/plugins/PeopsSPU2/record.c index b256224cb7..403d49b3ff 100644 --- a/plugins/PeopsSPU2/record.c +++ b/plugins/PeopsSPU2/record.c @@ -15,7 +15,7 @@ * additional informations. * * * ***************************************************************************/ - + //*************************************************************************// // History of changes: // @@ -70,7 +70,7 @@ void RecordStart() // create file hWaveFile=mmioOpen(szFileName,NULL,MMIO_CREATE|MMIO_WRITE|MMIO_EXCLUSIVE | MMIO_ALLOCBUF); if(!hWaveFile) return; - + // setup WAVE, fmt and data chunks memset(&mmckMain,0,sizeof(MMCKINFO)); mmckMain.fccType = mmioFOURCC('W','A','V','E'); @@ -82,7 +82,7 @@ void RecordStart() mmckData.cksize = sizeof(WAVEFORMATEX); mmioCreateChunk(hWaveFile,&mmckData,0); - mmioWrite(hWaveFile,(char*)&pcmwf,sizeof(WAVEFORMATEX)); + mmioWrite(hWaveFile,(char*)&pcmwf,sizeof(WAVEFORMATEX)); mmioAscend(hWaveFile,&mmckData,0); mmckData.ckid = mmioFOURCC('d','a','t','a'); @@ -172,7 +172,7 @@ BOOL CALLBACK RecordDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) //--------------------------------------------------// setcursor case WM_SETCURSOR: { - SetCursor(LoadCursor(NULL,IDC_ARROW)); // force the arrow + SetCursor(LoadCursor(NULL,IDC_ARROW)); // force the arrow return TRUE; } //--------------------------------------------------// diff --git a/plugins/PeopsSPU2/registers.c b/plugins/PeopsSPU2/registers.c index 5f86a73475..a28f022683 100644 --- a/plugins/PeopsSPU2/registers.c +++ b/plugins/PeopsSPU2/registers.c @@ -95,32 +95,32 @@ EXPORT_GCC void CALLBACK SPU2write(unsigned long reg, unsigned short val) { int rx=0; int ch=0; - if(r>=0x400) { + if(r>=0x400) { rx= r - 0x400; ch=(rx>>4)+24; } else { rx= r; ch=(rx>>4); } - + switch(rx&0x0f) { //------------------------------------------------// r volume - case 0: + case 0: SetVolumeL((unsigned char)ch,val); #ifdef _WINDOWS if(iDebugMode==1) logprintf("W_REG Volume Left - Channel %d Core %d Addr %X Val %X\r\n", (ch > 23? (ch - 24) : ch), ch/24, reg&0xFFFF, val); #endif break; //------------------------------------------------// l volume - case 2: + case 2: SetVolumeR((unsigned char)ch,val); #ifdef _WINDOWS if(iDebugMode==1) logprintf("W_REG Volume Right - Channel %d Core %d Addr %X Val %X\r\n", (ch > 23? (ch - 24) : ch), ch/24, reg&0xFFFF, val); #endif break; //------------------------------------------------// pitch - case 4: + case 4: SetPitch(ch,val); #ifdef _WINDOWS if(iDebugMode==1) logprintf("W_REG Pitch - Channel %d Core %d Addr %X Val %X\r\n", (ch > 23? (ch - 24) : ch), ch/24, reg&0xFFFF, val); @@ -131,7 +131,7 @@ EXPORT_GCC void CALLBACK SPU2write(unsigned long reg, unsigned short val) { const unsigned long lval=val;unsigned long lx; //---------------------------------------------// - s_chan[ch].ADSRX.AttackModeExp=(lval&0x8000)?1:0; + s_chan[ch].ADSRX.AttackModeExp=(lval&0x8000)?1:0; s_chan[ch].ADSRX.AttackRate=(lval>>8) & 0x007f; s_chan[ch].ADSRX.DecayRate=(lval>>4) & 0x000f; s_chan[ch].ADSRX.SustainLevel=lval & 0x000f; @@ -143,14 +143,14 @@ EXPORT_GCC void CALLBACK SPU2write(unsigned long reg, unsigned short val) lx=(((lval>>8) & 0x007f)>>2); // attack time to run from 0 to 100% volume lx=min(31,lx); // no overflow on shift! - if(lx) - { + if(lx) + { lx = (1<>6) & 0x007f)>>2)); // sustain time... often very high lx=min(31,lx); // values are used to hold the volume if(lx) // until a sound stop occurs - { // the highest value we reach (due to - lx = (1<=0x400) {ch+=24;rx-=0x400;} @@ -291,7 +291,7 @@ EXPORT_GCC void CALLBACK SPU2write(unsigned long reg, unsigned short val) } return; - } + } switch(r) { @@ -342,7 +342,7 @@ EXPORT_GCC void CALLBACK SPU2write(unsigned long reg, unsigned short val) //-------------------------------------------------// case PS2_C1_SPUdata: spuMem[spuAddr2[1]] = val; - + if(spuCtrl2[1]&0x40 && spuIrq2[1] == spuAddr2[1]){ regArea[0x7C0] |= 0x8; regArea[PS2_IRQINFO] |= 8; @@ -483,7 +483,7 @@ EXPORT_GCC void CALLBACK SPU2write(unsigned long reg, unsigned short val) #endif break; //-------------------------------------------------// - case PS2_IRQINFO: + case PS2_IRQINFO: // regArea[PS2_IRQINFO] = 0; // clear #ifdef _WINDOWS if(iDebugMode==1) logprintf("W_REG IRQINFO - Addr %X Val %X - Not Implemented!\r\n", reg&0xFFFF, val); @@ -1226,19 +1226,19 @@ if(spuCtrl2[1]&0x40 && spuIrq2[1] == r){ if(iDebugMode==1) logprintf("R_REG Envelope - Channel %d Core %d Addr %X Val %X\r\n", (ch > 23? (ch - 24) : ch), ch/24, reg&0xFFFF, ret); #endif break; - + } }else if((r>=0x01c0 && r<0x02E0)||(r>=0x05c0 && r<0x06E0)) // some channel info? { int ch=0;unsigned long rx=r; - + ch=((rx & 0x3ff)-0x1c0) / 0xC; - + rx-=ch*0xC; if(rx>=0x400) {ch+=24;rx-=0x400;} - + switch(rx) { case 0x1C0: @@ -1349,7 +1349,7 @@ if(spuCtrl2[1]&0x40 && spuIrq2[1] == r){ case PS2_C0_SPUdata: { unsigned short s=spuMem[spuAddr2[0]]; - + if(spuCtrl2[0]&0x40 && spuIrq2[0] == spuAddr2[0]){ regArea[0x7C0] |= 0x4; regArea[PS2_IRQINFO] |= 4; @@ -1369,7 +1369,7 @@ if(spuCtrl2[1]&0x40 && spuIrq2[1] == r){ case PS2_C1_SPUdata: { unsigned short s=spuMem[spuAddr2[1]]; - + if(spuCtrl2[1]&0x40 && spuIrq2[1] == spuAddr2[1]){ regArea[0x7C0] |= 0x8; regArea[PS2_IRQINFO] |= 8; @@ -1833,10 +1833,10 @@ if(spuCtrl2[1]&0x40 && spuIrq2[1] == r){ #endif*/ } - + return ret; } - + //////////////////////////////////////////////////////////////////////// // SOUND ON register write //////////////////////////////////////////////////////////////////////// @@ -1898,7 +1898,7 @@ void SoundOff(int start,int end,unsigned short val) // SOUND OFF PSX COMMAND } } s_chan[ch].bStop=1; - } + } } } @@ -1914,7 +1914,7 @@ void FModOn(int start,int end,unsigned short val) // FMOD ON PSX COMMAND { if(val&1) // -> fmod on/off { - if(ch>0) + if(ch>0) { s_chan[ch].bFMod=1; // --> sound channel s_chan[ch-1].bFMod=2; // --> freq channel @@ -1941,7 +1941,7 @@ void NoiseOn(int start,int end,unsigned short val) // NOISE ON PSX COMMAND { s_chan[ch].bNoise=1; } - else + else { s_chan[ch].bNoise=0; } @@ -1992,11 +1992,11 @@ void SetVolumeR(unsigned char ch,short vol) // RIGHT VOLUME short sInc=1; if(vol&0x2000) sInc=-1; if(vol&0x1000) vol^=0xffff; - vol=((vol&0x7f)+1)/2; + vol=((vol&0x7f)+1)/2; vol+=vol/(2*sInc); vol*=128; } - else + else { if(vol&0x4000) //vol=vol^=0xffff; vol=0x3fff-(vol&0x3fff); @@ -2039,7 +2039,7 @@ void ReverbOn(int start,int end,unsigned short val,int iRight) // REVERB ON PSX if(iRight) s_chan[ch].bReverbR=1; else s_chan[ch].bReverbL=1; } - else + else { if(iRight) s_chan[ch].bReverbR=0; else s_chan[ch].bReverbL=0; @@ -2054,7 +2054,7 @@ void ReverbOn(int start,int end,unsigned short val,int iRight) // REVERB ON PSX void SetReverbAddr(int core) { long val=spuRvbAddr2[core]; - + if(rvb[core].StartAddr!=val) { if(val<=0x27ff) @@ -2065,7 +2065,7 @@ void SetReverbAddr(int core) { rvb[core].StartAddr=val; rvb[core].CurrAddr=rvb[core].StartAddr; - } + } } } @@ -2084,7 +2084,7 @@ void VolumeOn(int start,int end,unsigned short val,int iRight) // VOLUME ON PSX if(iRight) s_chan[ch].bVolumeR=1; else s_chan[ch].bVolumeL=1; } - else + else { if(iRight) s_chan[ch].bVolumeR=0; else s_chan[ch].bVolumeL=0; diff --git a/plugins/PeopsSPU2/registers.h b/plugins/PeopsSPU2/registers.h index 9eaaaf2731..31edb01ded 100644 --- a/plugins/PeopsSPU2/registers.h +++ b/plugins/PeopsSPU2/registers.h @@ -121,9 +121,9 @@ // CORE 1 only -#define PS2_SPDIF_OUT 0x7C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass -#define PS2_SPDIF_MODE 0x7C6 -#define PS2_SPDIF_MEDIA 0x7C8 // SPDIF Media: 'CD'/DVD +#define PS2_SPDIF_OUT 0x7C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass +#define PS2_SPDIF_MODE 0x7C6 +#define PS2_SPDIF_MEDIA 0x7C8 // SPDIF Media: 'CD'/DVD #define PS2_SPDIF_COPY 0x7CA // SPDIF Copy Protection //########################################################################### @@ -150,7 +150,7 @@ SD_S_PMON - Pitch mod; assuming identical to PS1 SD_S_NON - Noise; assuming identical to PS1 - SD_S_VMIXL, SD_S_VMIXR - Voice mix L/R. Guessing this is just a separate L/R version + SD_S_VMIXL, SD_S_VMIXR - Voice mix L/R. Guessing this is just a separate L/R version of the "voice enable" bits on the PS1. SD_S_VMIXEL, SD_S_VMIXER - Voice effect mix L/R. Guessing this is just a separate L/R version of the "voice reverb enable" bits on the PS1. @@ -220,7 +220,7 @@ Other PS2 IOP notes SPU CORE1's DMA channel is 7 DMA channel 10 is SIF - + Original INTR controller at 1F801000-1F80107F All interrupt handling seems to be done using the old INTR, but @@ -343,7 +343,7 @@ Reading probably clears these bits. 1D000030 (word) - read counter of some sort? 1D000040 (word) - read bits 0x20, 0x40 mean something 1D000060 (word) - used to detect whether the SIF interface exists - read must be 0x1D000060, or the top 20 bits must be zero + read must be 0x1D000060, or the top 20 bits must be zero */ /* @@ -387,7 +387,7 @@ Included these just in case you need them J.F. - Kanodin #define IOP_INT_USB (1<<22) #define IOP_INT_EXTR (1<<23) #define IOP_INT_FWRE (1<<24) - #define IOP_INT_FDMA (1<<25) + #define IOP_INT_FDMA (1<<25) // CORE0 => +0x000, CORE1 => +0x400 @@ -416,7 +416,7 @@ Included these just in case you need them J.F. - Kanodin #define S_VMIXER(cr) (0x400 * cr + 0x194) // voice output mixing (wet right) #define P_MMIX(cr) (0x400 * cr + 0x198) // output type after voice mixing (See paragraph below) #define P_ATTR(cr) (0x400 * cr + 0x19A) // core attributes (See paragraph below) -#define A_IRQA(cr) (0x400 * cr + 0x19C) // IRQ address +#define A_IRQA(cr) (0x400 * cr + 0x19C) // IRQ address #define S_KON(cr) (0x400 * cr + 0x1A0) // key on (start voice sound generation) #define S_KOFF(cr) (0x400 * cr + 0x1A4) // key off (end voice sound generation) #define A_TSA(cr) (0x400 * cr + 0x1A8) // DMA transfer start address @@ -426,30 +426,30 @@ Included these just in case you need them J.F. - Kanodin #define A_ESA(cr) (0x400 * cr + 0x2E0) // effects work area start address -#define FB_SRC_A(cr) (0x400 * cr + 0x2E4) -#define FB_SRC_B(cr) (0x400 * cr + 0x2E8) -#define IIR_DEST_A0(cr) (0x400 * cr + 0x2EC) -#define IIR_DEST_A1(cr) (0x400 * cr + 0x2F0) -#define ACC_SRC_A0(cr) (0x400 * cr + 0x2F4) +#define FB_SRC_A(cr) (0x400 * cr + 0x2E4) +#define FB_SRC_B(cr) (0x400 * cr + 0x2E8) +#define IIR_DEST_A0(cr) (0x400 * cr + 0x2EC) +#define IIR_DEST_A1(cr) (0x400 * cr + 0x2F0) +#define ACC_SRC_A0(cr) (0x400 * cr + 0x2F4) #define ACC_SRC_A1(cr) (0x400 * cr + 0x2F8) -#define ACC_SRC_B0(cr) (0x400 * cr + 0x2FC) +#define ACC_SRC_B0(cr) (0x400 * cr + 0x2FC) -#define ACC_SRC_B1(cr) (0x400 * cr + 0x300) -#define IIR_SRC_A0(cr) (0x400 * cr + 0x304) -#define IIR_SRC_A1(cr) (0x400 * cr + 0x308) -#define IIR_DEST_B0(cr) (0x400 * cr + 0x30C) -#define IIR_DEST_B1(cr) (0x400 * cr + 0x310) -#define ACC_SRC_C0(cr) (0x400 * cr + 0x314) -#define ACC_SRC_C1(cr) (0x400 * cr + 0x318) +#define ACC_SRC_B1(cr) (0x400 * cr + 0x300) +#define IIR_SRC_A0(cr) (0x400 * cr + 0x304) +#define IIR_SRC_A1(cr) (0x400 * cr + 0x308) +#define IIR_DEST_B0(cr) (0x400 * cr + 0x30C) +#define IIR_DEST_B1(cr) (0x400 * cr + 0x310) +#define ACC_SRC_C0(cr) (0x400 * cr + 0x314) +#define ACC_SRC_C1(cr) (0x400 * cr + 0x318) -#define ACC_SRC_D0(cr) (0x400 * cr + 0x31C) -#define ACC_SRC_D1(cr) (0x400 * cr + 0x320) -#define IIR_SRC_B1(cr) (0x400 * cr + 0x324) -#define IIR_SRC_B0(cr) (0x400 * cr + 0x328) -#define MIX_DEST_A0(cr) (0x400 * cr + 0x32C) -#define MIX_DEST_A1(cr) (0x400 * cr + 0x330) -#define MIX_DEST_B0(cr) (0x400 * cr + 0x334) -#define MIX_DEST_B1(cr) (0x400 * cr + 0x338) +#define ACC_SRC_D0(cr) (0x400 * cr + 0x31C) +#define ACC_SRC_D1(cr) (0x400 * cr + 0x320) +#define IIR_SRC_B1(cr) (0x400 * cr + 0x324) +#define IIR_SRC_B0(cr) (0x400 * cr + 0x328) +#define MIX_DEST_A0(cr) (0x400 * cr + 0x32C) +#define MIX_DEST_A1(cr) (0x400 * cr + 0x330) +#define MIX_DEST_B0(cr) (0x400 * cr + 0x334) +#define MIX_DEST_B1(cr) (0x400 * cr + 0x338) #define A_EEA(cr) (0x400 * cr + 0x33C) // effects work area end address @@ -470,22 +470,22 @@ Included these just in case you need them J.F. - Kanodin #define P_MVOLXL(cr) (0x28 * cr + 0x770) // current master volume (left) #define P_MVOLXR(cr) (0x28 * cr + 0x772) // current master volume (right) -#define IIR_ALPHA(cr) (0x28 * cr + 0x774) -#define ACC_COEF_A(cr) (0x28 * cr + 0x776) -#define ACC_COEF_B(cr) (0x28 * cr + 0x778) -#define ACC_COEF_C(cr) (0x28 * cr + 0x77A) -#define ACC_COEF_D(cr) (0x28 * cr + 0x77C) -#define IIR_COEF(cr) (0x28 * cr + 0x77E) -#define FB_ALPHA(cr) (0x28 * cr + 0x780) -#define FB_X(cr) (0x28 * cr + 0x782) -#define IN_COEF_L(cr) (0x28 * cr + 0x784) -#define IN_COEF_R(cr) (0x28 * cr + 0x786) +#define IIR_ALPHA(cr) (0x28 * cr + 0x774) +#define ACC_COEF_A(cr) (0x28 * cr + 0x776) +#define ACC_COEF_B(cr) (0x28 * cr + 0x778) +#define ACC_COEF_C(cr) (0x28 * cr + 0x77A) +#define ACC_COEF_D(cr) (0x28 * cr + 0x77C) +#define IIR_COEF(cr) (0x28 * cr + 0x77E) +#define FB_ALPHA(cr) (0x28 * cr + 0x780) +#define FB_X(cr) (0x28 * cr + 0x782) +#define IN_COEF_L(cr) (0x28 * cr + 0x784) +#define IN_COEF_R(cr) (0x28 * cr + 0x786) // CORE1 only => +0x400 -#define SPDIF_OUT 0x7C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass +#define SPDIF_OUT 0x7C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass #define SPDIF_MODE 0x7C6 -#define SPDIF_MEDIA 0x7C8 // SPDIF Media: 'CD'/DVD +#define SPDIF_MEDIA 0x7C8 // SPDIF Media: 'CD'/DVD #define SPDIF_COPY 0x7CA // SPDIF Copy Protection // PS1 SPU CORE @@ -504,17 +504,17 @@ Included these just in case you need them J.F. - Kanodin #define SPU_P_RVOLL 0xD84 // effect return volume (left) #define SPU_P_RVOLR 0xD86 // effect return volume (right) #define SPU_S_KON1 0xD88 // key on -#define SPU_S_KON2 0xD8A // +#define SPU_S_KON2 0xD8A // #define SPU_S_KOFF1 0xD8C // key off -#define SPU_S_KOFF2 0xD8E // +#define SPU_S_KOFF2 0xD8E // #define SPU_S_PMON1 0xD90 // pitch modulation on -#define SPU_S_PMON2 0xD92 // +#define SPU_S_PMON2 0xD92 // #define SPU_S_NON1 0xD94 // noise generator on -#define SPU_S_NON2 0xD96 // +#define SPU_S_NON2 0xD96 // #define SPU_S_RVBON1 0xD98 // effects on -#define SPU_S_RVBON2 0xD9A // +#define SPU_S_RVBON2 0xD9A // #define SPU_S_MUTE1 0xD9C // voice mute -#define SPU_S_MUTE2 0xD9E // +#define SPU_S_MUTE2 0xD9E // #define SPU_A_ESA 0xDA2 // effects work area start #define SPU_A_IRQA 0xDA4 // IRQ address @@ -560,7 +560,7 @@ Included these just in case you need them J.F. - Kanodin #define S_VMIXER(cr) (0x400 * cr + 0x194) // voice output mixing (wet right) #define P_MMIX(cr) (0x400 * cr + 0x198) // output type after voice mixing (See paragraph below) #define P_ATTR(cr) (0x400 * cr + 0x19A) // core attributes (See paragraph below) -#define A_IRQA(cr) (0x400 * cr + 0x19C) // IRQ address +#define A_IRQA(cr) (0x400 * cr + 0x19C) // IRQ address #define S_KON(cr) (0x400 * cr + 0x1A0) // key on (start voice sound generation) #define S_KOFF(cr) (0x400 * cr + 0x1A4) // key off (end voice sound generation) #define A_TSA(cr) (0x400 * cr + 0x1A8) // DMA transfer start address @@ -574,30 +574,30 @@ Included these just in case you need them J.F. - Kanodin // Core 0 Reverb Addresses -#define FB_SRC_A(cr) (0x400 * cr + 0x2E4) -#define FB_SRC_B(cr) (0x400 * cr + 0x2E8) -#define IIR_DEST_A0(cr) (0x400 * cr + 0x2EC) -#define IIR_DEST_A1(cr) (0x400 * cr + 0x2F0) -#define ACC_SRC_A0(cr) (0x400 * cr + 0x2F4) +#define FB_SRC_A(cr) (0x400 * cr + 0x2E4) +#define FB_SRC_B(cr) (0x400 * cr + 0x2E8) +#define IIR_DEST_A0(cr) (0x400 * cr + 0x2EC) +#define IIR_DEST_A1(cr) (0x400 * cr + 0x2F0) +#define ACC_SRC_A0(cr) (0x400 * cr + 0x2F4) #define ACC_SRC_A1(cr) (0x400 * cr + 0x2F8) -#define ACC_SRC_B0(cr) (0x400 * cr + 0x2FC) +#define ACC_SRC_B0(cr) (0x400 * cr + 0x2FC) -#define ACC_SRC_B1(cr) (0x400 * cr + 0x300) -#define IIR_SRC_A0(cr) (0x400 * cr + 0x304) -#define IIR_SRC_A1(cr) (0x400 * cr + 0x308) -#define IIR_DEST_B0(cr) (0x400 * cr + 0x30C) -#define IIR_DEST_B1(cr) (0x400 * cr + 0x310) -#define ACC_SRC_C0(cr) (0x400 * cr + 0x314) -#define ACC_SRC_C1(cr) (0x400 * cr + 0x318) +#define ACC_SRC_B1(cr) (0x400 * cr + 0x300) +#define IIR_SRC_A0(cr) (0x400 * cr + 0x304) +#define IIR_SRC_A1(cr) (0x400 * cr + 0x308) +#define IIR_DEST_B0(cr) (0x400 * cr + 0x30C) +#define IIR_DEST_B1(cr) (0x400 * cr + 0x310) +#define ACC_SRC_C0(cr) (0x400 * cr + 0x314) +#define ACC_SRC_C1(cr) (0x400 * cr + 0x318) -#define ACC_SRC_D0(cr) (0x400 * cr + 0x31C) -#define ACC_SRC_D1(cr) (0x400 * cr + 0x320) -#define IIR_SRC_B1(cr) (0x400 * cr + 0x324) -#define IIR_SRC_B0(cr) (0x400 * cr + 0x328) -#define MIX_DEST_A0(cr) (0x400 * cr + 0x32C) -#define MIX_DEST_A1(cr) (0x400 * cr + 0x330) -#define MIX_DEST_B0(cr) (0x400 * cr + 0x334) -#define MIX_DEST_B1(cr) (0x400 * cr + 0x338) +#define ACC_SRC_D0(cr) (0x400 * cr + 0x31C) +#define ACC_SRC_D1(cr) (0x400 * cr + 0x320) +#define IIR_SRC_B1(cr) (0x400 * cr + 0x324) +#define IIR_SRC_B0(cr) (0x400 * cr + 0x328) +#define MIX_DEST_A0(cr) (0x400 * cr + 0x32C) +#define MIX_DEST_A1(cr) (0x400 * cr + 0x330) +#define MIX_DEST_B0(cr) (0x400 * cr + 0x334) +#define MIX_DEST_B1(cr) (0x400 * cr + 0x338) #define A_EEA(cr) (0x400 * cr + 0x33C) // effects work area end address @@ -624,23 +624,23 @@ Included these just in case you need them J.F. - Kanodin // More CORE 0 Reverb -#define IIR_ALPHA(cr) (0x28 * cr + 0x774) -#define ACC_COEF_A(cr) (0x28 * cr + 0x776) -#define ACC_COEF_B(cr) (0x28 * cr + 0x778) -#define ACC_COEF_C(cr) (0x28 * cr + 0x77A) -#define ACC_COEF_D(cr) (0x28 * cr + 0x77C) -#define IIR_COEF(cr) (0x28 * cr + 0x77E) -#define FB_ALPHA(cr) (0x28 * cr + 0x780) -#define FB_X(cr) (0x28 * cr + 0x782) -#define IN_COEF_L(cr) (0x28 * cr + 0x784) -#define IN_COEF_R(cr) (0x28 * cr + 0x786) +#define IIR_ALPHA(cr) (0x28 * cr + 0x774) +#define ACC_COEF_A(cr) (0x28 * cr + 0x776) +#define ACC_COEF_B(cr) (0x28 * cr + 0x778) +#define ACC_COEF_C(cr) (0x28 * cr + 0x77A) +#define ACC_COEF_D(cr) (0x28 * cr + 0x77C) +#define IIR_COEF(cr) (0x28 * cr + 0x77E) +#define FB_ALPHA(cr) (0x28 * cr + 0x780) +#define FB_X(cr) (0x28 * cr + 0x782) +#define IN_COEF_L(cr) (0x28 * cr + 0x784) +#define IN_COEF_R(cr) (0x28 * cr + 0x786) // CORE 1 only -#define SPDIF_OUT 0x7C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass -#define SPDIF_MODE 0x7C6 -#define SPDIF_MEDIA 0x7C8 // SPDIF Media: 'CD'/DVD +#define SPDIF_OUT 0x7C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass +#define SPDIF_MODE 0x7C6 +#define SPDIF_MEDIA 0x7C8 // SPDIF Media: 'CD'/DVD #define SPDIF_COPY 0x7CA // SPDIF Copy Protection */ @@ -663,17 +663,17 @@ Included these just in case you need them J.F. - Kanodin #define SPU_P_RVOLL 0xD84 // effect return volume (left) #define SPU_P_RVOLR 0xD86 // effect return volume (right) #define SPU_S_KON1 0xD88 // key on -#define SPU_S_KON2 0xD8A // +#define SPU_S_KON2 0xD8A // #define SPU_S_KOFF1 0xD8C // key off -#define SPU_S_KOFF2 0xD8E // +#define SPU_S_KOFF2 0xD8E // #define SPU_S_PMON1 0xD90 // pitch modulation on -#define SPU_S_PMON2 0xD92 // +#define SPU_S_PMON2 0xD92 // #define SPU_S_NON1 0xD94 // noise generator on -#define SPU_S_NON2 0xD96 // +#define SPU_S_NON2 0xD96 // #define SPU_S_RVBON1 0xD98 // effects on -#define SPU_S_RVBON2 0xD9A // +#define SPU_S_RVBON2 0xD9A // #define SPU_S_MUTE1 0xD9C // voice mute -#define SPU_S_MUTE2 0xD9E // +#define SPU_S_MUTE2 0xD9E // #define SPU_A_ESA 0xDA2 // effects work area start #define SPU_A_IRQA 0xDA4 // IRQ address diff --git a/plugins/PeopsSPU2/resource.h b/plugins/PeopsSPU2/resource.h index 2b1c7708db..0ae055e8b5 100644 --- a/plugins/PeopsSPU2/resource.h +++ b/plugins/PeopsSPU2/resource.h @@ -150,7 +150,7 @@ #define IDC_SPU2IRQ 1148 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 142 diff --git a/plugins/PeopsSPU2/reverb.c b/plugins/PeopsSPU2/reverb.c index 3dcdb2b366..c21b71b1da 100644 --- a/plugins/PeopsSPU2/reverb.c +++ b/plugins/PeopsSPU2/reverb.c @@ -60,7 +60,7 @@ int * sRVBStart[2]; INLINE void StartREVERB(int ch) { int core=ch/24; - + if((s_chan[ch].bReverbL || s_chan[ch].bReverbR) && (spuCtrl2[core]&0x80)) // reverb possible? { if(iUseReverb==1) s_chan[ch].bRVBActive=1; @@ -88,7 +88,7 @@ INLINE void InitREVERB(void) INLINE void StoreREVERB(int ch,int ns) { int core=ch/24; - + if(iUseReverb==0) return; else if(iUseReverb==1) // -------------------------------- // Neil's reverb @@ -144,14 +144,14 @@ INLINE int MixREVERBLeft(int ns,int core) { if(iUseReverb==1) { - if(!rvb[core].StartAddr || !rvb[core].EndAddr || + if(!rvb[core].StartAddr || !rvb[core].EndAddr || rvb[core].StartAddr>=rvb[core].EndAddr) // reverb is off { rvb[core].iLastRVBLeft=rvb[core].iLastRVBRight=rvb[core].iRVBLeft=rvb[core].iRVBRight=0; return 0; } - rvb[core].iCnt++; + rvb[core].iCnt++; if(rvb[core].iCnt&1) // we work on every second left value: downsample to 22 khz { @@ -159,8 +159,8 @@ INLINE int MixREVERBLeft(int ns,int core) { int ACC0,ACC1,FB_A0,FB_A1,FB_B0,FB_B1; - const int INPUT_SAMPLE_L=*(sRVBStart[core]+(ns<<1)); - const int INPUT_SAMPLE_R=*(sRVBStart[core]+(ns<<1)+1); + const int INPUT_SAMPLE_L=*(sRVBStart[core]+(ns<<1)); + const int INPUT_SAMPLE_R=*(sRVBStart[core]+(ns<<1)+1); const int IIR_INPUT_A0 = (g_buffer(rvb[core].IIR_SRC_A0,core) * rvb[core].IIR_COEF)/33768L + (INPUT_SAMPLE_L * rvb[core].IN_COEF_L)/33768L; const int IIR_INPUT_A1 = (g_buffer(rvb[core].IIR_SRC_A1,core) * rvb[core].IIR_COEF)/33768L + (INPUT_SAMPLE_R * rvb[core].IN_COEF_R)/33768L; @@ -176,7 +176,7 @@ INLINE int MixREVERBLeft(int ns,int core) s_buffer1(rvb[core].IIR_DEST_A1, IIR_A1,core); s_buffer1(rvb[core].IIR_DEST_B0, IIR_B0,core); s_buffer1(rvb[core].IIR_DEST_B1, IIR_B1,core); - + ACC0 = (g_buffer(rvb[core].ACC_SRC_A0,core) * rvb[core].ACC_COEF_A)/33768L + (g_buffer(rvb[core].ACC_SRC_B0,core) * rvb[core].ACC_COEF_B)/33768L + (g_buffer(rvb[core].ACC_SRC_C0,core) * rvb[core].ACC_COEF_C)/33768L + @@ -193,10 +193,10 @@ INLINE int MixREVERBLeft(int ns,int core) s_buffer(rvb[core].MIX_DEST_A0, ACC0 - (FB_A0 * rvb[core].FB_ALPHA)/33768L,core); s_buffer(rvb[core].MIX_DEST_A1, ACC1 - (FB_A1 * rvb[core].FB_ALPHA)/33768L,core); - + s_buffer(rvb[core].MIX_DEST_B0, (rvb[core].FB_ALPHA * ACC0)/33768L - (FB_A0 * (int)(rvb[core].FB_ALPHA^0xFFFF8000))/33768L - (FB_B0 * rvb[core].FB_X)/33768L,core); s_buffer(rvb[core].MIX_DEST_B1, (rvb[core].FB_ALPHA * ACC1)/33768L - (FB_A1 * (int)(rvb[core].FB_ALPHA^0xFFFF8000))/33768L - (FB_B1 * rvb[core].FB_X)/33768L,core); - + rvb[core].iLastRVBLeft = rvb[core].iRVBLeft; rvb[core].iLastRVBRight = rvb[core].iRVBRight; diff --git a/plugins/PeopsSPU2/spu.c b/plugins/PeopsSPU2/spu.c index 1ee63593de..a6be3fc9a4 100644 --- a/plugins/PeopsSPU2/spu.c +++ b/plugins/PeopsSPU2/spu.c @@ -5,7 +5,7 @@ copyright : (C) 2002 by Pete Bernert email : BlackDove@addcom.de ***************************************************************************/ - + /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * @@ -15,7 +15,7 @@ * additional informations. * * * ***************************************************************************/ - + //*************************************************************************// // History of changes: // @@ -109,7 +109,7 @@ #include "dma.h" #include "registers.h" -#if !defined(_WIN32) +#if !defined(_WIN32) #include @@ -124,9 +124,9 @@ // spu version infos/name //////////////////////////////////////////////////////////////////////// -const unsigned char version = 5; -const unsigned char revision = 1; -const unsigned char build = 9; +const unsigned char version = 5; +const unsigned char revision = 1; +const unsigned char build = 9; #ifdef _DEBUG static char * libraryName = "P.E.Op.S. SPU2 (Debug) "; #else @@ -140,21 +140,21 @@ static char * libraryInfo = "P.E.Op.S. SPU2 Driver V1.6\nCoded by Pete Berne // psx buffer / addresses -unsigned short regArea[32*1024]; +unsigned short regArea[32*1024]; short spuMem[2*1024*1024]; char * spuMemC; unsigned char * pSpuIrq[2]; unsigned char * pSpuBuffer; unsigned char * pSpuStreamBuffer[2]; -// user settings +// user settings int iVolume=3; int iDebugMode=0; int iRecordMode=0; int iUseReverb=0; int iUseInterpolation=2; - + // MAIN infos struct for each channel int iDisStereo; @@ -164,7 +164,7 @@ REVERBInfo rvb[2]; unsigned long dwNoiseVal=1; // global noise generator unsigned short spuCtrl2[2]; // some vars to store psx reg infos unsigned short spuStat2[2]; -unsigned long spuIrq2[2]; +unsigned long spuIrq2[2]; unsigned long spuAddr2[2]; // address into spu mem unsigned long spuRvbAddr2[2]; unsigned long spuRvbAEnd2[2]; @@ -173,7 +173,7 @@ int bSpuInit=0; int bSPUIsOpen=0; int bThreadEnded=0; int iUseTimer=2; -int aSyncMode=0; +int aSyncMode=0; unsigned long aSyncCounter=0; unsigned long aSyncWait=0; DWORD aSyncTimerNew; @@ -184,7 +184,7 @@ HWND hWMain=0; // window handle HWND hWDebug=0; HWND hWRecord=0; -static HANDLE hMainThread; +static HANDLE hMainThread; #else #include static pthread_t hMainThread; @@ -230,7 +230,7 @@ static int iSecureStart=0; // secure start counter // dirty inline func includes -#include "reverb.c" +#include "reverb.c" #include "adsr.c" //////////////////////////////////////////////////////////////////////// @@ -268,12 +268,12 @@ static int iSecureStart=0; // secure start counter // // - and next delta significant (at least twice) bigger: // / -// __- -// +// __- +// // - and next delta is nearly same: // / // / -// +// INLINE void InterpolateUp(int ch) @@ -293,7 +293,7 @@ INLINE void InterpolateUp(int ch) if(id2<(id1<<1)) s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x10000L; else - s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x20000L; + s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x20000L; } else // curr delta negative { @@ -303,7 +303,7 @@ INLINE void InterpolateUp(int ch) if(id2>(id1<<1)) s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x10000L; else - s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x20000L; + s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x20000L; } } else @@ -351,18 +351,18 @@ INLINE void StartSound(int ch) { dwNewChannel2[ch/24]&=~(1<<(ch%24)); // clear new channel bit dwEndChannel2[ch/24]&=~(1<<(ch%24)); // clear end channel bit - + StartADSR(ch); - StartREVERB(ch); - + StartREVERB(ch); + s_chan[ch].pCurr=s_chan[ch].pStart; // set sample start - + s_chan[ch].s_1=0; // init mixing vars s_chan[ch].s_2=0; s_chan[ch].iSBPos=28; s_chan[ch].bNew=0; // init channel flags - s_chan[ch].bStop=0; + s_chan[ch].bStop=0; s_chan[ch].bOn=1; s_chan[ch].SB[29]=0; // init our interpolation helpers @@ -409,11 +409,11 @@ void UpdateMainVolR() // RIGHT VOLUME short sInc=1; if(vol&0x2000) sInc=-1; if(vol&0x1000) vol^=0xffff; - vol=((vol&0x7f)+1)/2; + vol=((vol&0x7f)+1)/2; vol+=vol/(2*sInc); vol*=128; } - else + else { if(vol&0x4000) //vol=vol^=0xffff; vol=0x3fff-(vol&0x3fff); @@ -473,9 +473,9 @@ void CALLBACK MainSPU2Proc(unsigned int nTimerId, unsigned int msg, unsigned int else Sleep (1000); } - while (aSyncCounter<=368640 && !bEndThread && aSyncMode==1) + while (aSyncCounter<=368640 && !bEndThread && aSyncMode==1) Sleep (1); // bEndThread/aSyncMode are needed, to avoid close problems - + aSyncCounter -= 36864; // 1ms more done (48Hz*768cycles/Hz) } else @@ -498,10 +498,10 @@ void CALLBACK MainSPU2Proc(unsigned int nTimerId, unsigned int msg, unsigned int // win thread mode: Sleep(PAUSE_W); // sleep for x ms (win) - if(dwNewChannel2[0] || dwNewChannel2[1]) + if(dwNewChannel2[0] || dwNewChannel2[1]) iSecureStart=1; // if a new channel kicks in (or, of course, sound buffer runs low), we will leave the loop - } - //--------------------------------------------------// continue from irq handling in timer mode? + } + //--------------------------------------------------// continue from irq handling in timer mode? if(lastch>=0) // will be -1 if no continue is pending { @@ -512,7 +512,7 @@ void CALLBACK MainSPU2Proc(unsigned int nTimerId, unsigned int msg, unsigned int } //--------------------------------------------------// - //- main channel loop -// + //- main channel loop -// //--------------------------------------------------// { for(ch=0;ch>= 4; - // -------------------------------------- // + // -------------------------------------- // - for (nSample=0;nSample<28;nSample+=2,start++) + for (nSample=0;nSample<28;nSample+=2,start++) { d=(int)*start; s=((d&0xf)<<12); @@ -569,34 +569,34 @@ void CALLBACK MainSPU2Proc(unsigned int nTimerId, unsigned int msg, unsigned int s_chan[ch].SB[nSample]=fa; if(s&0x8000) s|=0xffff0000; - fa=(s>>shift_factor); + fa=(s>>shift_factor); fa=fa + ((s_1 * f[predict_nr][0])>>6) + ((s_2 * f[predict_nr][1])>>6); s_2=s_1; s_1=fa; s_chan[ch].SB[nSample+1]=fa; - } - + } + //////////////////////////////////////////// irq check if(spuCtrl2[core]&0x40) // some irq active? { if(iDebugMode==1) logprintf("IRQ Active ch %x, C%x\r\n", ch, ch/24); - + if( pSpuIrq[core] >= start-16 && // irq address reached? pSpuIrq[core] <= start) { s_chan[ch].iIrqDone=1; // -> debug flag - + if(iDebugMode==1) logprintf("Sample End ch %x, C%x\r\n", ch, ch/24); - + regArea[0x7C0] |= 0x4< let's see what is happening if we call our irqs instead ;) - + } } - + //////////////////////////////////////////// flag handler if(flags & 0x2) s_chan[ch].bIgnoreLoop=1; // LOOP bit @@ -605,9 +605,9 @@ void CALLBACK MainSPU2Proc(unsigned int nTimerId, unsigned int msg, unsigned int if(flags&0x1) // 1: LOOP/END bit { dwEndChannel2[core]|=(1<<(ch%24)); - + if((flags&0xF) != 0x3 || s_chan[ch].pLoop == NULL) // Check if no loop is present - { + { s_chan[ch].bIgnoreLoop=0; s_chan[ch].bStop = 1; logprintf("Stopping\r\n"); @@ -617,7 +617,7 @@ void CALLBACK MainSPU2Proc(unsigned int nTimerId, unsigned int msg, unsigned int s_chan[ch].pCurr=start; // store values for next cycle s_chan[ch].s_1=s_1; - s_chan[ch].s_2=s_2; + s_chan[ch].s_2=s_2; //////////////////////////////////////////// @@ -631,20 +631,20 @@ GOON: ; else // else adjust { if(fa>32767L) fa=32767L; - if(fa<-32767L) fa=-32767L; + if(fa<-32767L) fa=-32767L; } if(iUseInterpolation>=2) // gauss/cubic interpolation { gpos = s_chan[ch].SB[28]; - gval0 = fa; + gval0 = fa; gpos = (gpos+1) & 3; s_chan[ch].SB[28] = gpos; } else if(iUseInterpolation==1) // simple interpolation { - s_chan[ch].SB[28] = 0; + s_chan[ch].SB[28] = 0; s_chan[ch].SB[29] = s_chan[ch].SB[30]; // -> helpers for simple linear interpolation: delay real val for two slots, and calc the two deltas, for a 'look at the future behaviour' s_chan[ch].SB[30] = s_chan[ch].SB[31]; s_chan[ch].SB[31] = fa; @@ -673,17 +673,17 @@ GOON: ; // mmm... depending on the noise freq we allow bigger/smaller changes to the previous val fa=s_chan[ch].iOldNoise+((fa-s_chan[ch].iOldNoise)/((0x001f-((spuCtrl2[core]&0x3f00)>>9))+1)); if(fa>32767L) fa=32767L; - if(fa<-32767L) fa=-32767L; + if(fa<-32767L) fa=-32767L; s_chan[ch].iOldNoise=fa; if(iUseInterpolation<2) // no gauss/cubic interpolation? s_chan[ch].SB[29] = fa; // -> store noise val in "current sample" slot } //---------------------------------------- - else // NO NOISE (NORMAL SAMPLE DATA) HERE + else // NO NOISE (NORMAL SAMPLE DATA) HERE {//------------------------------------------// if(iUseInterpolation==3) // cubic interpolation { - long xd; + long xd; xd = ((s_chan[ch].spos) >> 1)+1; gpos = s_chan[ch].SB[28]; @@ -732,7 +732,7 @@ GOON: ; if(NP>0x3fff) NP=0x3fff; else if(NP<0x1) NP=0x1; - + NP=(48000L*NP)>>12; // calc frequency ( 48hz ) s_chan[ch+1].iActFreq=NP; @@ -742,9 +742,9 @@ GOON: ; if(iUseInterpolation==1) // freq change in sipmle interpolation mode s_chan[ch+1].SB[32]=1; - } - else - { + } + else + { ////////////////////////////////////////////// // ok, left/right sound volume (ps2 volume goes from 0 ... 0x3fff) @@ -753,34 +753,34 @@ GOON: ; { if(s_chan[ch].bVolumeL) SSumL[ns]+=(s_chan[ch].sval*s_chan[ch].iLeftVolume)>>14; - + if(s_chan[ch].bVolumeR) SSumR[ns]+=(s_chan[ch].sval*s_chan[ch].iRightVolume)>>14; } - + ////////////////////////////////////////////// - // now let us store sound data for reverb - + // now let us store sound data for reverb + if(s_chan[ch].bRVBActive) StoreREVERB(ch,ns); } //////////////////////////////////////////////// // ok, go on until 1 ms data of this channel is collected - - ns++; - s_chan[ch].spos += s_chan[ch].sinc; - } -ENDX: ; + + ns++; + s_chan[ch].spos += s_chan[ch].sinc; + } +ENDX: ; } - } - + } + //---------------------------------------------------// //- here we have another 1 ms of sound data //---------------------------------------------------// /////////////////////////////////////////////////////// // mix all channels (including reverb) into one buffer for(ns=0;ns Adma4.Index)) { if(ADMAS4Write()) @@ -809,10 +809,10 @@ ENDX: ; } } if(Adma4.Index == 512) { - Adma4.Index = 0; + Adma4.Index = 0; } - - + + } if((regArea[PS2_C1_MMIX] & 0xF0) && regArea[PS2_C1_ADMAS] & 0x2 /*&& !(spuCtrl2[1] & 0x30)*/) @@ -825,7 +825,7 @@ ENDX: ; irqCallbackSPU2(); } Adma7.Index +=1; - + if((Adma7.ADMAPos - (Adma7.Index + 255)) <= 0 && (Adma7.ADMAPos > Adma7.Index)) { if(ADMAS7Write()) @@ -838,9 +838,9 @@ ENDX: ; } } if(Adma7.Index == 512) { - Adma7.Index = 0; + Adma7.Index = 0; } - + } SSumL[ns]+=MixREVERBLeft(ns,0); @@ -855,7 +855,7 @@ ENDX: ; else d=SSumL[ns]/iVolume; SSumL[ns]=0; *pS++=(d<-32767) ? -32767 : ((d>32767) ? 32767 : d); - + SSumR[ns]+=MixREVERBRight(0); SSumR[ns]+=MixREVERBRight(1); @@ -870,11 +870,11 @@ ENDX: ; } InitREVERB(); - ////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // feed the sound // wanna have around 1/60 sec (16.666 ms) updates - if(iCycle++>16) + if(iCycle++>16) { SoundFeedVoiceData((unsigned char*)pSpuBuffer, ((unsigned char *)pS)- @@ -901,7 +901,7 @@ EXPORT_GCC void CALLBACK SPU2async(unsigned long cycle) interrupt &= ~(1<<2); irqCallbackDMA7(); } - + } if(interrupt & (1<<1)){ @@ -938,13 +938,13 @@ EXPORT_GCC void CALLBACK SPU2async(unsigned long cycle) if(iUseTimer==0) // does the emu support SPUAsync, is it in thread mode, and in Thread Sync ON? { aSyncMode=1; // Ten, activate main function Sync system flag - + aSyncTimerOld = aSyncTimerNew; // Recalculate, AsyncWait (ms) aSyncTimerNew = timeGetTime(); - + aSyncWait =(unsigned int)((aSyncTimerNew - aSyncTimerOld)/2); - - aSyncCounter += cycle ; + + aSyncCounter += cycle ; return; } @@ -969,7 +969,7 @@ EXPORT_GCC void CALLBACK SPU2async(unsigned long cycle) #ifdef _WIN32 static HINSTANCE hIRE = NULL; #endif - + EXPORT_GCC long CALLBACK SPU2init(void) { spuMemC=(unsigned char *)spuMem; // just small setup @@ -1057,7 +1057,7 @@ void RemoveTimer(void) //////////////////////////////////////////////////////////////////////// void SetupStreams(void) -{ +{ int i; pSpuBuffer=(unsigned char *)malloc(38400); // alloc mixing buffer @@ -1074,7 +1074,7 @@ void SetupStreams(void) for(i=0;i init sustain @@ -1106,20 +1106,20 @@ void RemoveStreams(void) //////////////////////////////////////////////////////////////////////// #include FILE * LogFile; -EXPORT_GCC long CALLBACK SPU2open(void* pWindow) +EXPORT_GCC long CALLBACK SPU2open(void* pWindow) { #ifdef _WIN32 HWND hW= pWindow == NULL ? NULL : *(HWND*)pWindow; #else Display* dsp = *(Display**)pWindow; #endif - + if(bSPUIsOpen) return 0; // security for some stupid main emus LogFile = fopen("logs/spu2.txt","wb"); iVolume=3; bEndThread=0; bThreadEnded=0; - spuMemC=(unsigned char *)spuMem; + spuMemC=(unsigned char *)spuMem; memset((void *)s_chan,0,(MAXCHAN+1)*sizeof(SPUCHAN)); pSpuIrq[0]=spuMemC; pSpuIrq[1]=spuMemC; @@ -1127,19 +1127,19 @@ EXPORT_GCC long CALLBACK SPU2open(void* pWindow) dwNewChannel2[1]=0; dwEndChannel2[0]=0; dwEndChannel2[1]=0; - spuCtrl2[0]=0; - spuCtrl2[1]=0; + spuCtrl2[0]=0; + spuCtrl2[1]=0; spuStat2[0]=0; spuStat2[1]=0; - spuIrq2[0]=0; - spuIrq2[1]=0; - spuAddr2[0]=0x0; - spuAddr2[1]=0x0; + spuIrq2[0]=0; + spuIrq2[1]=0; + spuAddr2[0]=0x0; + spuAddr2[1]=0x0; spuRvbAddr2[0]=0; spuRvbAddr2[1]=0; spuRvbAEnd2[0]=0; spuRvbAEnd2[1]=0; - + memset(&Adma4,0,sizeof(ADMA)); memset(&Adma7,0,sizeof(ADMA)); @@ -1156,7 +1156,7 @@ EXPORT_GCC long CALLBACK SPU2open(void* pWindow) ReadConfig(); // read user stuff #endif - + SetupSound(); // setup midas (before init!) SetupStreams(); // prepare streaming @@ -1185,7 +1185,7 @@ EXPORT_GCC long CALLBACK SPU2open(void* pWindow) } #endif - return 0; + return 0; } @@ -1265,7 +1265,7 @@ EXPORT_GCC void CALLBACK SPU2about(void) //////////////////////////////////////////////////////////////////////// // SETUP CALLBACKS -// this functions will be called once, +// this functions will be called once, // passes a callback that should be called on SPU-IRQ/cdda volume change //////////////////////////////////////////////////////////////////////// @@ -1284,8 +1284,8 @@ EXPORT_GCC void CALLBACK SPU2irqCallback(void (CALLBACK *SPU2callback)(int), EXPORT_GCC char * CALLBACK PS2EgetLibName(void) { - return libraryName; -} + return libraryName; +} #define PS2E_LT_SPU2 0x4 diff --git a/plugins/PeopsSPU2/spu2PeopsSound.c b/plugins/PeopsSPU2/spu2PeopsSound.c index 7bf877c4e5..57d6cc1182 100644 --- a/plugins/PeopsSPU2/spu2PeopsSound.c +++ b/plugins/PeopsSPU2/spu2PeopsSound.c @@ -31,8 +31,8 @@ HINSTANCE hInst=NULL; -BOOL APIENTRY DllMain( HANDLE hModule, - DWORD dwReason, +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD dwReason, LPVOID lpReserved ) { diff --git a/plugins/PeopsSPU2/spunew.c b/plugins/PeopsSPU2/spunew.c index f5824d8d0d..0e1d21f32f 100644 --- a/plugins/PeopsSPU2/spunew.c +++ b/plugins/PeopsSPU2/spunew.c @@ -5,7 +5,7 @@ copyright : (C) 2002 by Pete Bernert email : BlackDove@addcom.de ***************************************************************************/ - + /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * @@ -15,7 +15,7 @@ * additional informations. * * * ***************************************************************************/ - + //*************************************************************************// // History of changes: // @@ -112,9 +112,9 @@ // spu version infos/name //////////////////////////////////////////////////////////////////////// -const unsigned char version = 5; -const unsigned char revision = 1; -const unsigned char build = 6; +const unsigned char version = 5; +const unsigned char revision = 1; +const unsigned char build = 6; static char * libraryName = "P.E.Op.S. SPU2 DSound Driver"; static char * libraryInfo = "P.E.Op.S. SPU2 Driver V1.6\nCoded by Pete Bernert, Saqib and the P.E.Op.S. team\n"; //////////////////////////////////////////////////////////////////////// @@ -123,21 +123,21 @@ static char * libraryInfo = "P.E.Op.S. SPU2 Driver V1.6\nCoded by Pete Berne // psx buffer / addresses -unsigned short regArea[32*1024]; +unsigned short regArea[32*1024]; short spuMem[2*1024*1024]; char * spuMemC; unsigned char * pSpuIrq[2]; unsigned char * pSpuBuffer; unsigned char * pSpuStreamBuffer[2]; -// user settings +// user settings int iVolume=3; int iDebugMode=0; int iRecordMode=0; int iUseReverb=0; int iUseInterpolation=2; - + // MAIN infos struct for each channel SPUCHAN s_chan[MAXCHAN+1]; // channel + 1 infos (1 is security for fmod handling) @@ -147,7 +147,7 @@ unsigned long dwNoiseVal=1; // global noise generator int iSPUIRQWait=1; unsigned short spuCtrl2[2]; // some vars to store psx reg infos unsigned short spuStat2[2]; -unsigned long spuIrq2[2]; +unsigned long spuIrq2[2]; unsigned long spuAddr2[2]; // address into spu mem unsigned long spuRvbAddr2[2]; unsigned long spuRvbAEnd2[2]; @@ -156,7 +156,7 @@ int bSpuInit=0; int bSPUIsOpen=0; int bThreadEnded=0; int iUseTimer=2; -int aSyncMode=0; +int aSyncMode=0; unsigned long aSyncCounter=0; unsigned long aSyncWait=0; DWORD aSyncTimerNew; @@ -165,7 +165,7 @@ HWND hWMain=0; // window handle HWND hWDebug=0; HWND hWRecord=0; -static HANDLE hMainThread; +static HANDLE hMainThread; unsigned long dwNewChannel2[2]; // flags for faster testing, if new channel starts unsigned long dwEndChannel2[2]; @@ -206,7 +206,7 @@ static int iSecureStart=0; // secure start counter // dirty inline func includes -#include "reverb.c" +#include "reverb.c" #include "adsr.c" //////////////////////////////////////////////////////////////////////// @@ -244,12 +244,12 @@ static int iSecureStart=0; // secure start counter // // - and next delta significant (at least twice) bigger: // / -// __- -// +// __- +// // - and next delta is nearly same: // / // / -// +// INLINE void InterpolateUp(int ch) @@ -269,7 +269,7 @@ INLINE void InterpolateUp(int ch) if(id2<(id1<<1)) s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x10000L; else - s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x20000L; + s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x20000L; } else // curr delta negative { @@ -279,7 +279,7 @@ INLINE void InterpolateUp(int ch) if(id2>(id1<<1)) s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x10000L; else - s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x20000L; + s_chan[ch].SB[28]=(id1*s_chan[ch].sinc)/0x20000L; } } else @@ -327,18 +327,18 @@ INLINE void StartSound(int ch) { dwNewChannel2[ch/24]&=~(1<<(ch%24)); // clear new channel bit dwEndChannel2[ch/24]&=~(1<<(ch%24)); // clear end channel bit - + StartADSR(ch); - StartREVERB(ch); - + StartREVERB(ch); + s_chan[ch].pCurr=s_chan[ch].pStart; // set sample start - + s_chan[ch].s_1=0; // init mixing vars s_chan[ch].s_2=0; s_chan[ch].iSBPos=28; s_chan[ch].bNew=0; // init channel flags - s_chan[ch].bStop=0; + s_chan[ch].bStop=0; s_chan[ch].bOn=1; s_chan[ch].SB[29]=0; // init our interpolation helpers @@ -385,11 +385,11 @@ void UpdateMainVolR() // RIGHT VOLUME short sInc=1; if(vol&0x2000) sInc=-1; if(vol&0x1000) vol^=0xffff; - vol=((vol&0x7f)+1)/2; + vol=((vol&0x7f)+1)/2; vol+=vol/(2*sInc); vol*=128; } - else + else { if(vol&0x4000) //vol=vol^=0xffff; vol=0x3fff-(vol&0x3fff); @@ -444,9 +444,9 @@ VOID CALLBACK MAINProc(UINT nTimerId,UINT msg,DWORD dwUser,DWORD dwParam1, DWORD else Sleep (1000); } - while (aSyncCounter<=368640 && !bEndThread && aSyncMode==1) + while (aSyncCounter<=368640 && !bEndThread && aSyncMode==1) Sleep (1); // bEndThread/aSyncMode are needed, to avoid close problems - + aSyncCounter -= 36864; // 1ms more done (48Hz*768cycles/Hz) } else @@ -469,10 +469,10 @@ VOID CALLBACK MAINProc(UINT nTimerId,UINT msg,DWORD dwUser,DWORD dwParam1, DWORD // win thread mode: Sleep(PAUSE_W); // sleep for x ms (win) - if(dwNewChannel2[0] || dwNewChannel2[1]) + if(dwNewChannel2[0] || dwNewChannel2[1]) iSecureStart=1; // if a new channel kicks in (or, of course, sound buffer runs low), we will leave the loop - } - //--------------------------------------------------// continue from irq handling in timer mode? + } + //--------------------------------------------------// continue from irq handling in timer mode? if(lastch>=0) // will be -1 if no continue is pending { @@ -483,7 +483,7 @@ VOID CALLBACK MAINProc(UINT nTimerId,UINT msg,DWORD dwUser,DWORD dwParam1, DWORD } //--------------------------------------------------// - //- main channel loop -// + //- main channel loop -// //--------------------------------------------------// { for(ch=0;ch>= 4; - // -------------------------------------- // + // -------------------------------------- // - for (nSample=0;nSample<28;nSample+=2,start++) + for (nSample=0;nSample<28;nSample+=2,start++) { d=(int)*start; s=((d&0xf)<<12); @@ -540,33 +540,33 @@ VOID CALLBACK MAINProc(UINT nTimerId,UINT msg,DWORD dwUser,DWORD dwParam1, DWORD s_chan[ch].SB[nSample]=fa; if(s&0x8000) s|=0xffff0000; - fa=(s>>shift_factor); + fa=(s>>shift_factor); fa=fa + ((s_1 * f[predict_nr][0])>>6) + ((s_2 * f[predict_nr][1])>>6); s_2=s_1; s_1=fa; s_chan[ch].SB[nSample+1]=fa; - } - + } + //////////////////////////////////////////// irq check if(spuCtrl2[core]&0x40) // some irq active? { if(iDebugMode==1) logprintf("IRQ Active ch %x, C%x\r\n", ch, ch/24); - + if((pSpuIrq[core] >= start-16 && // irq address reached? pSpuIrq[core] <= start) || - ((flags&1) && // special: irq on looping addr, when stop/loop flag is set + ((flags&1) && // special: irq on looping addr, when stop/loop flag is set (pSpuIrq[core] >= s_chan[ch].pLoop-16 && pSpuIrq[core] <= s_chan[ch].pLoop))) { s_chan[ch].iIrqDone=1; // -> debug flag - + if(iDebugMode==1) logprintf("Sample End ch %x, C%x\r\n", ch, ch/24); - + regArea[0x7C0] |= 0x4< let's see what is happening if we call our irqs instead ;) - + if(iSPUIRQWait) // -> option: wait after irq for main emu { iSpuAsyncWait=1; @@ -574,7 +574,7 @@ VOID CALLBACK MAINProc(UINT nTimerId,UINT msg,DWORD dwUser,DWORD dwParam1, DWORD } } } - + //////////////////////////////////////////// flag handler if(flags & 0x2) s_chan[ch].bIgnoreLoop=1; // LOOP bit @@ -583,9 +583,9 @@ VOID CALLBACK MAINProc(UINT nTimerId,UINT msg,DWORD dwUser,DWORD dwParam1, DWORD if(flags&0x1) // 1: LOOP/END bit { dwEndChannel2[core]|=(1<<(ch%24)); - + if((flags&0xF) != 0x3) // Check if no loop is present - { + { s_chan[ch].bIgnoreLoop=0; s_chan[ch].bStop = 1; logprintf("Stopping\r\n"); @@ -595,7 +595,7 @@ VOID CALLBACK MAINProc(UINT nTimerId,UINT msg,DWORD dwUser,DWORD dwParam1, DWORD s_chan[ch].pCurr=start; // store values for next cycle s_chan[ch].s_1=s_1; - s_chan[ch].s_2=s_2; + s_chan[ch].s_2=s_2; //////////////////////////////////////////// @@ -604,16 +604,16 @@ VOID CALLBACK MAINProc(UINT nTimerId,UINT msg,DWORD dwUser,DWORD dwParam1, DWORD { bIRQReturn=0; if(iUseTimer!=2) - { + { DWORD dwWatchTime=timeGetTime()+2500; - while(iSpuAsyncWait && !bEndThread && + while(iSpuAsyncWait && !bEndThread && timeGetTime()32767L) fa=32767L; - if(fa<-32767L) fa=-32767L; + if(fa<-32767L) fa=-32767L; } if(iUseInterpolation>=2) // gauss/cubic interpolation { gpos = s_chan[ch].SB[28]; - gval0 = fa; + gval0 = fa; gpos = (gpos+1) & 3; s_chan[ch].SB[28] = gpos; } else if(iUseInterpolation==1) // simple interpolation { - s_chan[ch].SB[28] = 0; + s_chan[ch].SB[28] = 0; s_chan[ch].SB[29] = s_chan[ch].SB[30]; // -> helpers for simple linear interpolation: delay real val for two slots, and calc the two deltas, for a 'look at the future behaviour' s_chan[ch].SB[30] = s_chan[ch].SB[31]; s_chan[ch].SB[31] = fa; @@ -673,17 +673,17 @@ GOON: ; // mmm... depending on the noise freq we allow bigger/smaller changes to the previous val fa=s_chan[ch].iOldNoise+((fa-s_chan[ch].iOldNoise)/((0x001f-((spuCtrl2[core]&0x3f00)>>9))+1)); if(fa>32767L) fa=32767L; - if(fa<-32767L) fa=-32767L; + if(fa<-32767L) fa=-32767L; s_chan[ch].iOldNoise=fa; if(iUseInterpolation<2) // no gauss/cubic interpolation? s_chan[ch].SB[29] = fa; // -> store noise val in "current sample" slot } //---------------------------------------- - else // NO NOISE (NORMAL SAMPLE DATA) HERE + else // NO NOISE (NORMAL SAMPLE DATA) HERE {//------------------------------------------// if(iUseInterpolation==3) // cubic interpolation { - long xd; + long xd; xd = ((s_chan[ch].spos) >> 1)+1; gpos = s_chan[ch].SB[28]; @@ -732,7 +732,7 @@ GOON: ; if(NP>0x3fff) NP=0x3fff; else if(NP<0x1) NP=0x1; - + NP=(48000L*NP)>>12; // calc frequency ( 48hz ) s_chan[ch+1].iActFreq=NP; @@ -742,9 +742,9 @@ GOON: ; if(iUseInterpolation==1) // freq change in sipmle interpolation mode s_chan[ch+1].SB[32]=1; - } - else - { + } + else + { ////////////////////////////////////////////// // ok, left/right sound volume (ps2 volume goes from 0 ... 0x3fff) @@ -753,34 +753,34 @@ GOON: ; { if(s_chan[ch].bVolumeL) SSumL[ns]+=(s_chan[ch].sval*s_chan[ch].iLeftVolume)>>14; - + if(s_chan[ch].bVolumeR) SSumR[ns]+=(s_chan[ch].sval*s_chan[ch].iRightVolume)>>14; } - + ////////////////////////////////////////////// - // now let us store sound data for reverb - + // now let us store sound data for reverb + if(s_chan[ch].bRVBActive) StoreREVERB(ch,ns); } //////////////////////////////////////////////// // ok, go on until 1 ms data of this channel is collected - - ns++; - s_chan[ch].spos += s_chan[ch].sinc; - } -ENDX: ; + + ns++; + s_chan[ch].spos += s_chan[ch].sinc; + } +ENDX: ; } - } - + } + //---------------------------------------------------// //- here we have another 1 ms of sound data //---------------------------------------------------// /////////////////////////////////////////////////////// // mix all channels (including reverb) into one buffer for(ns=0;ns32767) ? 32767 : d); - + SSumR[ns]+=MixREVERBRight(0); SSumR[ns]+=MixREVERBRight(1); @@ -850,11 +850,11 @@ ENDX: ; } InitREVERB(); - ////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // feed the sound // wanna have around 1/60 sec (16.666 ms) updates - if(iCycle++>16) + if(iCycle++>16) { SoundFeedVoiceData((unsigned char*)pSpuBuffer, ((unsigned char *)pS)- @@ -889,7 +889,7 @@ EXPORT_GCC void CALLBACK SPU2async(unsigned long cycle) interrupt &= ~(1<<2); irqCallbackDMA7(); } - + } if(interrupt & (1<<1)){ @@ -920,13 +920,13 @@ EXPORT_GCC void CALLBACK SPU2async(unsigned long cycle) if(iUseTimer==0) // does the emu support SPUAsync, is it in thread mode, and in Thread Sync ON? { aSyncMode=1; // Ten, activate main function Sync system flag - + aSyncTimerOld = aSyncTimerNew; // Recalculate, AsyncWait (ms) aSyncTimerNew = timeGetTime(); - + aSyncWait =(unsigned int)((aSyncTimerNew - aSyncTimerOld)/2); - - aSyncCounter += cycle ; + + aSyncCounter += cycle ; return; } @@ -950,7 +950,7 @@ EXPORT_GCC void CALLBACK SPU2async(unsigned long cycle) #ifdef _WINDOWS static HINSTANCE hIRE = NULL; #endif - + EXPORT_GCC long CALLBACK SPU2init(void) { spuMemC=(unsigned char *)spuMem; // just small setup @@ -1018,7 +1018,7 @@ void RemoveTimer(void) //////////////////////////////////////////////////////////////////////// void SetupStreams(void) -{ +{ int i; pSpuBuffer=(unsigned char *)malloc(38400); // alloc mixing buffer @@ -1035,7 +1035,7 @@ void SetupStreams(void) for(i=0;i init sustain @@ -1067,18 +1067,18 @@ void RemoveStreams(void) //////////////////////////////////////////////////////////////////////// #include FILE * LogFile; -EXPORT_GCC long CALLBACK SPU2open(void* pWindow) +EXPORT_GCC long CALLBACK SPU2open(void* pWindow) { #ifdef _WINDOWS HWND hW= pWindow == NULL ? NULL : *(HWND*)pWindow; #endif - + if(bSPUIsOpen) return 0; // security for some stupid main emus LogFile = fopen("Logs/spu2.txt","wb"); iVolume=3; bEndThread=0; bThreadEnded=0; - spuMemC=(unsigned char *)spuMem; + spuMemC=(unsigned char *)spuMem; memset((void *)s_chan,0,(MAXCHAN+1)*sizeof(SPUCHAN)); pSpuIrq[0]=spuMemC; pSpuIrq[1]=spuMemC; @@ -1086,19 +1086,19 @@ EXPORT_GCC long CALLBACK SPU2open(void* pWindow) dwNewChannel2[1]=0; dwEndChannel2[0]=0; dwEndChannel2[1]=0; - spuCtrl2[0]=0; - spuCtrl2[1]=0; + spuCtrl2[0]=0; + spuCtrl2[1]=0; spuStat2[0]=0; spuStat2[1]=0; - spuIrq2[0]=0; - spuIrq2[1]=0; - spuAddr2[0]=0x0; - spuAddr2[1]=0x0; + spuIrq2[0]=0; + spuIrq2[1]=0; + spuAddr2[0]=0x0; + spuAddr2[1]=0x0; spuRvbAddr2[0]=0; spuRvbAddr2[1]=0; spuRvbAEnd2[0]=0; spuRvbAEnd2[1]=0; - + memset(&Adma4,0,sizeof(ADMA)); memset(&Adma7,0,sizeof(ADMA)); @@ -1110,7 +1110,7 @@ EXPORT_GCC long CALLBACK SPU2open(void* pWindow) hWMain = hW; // store hwnd ReadConfig(); // read user stuff - + SetupSound(); // setup midas (before init!) SetupStreams(); // prepare streaming @@ -1137,7 +1137,7 @@ EXPORT_GCC long CALLBACK SPU2open(void* pWindow) SetFocus(hWMain); } - return 0; + return 0; } //////////////////////////////////////////////////////////////////////// @@ -1226,7 +1226,7 @@ EXPORT_GCC void CALLBACK SPU2about(void) //////////////////////////////////////////////////////////////////////// // SETUP CALLBACKS -// this functions will be called once, +// this functions will be called once, // passes a callback that should be called on SPU-IRQ/cdda volume change //////////////////////////////////////////////////////////////////////// @@ -1245,8 +1245,8 @@ EXPORT_GCC void CALLBACK SPU2irqCallback(void (CALLBACK *SPU2callback)(int), EXPORT_GCC char * CALLBACK PS2EgetLibName(void) { - return libraryName; -} + return libraryName; +} #define PS2E_LT_SPU2 0x4 diff --git a/plugins/PeopsSPU2/stdafx.h b/plugins/PeopsSPU2/stdafx.h index c6c643857a..b9df1010ef 100644 --- a/plugins/PeopsSPU2/stdafx.h +++ b/plugins/PeopsSPU2/stdafx.h @@ -38,7 +38,7 @@ #define WIN32_LEAN_AND_MEAN #define STRICT -#include +#include #include #include "mmsystem.h" #include diff --git a/plugins/PeopsSPU2/xa.c b/plugins/PeopsSPU2/xa.c index 93422db269..0f1037b09c 100644 --- a/plugins/PeopsSPU2/xa.c +++ b/plugins/PeopsSPU2/xa.c @@ -60,7 +60,7 @@ static int gauss_window[8] = {0, 0, 0, 0, 0, 0, 0, 0}; #define gvalr(x) gauss_window[4+((gauss_ptr+x)&3)] //////////////////////////////////////////////////////////////////////// -// MIX XA +// MIX XA //////////////////////////////////////////////////////////////////////// INLINE void MixXA(void) @@ -87,7 +87,7 @@ INLINE void MixXA(void) } //////////////////////////////////////////////////////////////////////// -// FEED XA +// FEED XA //////////////////////////////////////////////////////////////////////// INLINE void FeedXA(xa_decode_t *xap) @@ -122,11 +122,11 @@ INLINE void FeedXA(xa_decode_t *xap) dwFPS+=dw-dwLT;iFPSCnt++; dwLT=dw; - + if(iFPSCnt>=10) { if(!dwFPS) dwFPS=1; - dw1=1000000/dwFPS; + dw1=1000000/dwFPS; if(dw1>=(dwL1-100) && dw1<=(dwL1+100)) dw1=dwL1; else dwL1=dw1; dw2=(xap->freq*100/xap->nsamples); @@ -159,7 +159,7 @@ INLINE void FeedXA(xa_decode_t *xap) long l1,l2;short s; for(i=0;i=0x10000L) { @@ -205,7 +205,7 @@ INLINE void FeedXA(xa_decode_t *xap) *XAFeed++=l; if(XAFeed==XAEnd) XAFeed=XAStart; - if(XAFeed==XAPlay) + if(XAFeed==XAPlay) { if(XAPlay!=XAStart) XAFeed=XAPlay-1; break; @@ -218,7 +218,7 @@ INLINE void FeedXA(xa_decode_t *xap) { for(i=0;i=0x10000L) { @@ -252,7 +252,7 @@ INLINE void FeedXA(xa_decode_t *xap) *XAFeed++=l; if(XAFeed==XAEnd) XAFeed=XAStart; - if(XAFeed==XAPlay) + if(XAFeed==XAPlay) { if(XAPlay!=XAStart) XAFeed=XAPlay-1; break; @@ -272,7 +272,7 @@ INLINE void FeedXA(xa_decode_t *xap) long l1; for(i=0;i=0x10000L) { @@ -305,7 +305,7 @@ INLINE void FeedXA(xa_decode_t *xap) *XAFeed++=l; if(XAFeed==XAEnd) XAFeed=XAStart; - if(XAFeed==XAPlay) + if(XAFeed==XAPlay) { if(XAPlay!=XAStart) XAFeed=XAPlay-1; break; @@ -318,7 +318,7 @@ INLINE void FeedXA(xa_decode_t *xap) { for(i=0;i=0x10000L) { @@ -347,7 +347,7 @@ INLINE void FeedXA(xa_decode_t *xap) *XAFeed++=(l|(l<<16)); if(XAFeed==XAEnd) XAFeed=XAStart; - if(XAFeed==XAPlay) + if(XAFeed==XAPlay) { if(XAPlay!=XAStart) XAFeed=XAPlay-1; break; diff --git a/plugins/SPU2null/Linux/Config.cpp b/plugins/SPU2null/Linux/Config.cpp index cb0bb05deb..1272577f5b 100644 --- a/plugins/SPU2null/Linux/Config.cpp +++ b/plugins/SPU2null/Linux/Config.cpp @@ -21,7 +21,7 @@ #ifdef __cplusplus extern "C" -{ +{ #endif #include "support.h" @@ -108,7 +108,7 @@ void OnConf_Cancel(GtkButton *button, gpointer user_data) EXPORT_C_(void) SPU2configure() { //SysMessage("Nothing to Configure"); - + Conf = create_Config(); LoadConfig(); @@ -121,20 +121,20 @@ EXPORT_C_(void) SPU2configure() EXPORT_C_(void) SPU2about() { //SysMessage("%s %d.%d", libraryName, version, build); - + About = create_About(); gtk_widget_show_all(About); gtk_main(); } -void LoadConfig() +void LoadConfig() { FILE *f; char cfg[255]; strcpy(cfg, s_strIniPath.c_str()); f = fopen(cfg, "r"); - if (f == NULL) + if (f == NULL) { printf("failed to open %s\n", s_strIniPath.c_str()); SaveConfig();//save and return @@ -145,19 +145,19 @@ void LoadConfig() fclose(f); } -void SaveConfig() +void SaveConfig() { FILE *f; char cfg[255]; strcpy(cfg, s_strIniPath.c_str()); f = fopen(cfg,"w"); - if (f == NULL) + if (f == NULL) { printf("failed to open %s\n", s_strIniPath.c_str()); return; } - + fprintf(f, "logging = %hhx\n", conf.Log); //fprintf(f, "options = %hhx\n", confOptions); fclose(f); diff --git a/plugins/SPU2null/SPU2.cpp b/plugins/SPU2null/SPU2.cpp index 5b2033ca7c..87e9a95225 100644 --- a/plugins/SPU2null/SPU2.cpp +++ b/plugins/SPU2null/SPU2.cpp @@ -22,7 +22,7 @@ #include #include using namespace std; - + const u8 version = PS2E_SPU2_VERSION; const u8 revision = 0; const u8 build = 8; // increase that with each version @@ -70,7 +70,7 @@ void (*irqCallbackSPU2)(); // func of main emu, called on spu i void (*irqCallbackDMA4)() = 0; // func of main emu, called on spu irq void (*irqCallbackDMA7)() = 0; // func of main emu, called on spu irq -const s32 f[5][2] = { +const s32 f[5][2] = { { 0, 0 }, { 60, 0 }, { 115, -52 }, @@ -727,7 +727,7 @@ EXPORT_C_(void) SPU2writeDMA4Mem(u16* pMem, int size) u32 spuaddr; SPU2_LOG("SPU2 writeDMA4Mem size %x, addr: %x\n", size, pMem); - + if ((spu2Ru16(REG_C0_ADMAS) & 0x1) && (spu2Ru16(REG_C0_CTRL) & 0x30) == 0 && size) { //fwrite(pMem,iSize<<1,1,LogFile); @@ -766,7 +766,7 @@ EXPORT_C_(void) SPU2writeDMA7Mem(u16* pMem, int size) u32 spuaddr; SPU2_LOG("SPU2 writeDMA7Mem size %x, addr: %x\n", size, pMem); - + if ((spu2Ru16(REG_C1_ADMAS) & 0x2) && (spu2Ru16(REG_C1_CTRL) & 0x30) == 0 && size) { //fwrite(pMem,iSize<<1,1,LogFile); @@ -803,7 +803,7 @@ EXPORT_C_(void) SPU2writeDMA7Mem(u16* pMem, int size) EXPORT_C_(void) SPU2interruptDMA4() { SPU2_LOG("SPU2 interruptDMA4\n"); - + spu2Rs16(REG_C0_CTRL) &= ~0x30; spu2Ru16(REG_C0_SPUSTAT) |= 0x80; } @@ -811,7 +811,7 @@ EXPORT_C_(void) SPU2interruptDMA4() EXPORT_C_(void) SPU2interruptDMA7() { SPU2_LOG("SPU2 interruptDMA7\n"); - + // spu2Rs16(REG_C1_CTRL)&= ~0x30; // //spu2Rs16(REG__5B0) = 0; // spu2Rs16(SPU2_STATX_DREQ)|= 0x80; @@ -864,7 +864,7 @@ void FModOn(s32 start, s32 end, u16 val) // FMOD ON PSX COMMAND EXPORT_C_(void) SPU2write(u32 mem, u16 value) { u32 spuaddr; - + SPU2_LOG("SPU2 write mem %x value %x\n", mem, value); assert(C0_SPUADDR < 0x100000); @@ -891,9 +891,9 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value) case 4: { int NP; - if (value > 0x3fff) + if (value > 0x3fff) NP = 0x3fff; // get pitch val - else + else NP = value; pvoice->pvoice->pitch = NP; @@ -985,7 +985,7 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value) irqCallbackSPU2(); } if (spuaddr > 0xFFFFE) spuaddr = 0x2800; - + C0_SPUADDR_SET(spuaddr); spu2Ru16(REG_C0_SPUSTAT) &= ~0x80; spu2Ru16(REG_C0_CTRL) &= ~0x30; @@ -1001,7 +1001,7 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value) irqCallbackSPU2(); } if (spuaddr > 0xFFFFE) spuaddr = 0x2800; - + C1_SPUADDR_SET(spuaddr); spu2Ru16(REG_C1_SPUSTAT) &= ~0x80; spu2Ru16(REG_C1_CTRL) &= ~0x30; @@ -1085,10 +1085,10 @@ EXPORT_C_(u16) SPU2read(u32 mem) if ((r >= 0x0000 && r <= 0x0180) || (r >= 0x0400 && r <= 0x0580)) // some channel info? { s32 ch = 0; - - if (r >= 0x400) + + if (r >= 0x400) ch = ((r - 0x400) >> 4) + 24; - else + else ch = (r >> 4); VOICE_PROCESSED* pvoice = &voices[ch]; @@ -1104,7 +1104,7 @@ EXPORT_C_(u16) SPU2read(u32 mem) { s32 ch = 0; u32 rx = r; - + if (rx >= 0x400) { ch = 24; @@ -1141,7 +1141,7 @@ EXPORT_C_(u16) SPU2read(u32 mem) if (spuaddr > 0xfffff) spuaddr = 0; C0_SPUADDR_SET(spuaddr); break; - + case REG_C1_SPUDATA: spuaddr = C1_SPUADDR; ret = spu2mem[spuaddr]; @@ -1166,7 +1166,7 @@ EXPORT_C_(u16) SPU2read(u32 mem) default: ret = spu2Ru16(mem); } - + SPU2_LOG("SPU2 read mem %x: %x\n", mem, ret); return ret; @@ -1275,7 +1275,7 @@ EXPORT_C_(s32) SPU2freeze(int mode, freezeData *data) { memcpy(spu2regs, spud->spu2regs, 0x10000); } - else + else { printf("SPU2null wrong format\n"); } diff --git a/plugins/SPU2null/SPU2.h b/plugins/SPU2null/SPU2.h index eb65db59ef..22d55434e8 100644 --- a/plugins/SPU2null/SPU2.h +++ b/plugins/SPU2null/SPU2.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef __SPU2_H__ #define __SPU2_H__ @@ -148,7 +148,7 @@ void SysMessage(char *fmt, ...); spu2Ru16(hi) = ((value)>>16)&0x3f; \ spu2Ru16(lo) = (value)&0xffff; \ } \ - + #define C0_IRQA SPU2_GET32BIT(REG_C0_IRQA_LO, REG_C0_IRQA_HI) #define C1_IRQA SPU2_GET32BIT(REG_C1_IRQA_LO, REG_C1_IRQA_HI) @@ -169,7 +169,7 @@ struct SPU_CONTROL_ u16 irq : 1; u16 dma : 2; // 1 - no dma, 2 - write, 3 - read u16 extr : 1; // external reverb - u16 cdreverb : 1; + u16 cdreverb : 1; u16 extAudio : 1; u16 extCd : 1; }; @@ -200,16 +200,16 @@ struct _SPU_VOICE u16 SustainLvl : 4; u16 DecayRate : 4; - u16 AttackRate : 7; + u16 AttackRate : 7; u16 AttackExp : 1; // if 0, linear - + u16 ReleaseRate : 5; u16 ReleaseExp : 1; // if 0, linear u16 SustainRate : 7; u16 res1 : 1; u16 SustainDec : 1; // if 0, inc u16 SustainExp : 1; // if 0, linear - + u16 AdsrVol; u16 Address; // add / 8 u16 RepeatAddr; // gets reset when sample starts diff --git a/plugins/SPU2null/Windows/Config.cpp b/plugins/SPU2null/Windows/Config.cpp index 8d9a2aa717..c510353b99 100644 --- a/plugins/SPU2null/Windows/Config.cpp +++ b/plugins/SPU2null/Windows/Config.cpp @@ -3,7 +3,7 @@ #include "SPU2.h" extern HINSTANCE hInst; -void SaveConfig() +void SaveConfig() { Config *Conf1 = &conf; @@ -27,7 +27,7 @@ void LoadConfig() { Config *Conf1 = &conf; char *szTemp; char szIniFile[256], szValue[256]; - + GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); szTemp = strrchr(szIniFile, '\\'); @@ -36,7 +36,7 @@ void LoadConfig() { fp=fopen("inis\\usbnull.ini","rt");//check if usbnull.ini really exists if (!fp) { - CreateDirectory("inis",NULL); + CreateDirectory("inis",NULL); memset(&conf, 0, sizeof(conf)); conf.Log = 0;//default value SaveConfig();//save and return diff --git a/plugins/SPU2null/Windows/Win32.cpp b/plugins/SPU2null/Windows/Win32.cpp index bab022daf8..770a5419d5 100644 --- a/plugins/SPU2null/Windows/Win32.cpp +++ b/plugins/SPU2null/Windows/Win32.cpp @@ -18,7 +18,7 @@ void SysMessage(char *fmt, ...) { } BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { - + switch(uMsg) { case WM_INITDIALOG: LoadConfig(); @@ -60,20 +60,20 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { void CALLBACK SPU2configure() { DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), - GetActiveWindow(), - (DLGPROC)ConfigureDlgProc); + GetActiveWindow(), + (DLGPROC)ConfigureDlgProc); } void CALLBACK SPU2about() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)AboutDlgProc); } BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT - DWORD dwReason, + DWORD dwReason, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; return TRUE; // very quick :) diff --git a/plugins/SPU2null/Windows/resource.h b/plugins/SPU2null/Windows/resource.h index 701862bdef..d547b4c53c 100644 --- a/plugins/SPU2null/Windows/resource.h +++ b/plugins/SPU2null/Windows/resource.h @@ -10,7 +10,7 @@ #define IDC_LOGGING 1007 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 102 diff --git a/plugins/SSSPSXPAD/PadSSSPSXres.h b/plugins/SSSPSXPAD/PadSSSPSXres.h index e45dc6a1a9..0174832332 100644 --- a/plugins/SSSPSXPAD/PadSSSPSXres.h +++ b/plugins/SSSPSXPAD/PadSSSPSXres.h @@ -48,7 +48,7 @@ #define IDC_TABC 1060 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 diff --git a/plugins/USBnull/Config.cpp b/plugins/USBnull/Config.cpp index fef2ec9e51..5ee4a226e1 100644 --- a/plugins/USBnull/Config.cpp +++ b/plugins/USBnull/Config.cpp @@ -61,7 +61,7 @@ void LoadConfig() SaveConfig(); return; } - + conf.Log = Ini.ReadInt("logging", 0); setLoggingState(); Ini.Close(); @@ -75,7 +75,7 @@ void SaveConfig() USBLog.WriteLn("Failed to open %s", IniPath.c_str()); return; } - + Ini.WriteInt("logging", conf.Log); Ini.Close(); } diff --git a/plugins/USBnull/USB.cpp b/plugins/USBnull/USB.cpp index 7a80920fb8..211a11832a 100644 --- a/plugins/USBnull/USB.cpp +++ b/plugins/USBnull/USB.cpp @@ -60,13 +60,13 @@ EXPORT_C_(s32) USBinit() // Initialize memory structures here. usbregs = (s8*)malloc(0x10000); - - if (usbregs == NULL) + + if (usbregs == NULL) { - USBLog.Message("Error allocating memory"); + USBLog.Message("Error allocating memory"); return -1; } - + memset(usbregs, 0, 0x10000); return 0; } @@ -81,7 +81,7 @@ EXPORT_C_(void) USBshutdown() EXPORT_C_(s32) USBopen(void *pDsp) { USBLog.WriteLn("Opening USBnull."); - + // Take care of anything else we need on opening, other then initialization. return 0; } @@ -96,7 +96,7 @@ EXPORT_C_(void) USBclose() EXPORT_C_(u8) USBread8(u32 addr) { u8 value = 0; - + switch(addr) { // Handle any appropriate addresses here. @@ -115,7 +115,7 @@ EXPORT_C_(u8) USBread8(u32 addr) EXPORT_C_(u16) USBread16(u32 addr) { u16 value = 0; - + switch(addr) { // Handle any appropriate addresses here. @@ -133,7 +133,7 @@ EXPORT_C_(u16) USBread16(u32 addr) EXPORT_C_(u32) USBread32(u32 addr) { u32 value = 0; - + switch(addr) { // Handle any appropriate addresses here. @@ -193,7 +193,7 @@ EXPORT_C_(void) USBwrite32(u32 addr, u32 value) } } -EXPORT_C_(void) USBirqCallback(USBcallback callback) +EXPORT_C_(void) USBirqCallback(USBcallback callback) { // Register USBirq, so we can trigger an interrupt with it later. // It will be called as USBirq(cycles); where cycles is the number @@ -203,7 +203,7 @@ EXPORT_C_(void) USBirqCallback(USBcallback callback) EXPORT_C_(int) _USBirqHandler(void) { - // This is our USB irq handler, so if an interrupt gets triggered, + // This is our USB irq handler, so if an interrupt gets triggered, // deal with it here. return 0; } @@ -225,12 +225,12 @@ EXPORT_C_(void) USBsetSettingsDir(const char* dir) // Get the path to the ini directory. s_strIniPath = (dir==NULL) ? "inis/" : dir; } - + // extended funcs EXPORT_C_(s32) USBfreeze(int mode, freezeData *data) { - // This should store or retrieve any information, for if emulation + // This should store or retrieve any information, for if emulation // gets suspended, or for savestates. switch(mode) { diff --git a/plugins/USBnull/Windows/Config.cpp b/plugins/USBnull/Windows/Config.cpp index 5e31d6dcb5..79700edee3 100644 --- a/plugins/USBnull/Windows/Config.cpp +++ b/plugins/USBnull/Windows/Config.cpp @@ -3,7 +3,7 @@ #include "../USB.h" extern HINSTANCE hInst; -void SaveConfig() +void SaveConfig() { Config *Conf1 = &conf; @@ -27,7 +27,7 @@ void LoadConfig() { Config *Conf1 = &conf; char *szTemp; char szIniFile[256], szValue[256]; - + GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); szTemp = strrchr(szIniFile, '\\'); @@ -36,7 +36,7 @@ void LoadConfig() { fp=fopen("inis\\usbnull.ini","rt");//check if usbnull.ini really exists if (!fp) { - CreateDirectory("inis",NULL); + CreateDirectory("inis",NULL); memset(&conf, 0, sizeof(conf)); conf.Log = 0;//default value SaveConfig();//save and return diff --git a/plugins/USBnull/Windows/Win32.cpp b/plugins/USBnull/Windows/Win32.cpp index e89af62e52..bca110960a 100644 --- a/plugins/USBnull/Windows/Win32.cpp +++ b/plugins/USBnull/Windows/Win32.cpp @@ -18,7 +18,7 @@ void SysMessage(char *fmt, ...) { } BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { - + switch(uMsg) { case WM_INITDIALOG: LoadConfig(); @@ -60,20 +60,20 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { void CALLBACK USBconfigure() { DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), - GetActiveWindow(), - (DLGPROC)ConfigureDlgProc); + GetActiveWindow(), + (DLGPROC)ConfigureDlgProc); } void CALLBACK USBabout() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)AboutDlgProc); } BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT - DWORD dwReason, + DWORD dwReason, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; return TRUE; // very quick :) diff --git a/plugins/USBnull/Windows/resource.h b/plugins/USBnull/Windows/resource.h index 6fb2e61293..94cc4e3e5c 100644 --- a/plugins/USBnull/Windows/resource.h +++ b/plugins/USBnull/Windows/resource.h @@ -10,7 +10,7 @@ #define IDC_LOGGING 1007 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 105 diff --git a/plugins/cdvdGigaherz/src/CDVD.cpp b/plugins/cdvdGigaherz/src/CDVD.cpp index 3732c55e0b..dec3683052 100644 --- a/plugins/cdvdGigaherz/src/CDVD.cpp +++ b/plugins/cdvdGigaherz/src/CDVD.cpp @@ -132,12 +132,12 @@ void CALLBACK CDVDsetSettingsDir(const char* dir) CfgSetSettingsDir(dir); } -s32 CALLBACK CDVDinit() +s32 CALLBACK CDVDinit() { return 0; } -s32 CALLBACK CDVDopen(const char* pTitleFilename) +s32 CALLBACK CDVDopen(const char* pTitleFilename) { ReadSettings(); @@ -193,7 +193,7 @@ s32 CALLBACK CDVDopen(const char* pTitleFilename) return cdvdRefreshData(); } -void CALLBACK CDVDclose() +void CALLBACK CDVDclose() { cdvdStopThread(); @@ -202,7 +202,7 @@ void CALLBACK CDVDclose() src=NULL; } -void CALLBACK CDVDshutdown() +void CALLBACK CDVDshutdown() { //nothing to do here } @@ -235,7 +235,7 @@ s32 CALLBACK CDVDreadSector(u8* buffer, s32 lsn, int mode) return cdvdDirectReadSector(lsn,mode,(char*)buffer); } -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode) +s32 CALLBACK CDVDreadTrack(u32 lsn, int mode) { csector=lsn; cmode=mode; @@ -256,7 +256,7 @@ s32 CALLBACK CDVDreadTrack(u32 lsn, int mode) } // return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer() +u8* CALLBACK CDVDgetBuffer() { if(lastReadInNewDiskCB) { @@ -270,7 +270,7 @@ u8* CALLBACK CDVDgetBuffer() } // return can be NULL (for async modes) -int CALLBACK CDVDgetBuffer2(u8* dest) +int CALLBACK CDVDgetBuffer2(u8* dest) { int csize = 2352; switch(cmode) @@ -293,7 +293,7 @@ int CALLBACK CDVDgetBuffer2(u8* dest) return 0; } -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq) +s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq) { int i; // the formatted subq command returns: control/adr, track, index, trk min, trk sec, trk frm, 0x00, abs min, abs sec, abs frm @@ -327,14 +327,14 @@ s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq) return 0; } -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer) +s32 CALLBACK CDVDgetTN(cdvdTN *Buffer) { Buffer->strack=strack; Buffer->etrack=etrack; return 0; } -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer) +s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer) { if(Track==0) { @@ -353,14 +353,14 @@ s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer) u32 layer1start=-1; -s32 CALLBACK CDVDgetTOC(u8* tocBuff) +s32 CALLBACK CDVDgetTOC(u8* tocBuff) { //return src->ReadTOC((char*)toc,2048); //that didn't work too well... if(curDiskType==CDVD_TYPE_NODISC) return -1; - + if((curDiskType == CDVD_TYPE_DVDV) || (curDiskType == CDVD_TYPE_PS2DVD)) { @@ -450,16 +450,16 @@ s32 CALLBACK CDVDgetTOC(u8* tocBuff) 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; #define itob(n) ((((n)/10)<<4)+((n)%10)) - + //Number of FirstTrack tocBuff[2] = 0xA0; tocBuff[7] = itob(diskInfo.strack); - + //Number of LastTrack tocBuff[12] = 0xA1; tocBuff[17] = itob(diskInfo.etrack); @@ -472,7 +472,7 @@ s32 CALLBACK CDVDgetTOC(u8* tocBuff) tocBuff[29] = itob(frm); fprintf(stderr,"Track 0: %d mins %d secs %d frames\n",min,sec,frm); - + for (i=diskInfo.strack; i<=diskInfo.etrack; i++) { err = CDVDgetTD(i, &trackInfo); @@ -487,27 +487,27 @@ s32 CALLBACK CDVDgetTOC(u8* tocBuff) } else return -1; - + return 0; } -s32 CALLBACK CDVDgetDiskType() +s32 CALLBACK CDVDgetDiskType() { return curDiskType; } -s32 CALLBACK CDVDgetTrayStatus() +s32 CALLBACK CDVDgetTrayStatus() { return curTrayStatus; } -s32 CALLBACK CDVDctrlTrayOpen() +s32 CALLBACK CDVDctrlTrayOpen() { curTrayStatus=CDVD_TRAY_OPEN; return 0; } -s32 CALLBACK CDVDctrlTrayClose() +s32 CALLBACK CDVDctrlTrayClose() { curTrayStatus=CDVD_TRAY_CLOSE; return 0; @@ -519,7 +519,7 @@ void CALLBACK CDVDnewDiskCB(void (*callback)()) } void configure(); -void CALLBACK CDVDconfigure() +void CALLBACK CDVDconfigure() { configure(); } diff --git a/plugins/cdvdGigaherz/src/CDVD.h b/plugins/cdvdGigaherz/src/CDVD.h index 4dbb24483b..10bbebd7de 100644 --- a/plugins/cdvdGigaherz/src/CDVD.h +++ b/plugins/cdvdGigaherz/src/CDVD.h @@ -32,7 +32,7 @@ typedef struct _toc_entry { UCHAR Msf[3]; } toc_entry; -typedef struct _toc_data +typedef struct _toc_data { UCHAR Length[2]; UCHAR FirstCompleteSession; diff --git a/plugins/cdvdGigaherz/src/ReadThread.cpp b/plugins/cdvdGigaherz/src/ReadThread.cpp index 5a55aca0af..f063dc4fd4 100644 --- a/plugins/cdvdGigaherz/src/ReadThread.cpp +++ b/plugins/cdvdGigaherz/src/ReadThread.cpp @@ -21,7 +21,7 @@ enum loadStatus LoadSuccess, }; -typedef struct +typedef struct { int lsn; int mode; @@ -120,7 +120,7 @@ bool cdvdUpdateDiscStatus() return true; } } - + if(change==1) { if(!disc_has_changed) @@ -275,7 +275,7 @@ void cdvdStopThread() CloseHandle(hThread); CloseHandle(hNotify); CloseHandle(hRequestComplete); - + DeleteCriticalSection( &CacheMutex ); } @@ -377,23 +377,23 @@ s32 cdvdDirectReadSector(s32 first, s32 mode, char *buffer) if(mode==CDVD_MODE_2048) { offset = 2048*(first-sector); - memcpy(buffer,data + offset,2048); + memcpy(buffer,data + offset,2048); return 0; } - + offset = 2352*(first-sector); s8* bfr = data + offset; switch(mode) { case CDVD_MODE_2328: - memcpy(buffer,bfr+24,2328); + memcpy(buffer,bfr+24,2328); return 0; case CDVD_MODE_2340: - memcpy(buffer,bfr+12,2340); + memcpy(buffer,bfr+12,2340); return 0; default: - memcpy(buffer,bfr+12,2352); + memcpy(buffer,bfr+12,2352); return 0; } return 0; @@ -425,7 +425,7 @@ s32 cdvdRefreshData() else if(mt == 0) curDiskType = CDVD_TYPE_DETCTDVDS; else curDiskType = CDVD_TYPE_DETCTDVDD; } - + curTrayStatus = CDVD_TRAY_CLOSE; switch(curDiskType) diff --git a/plugins/cdvdGigaherz/src/TocStuff.cpp b/plugins/cdvdGigaherz/src/TocStuff.cpp index 1a67c6b316..67698e8782 100644 --- a/plugins/cdvdGigaherz/src/TocStuff.cpp +++ b/plugins/cdvdGigaherz/src/TocStuff.cpp @@ -39,7 +39,7 @@ s32 cdvdParseTOC() strack=1; etrack=2; } - else + else { tracks[1].length=tracks[0].length; tracks[1].type=0; @@ -144,6 +144,6 @@ s32 cdvdParseTOC() tracks[etrack].length = tracks[0].length - tracks[etrack].start_lba; } - + return 0; } diff --git a/plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp b/plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp index 4e42371ad1..0b686e21b1 100644 --- a/plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp +++ b/plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp @@ -51,7 +51,7 @@ DWORD SendIoCtlScsiCommand(HANDLE hDevice, u8 direction, pSA=(PSCSI_ADDRESS)szBuf; pSA->Length=sizeof(SCSI_ADDRESS); - + if(!DeviceIoControl(hDevice,IOCTL_SCSI_GET_ADDRESS,NULL, 0,pSA,sizeof(SCSI_ADDRESS), &dwRet,NULL)) diff --git a/plugins/cdvdGigaherz/src/Windows/PlainIso.cpp b/plugins/cdvdGigaherz/src/Windows/PlainIso.cpp index 3870f1e132..a6e7151b04 100644 --- a/plugins/cdvdGigaherz/src/Windows/PlainIso.cpp +++ b/plugins/cdvdGigaherz/src/Windows/PlainIso.cpp @@ -172,7 +172,7 @@ s32 PlainIso::ReadSectors2048(u32 sector, u32 count, char *buffer) LARGE_INTEGER Offset; if(!OpenOK) return -1; - + Offset.QuadPart=sector*(u64)2048; //fall back to standard reading @@ -260,4 +260,4 @@ Reader* PlainIso::TryLoad(const char* fName) return NULL; return new PlainIso(fName); -} \ No newline at end of file +} diff --git a/plugins/cdvdGigaherz/src/Windows/config.cpp b/plugins/cdvdGigaherz/src/Windows/config.cpp index 1a7ec95435..69b6c7c8cf 100644 --- a/plugins/cdvdGigaherz/src/Windows/config.cpp +++ b/plugins/cdvdGigaherz/src/Windows/config.cpp @@ -102,7 +102,7 @@ int CfgReadInt(char *Section, char*Name,int Default) { CfgWriteInt(Section,Name,Default); return Default; } - + return atoi(Data); } @@ -110,8 +110,8 @@ void CfgReadStr(char *Section, char*Name,char *Data,int DataSize,char *Default) int sl; GetPrivateProfileString(Section,Name,"",Data,DataSize,CfgFile); - if(strlen(Data)==0) { - sl=(int)strlen(Default); + if(strlen(Data)==0) { + sl=(int)strlen(Default); strncpy(Data,Default,sl>255?255:sl); CfgWriteStr(Section,Name,Data); } @@ -172,7 +172,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) n=0;s=0; - SendMessage(GetDlgItem(hWnd,IDC_DRIVE),CB_RESETCONTENT,0,0); + SendMessage(GetDlgItem(hWnd,IDC_DRIVE),CB_RESETCONTENT,0,0); SendMessage(GetDlgItem(hWnd,IDC_DRIVE),CB_ADDSTRING,0,(LPARAM)"@ (No disc)"); for(char d='A';d<='Z';d++) { @@ -189,12 +189,12 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) } } - SendMessage(GetDlgItem(hWnd,IDC_DRIVE),CB_SETCURSEL,s,0); + SendMessage(GetDlgItem(hWnd,IDC_DRIVE),CB_SETCURSEL,s,0); break; case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { @@ -219,7 +219,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) } return TRUE; } - + void configure() { INT_PTR ret; diff --git a/plugins/cdvdGigaherz/src/Windows/resource.h b/plugins/cdvdGigaherz/src/Windows/resource.h index f07e165c5c..30e178c529 100644 --- a/plugins/cdvdGigaherz/src/Windows/resource.h +++ b/plugins/cdvdGigaherz/src/Windows/resource.h @@ -26,7 +26,7 @@ #define IDC_DUMP_BDV2 1022 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 102 diff --git a/plugins/dev9null/Config.cpp b/plugins/dev9null/Config.cpp index f86b41ecd9..59c78ef9fe 100644 --- a/plugins/dev9null/Config.cpp +++ b/plugins/dev9null/Config.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include using namespace std; @@ -40,19 +40,19 @@ void setLoggingState() } } -EXPORT_C_(void) DEV9about() +EXPORT_C_(void) DEV9about() { SysMessage("Dev9null: A simple null plugin."); } -EXPORT_C_(void) DEV9configure() +EXPORT_C_(void) DEV9configure() { LoadConfig(); PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log); SaveConfig(); -} +} -void LoadConfig() +void LoadConfig() { string IniPath = s_strIniPath + "/Dev9null.ini"; if (!Ini.Open(IniPath, READ_FILE)) @@ -61,12 +61,12 @@ void LoadConfig() SaveConfig(); return; } - + conf.Log = Ini.ReadInt("logging",0); Ini.Close(); } -void SaveConfig() +void SaveConfig() { string IniPath = s_strIniPath + "/Dev9null.ini"; if (!Ini.Open(IniPath, WRITE_FILE)) @@ -74,7 +74,7 @@ void SaveConfig() Dev9Log.WriteLn("Failed to open %s", IniPath.c_str()); return; } - + Ini.WriteInt("logging", conf.Log); Ini.Close(); } diff --git a/plugins/dev9null/DEV9.cpp b/plugins/dev9null/DEV9.cpp index fc44a5b244..87734eeaed 100644 --- a/plugins/dev9null/DEV9.cpp +++ b/plugins/dev9null/DEV9.cpp @@ -1,6 +1,6 @@ /* DEV9null * Copyright (C) 2002-2010 PCSX2 Dev Team - * + * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -17,7 +17,7 @@ // The ones I included were just some of the more important ones, so you may want to look // at the plugins I mentioned if trying to create your own dev9 plugin. -// Additionally, there is a lot of information in the ps2drv drivers by Marcus R. Brown, so +// Additionally, there is a lot of information in the ps2drv drivers by Marcus R. Brown, so // looking through its code would be a good starting point. // Look under tags/plugins in svn for any older plugins that aren't included in pcsx2 any more. @@ -47,26 +47,26 @@ string s_strIniPath = "inis/"; PluginLog Dev9Log; Config conf; -EXPORT_C_(u32) PS2EgetLibType() +EXPORT_C_(u32) PS2EgetLibType() { return PS2E_LT_DEV9; } -EXPORT_C_(char*) PS2EgetLibName() +EXPORT_C_(char*) PS2EgetLibName() { return (char *)libraryName; } -EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) +EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) { return (version<<16) | (revision<<8) | build; } -EXPORT_C_(s32) DEV9init() -{ +EXPORT_C_(s32) DEV9init() +{ LoadConfig(); setLoggingState(); - + Dev9Log.Open("logs/dev9null.log"); Dev9Log.WriteLn("dev9null plugin version %d,%d", revision, build); Dev9Log.WriteLn("Initializing dev9null"); @@ -75,7 +75,7 @@ EXPORT_C_(s32) DEV9init() return 0; } -EXPORT_C_(void) DEV9shutdown() +EXPORT_C_(void) DEV9shutdown() { Dev9Log.WriteLn("Shutting down Dev9null."); Dev9Log.Close(); @@ -89,38 +89,38 @@ EXPORT_C_(s32) DEV9open(void *pDsp) return 0; } -EXPORT_C_(void) DEV9close() +EXPORT_C_(void) DEV9close() { Dev9Log.WriteLn("Closing Dev9null."); // Close files opened. } -EXPORT_C_(u8) DEV9read8(u32 addr) +EXPORT_C_(u8) DEV9read8(u32 addr) { u8 value = 0; - + switch(addr) { // case 0x1F80146E: // DEV9 hardware type (0x32 for an expansion bay) case 0x10000038: /*value = dev9Ru8(addr);*/ break; // We need to have at least one case to avoid warnings. - default: - //value = dev9Ru8(addr); + default: + //value = dev9Ru8(addr); Dev9Log.WriteLn("*Unknown 8 bit read at address %lx", addr); break; } return value; } -EXPORT_C_(u16) DEV9read16(u32 addr) +EXPORT_C_(u16) DEV9read16(u32 addr) { u16 value = 0; - + switch(addr) { // Addresses you may want to catch here include: // case 0x1F80146E: // DEV9 hardware type (0x32 for an expansion bay) // case 0x10000002: // The Smart Chip revision. Should be 0x11 -// case 0x10000004: // More type info: bit 0 - smap; bit 1 - hd; bit 5 - flash +// case 0x10000004: // More type info: bit 0 - smap; bit 1 - hd; bit 5 - flash // case 0x1000000E: // Similar to the last; bit 1 should be set if a hd is hooked up. // case 0x10000028: // intr_stat // case 0x10000038: // hard drives seem to like reading and writing the max dma size per transfer here. @@ -135,63 +135,63 @@ EXPORT_C_(u16) DEV9read16(u32 addr) // case 0x1000005C: // status // case 0x10000064: // if_ctrl case 0x10000038: /*value = dev9Ru16(addr);*/ break; - default: - //value = dev9Ru16(addr); + default: + //value = dev9Ru16(addr); Dev9Log.WriteLn("*Unknown 16 bit read at address %lx", addr); break; } - + return value; } -EXPORT_C_(u32 ) DEV9read32(u32 addr) +EXPORT_C_(u32 ) DEV9read32(u32 addr) { u32 value = 0; - + switch(addr) { case 0x10000038: /*value = dev9Ru32(addr);*/ break; - default: - //value = dev9Ru32(addr); + default: + //value = dev9Ru32(addr); Dev9Log.WriteLn("*Unknown 32 bit read at address %lx", addr); break; } - + return value; } -EXPORT_C_(void) DEV9write8(u32 addr, u8 value) +EXPORT_C_(void) DEV9write8(u32 addr, u8 value) { switch(addr) { case 0x10000038: /*dev9Ru8(addr) = value;*/ break; - default: + default: Dev9Log.WriteLn("*Unknown 8 bit write; address %lx = %x", addr, value); //dev9Ru8(addr) = value; break; } } -EXPORT_C_(void) DEV9write16(u32 addr, u16 value) +EXPORT_C_(void) DEV9write16(u32 addr, u16 value) { switch(addr) { // Remember that list on DEV9read16? You'll want to write to a // lot of them, too. case 0x10000038: /*dev9Ru16(addr) = value;*/ break; - default: + default: Dev9Log.WriteLn("*Unknown 16 bit write; address %lx = %x", addr, value); //dev9Ru16(addr) = value; break; } } -EXPORT_C_(void) DEV9write32(u32 addr, u32 value) +EXPORT_C_(void) DEV9write32(u32 addr, u32 value) { switch(addr) { case 0x10000038: /*dev9Ru32(addr) = value;*/ break; - default: + default: Dev9Log.WriteLn("*Unknown 32 bit write; address %lx = %x", addr, value); //dev9Ru32(addr) = value; break; @@ -221,21 +221,21 @@ EXPORT_C_(void) DEV9dmaInterrupt(s32 channel) // See above. } //#else -EXPORT_C_(void) DEV9readDMA8Mem(u32 *pMem, int size) +EXPORT_C_(void) DEV9readDMA8Mem(u32 *pMem, int size) { // You'll want to put your own DMA8 reading code here. // Time to interact with your fake (or real) hardware. Dev9Log.WriteLn("Reading DMA8 Mem."); } -EXPORT_C_(void) DEV9writeDMA8Mem(u32* pMem, int size) +EXPORT_C_(void) DEV9writeDMA8Mem(u32* pMem, int size) { // See above. Dev9Log.WriteLn("Writing DMA8 Mem."); } //#endif -EXPORT_C_(void) DEV9irqCallback(DEV9callback callback) +EXPORT_C_(void) DEV9irqCallback(DEV9callback callback) { // Setting our callback. You will call it with DEV9irq(cycles), // Where cycles is the number of cycles till the irq is triggered. @@ -248,7 +248,7 @@ int _DEV9irqHandler(void) return 0; } -EXPORT_C_(DEV9handler) DEV9irqHandler(void) +EXPORT_C_(DEV9handler) DEV9irqHandler(void) { // Pass it to pcsx2. return (DEV9handler)_DEV9irqHandler; @@ -262,14 +262,14 @@ EXPORT_C_(void) DEV9setSettingsDir(const char* dir) // extended funcs -EXPORT_C_(s32) DEV9test() +EXPORT_C_(s32) DEV9test() { return 0; } EXPORT_C_(s32) DEV9freeze(int mode, freezeData *data) { - // This should store or retrieve any information, for if emulation + // This should store or retrieve any information, for if emulation // gets suspended, or for savestates. switch(mode) { diff --git a/plugins/onepad/Linux/gui.cpp b/plugins/onepad/Linux/gui.cpp index 2bf0263ce0..c37b81ee86 100644 --- a/plugins/onepad/Linux/gui.cpp +++ b/plugins/onepad/Linux/gui.cpp @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include #include #include @@ -40,7 +40,7 @@ GtkWidget *Conf, *About, *MsgDlg; GtkWidget *s_devicecombo; GtkTreeStore *treestore; -GtkTreeModel *model; +GtkTreeModel *model; bool has_columns = false; @@ -48,7 +48,7 @@ extern string KeyName(int pad, int key); extern const char* s_pGuiKeyMap[]; extern void UpdateConf(int pad); -enum +enum { COL_PAD = 0, COL_BUTTON, @@ -61,9 +61,9 @@ enum void populate_tree_view() { GtkTreeIter toplevel; - + gtk_tree_store_clear(treestore); - + for (int pad = 0; pad < 2 * MAX_SUB_KEYS; pad++) { for (int key = 0; key < MAX_KEYS; key++) @@ -79,15 +79,15 @@ void populate_tree_view() -1); } } - } + } } void create_a_column(GtkWidget *view, const char *name, int num, bool visible) { GtkCellRenderer *renderer; - GtkTreeViewColumn *col; - - col = gtk_tree_view_column_new(); + GtkTreeViewColumn *col; + + col = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(col, name); /* pack tree view column into tree view */ @@ -118,10 +118,10 @@ void create_columns(GtkWidget *view) void init_tree_view() { - GtkWidget *view; + GtkWidget *view; view = lookup_widget(Conf,"padtreeview"); - + treestore = gtk_tree_store_new(NUM_COLS, G_TYPE_UINT, G_TYPE_STRING, @@ -130,7 +130,7 @@ void init_tree_view() populate_tree_view(); create_columns(view); - + model = GTK_TREE_MODEL(treestore); gtk_tree_view_set_model(GTK_TREE_VIEW(view), model); @@ -188,55 +188,55 @@ void on_joydevicescombo_changed(GtkComboBox *combobox, gpointer user_data) void on_checkbutton_reverselx_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTLX << (16 * s_selectedpad); - + if (gtk_toggle_button_get_active(togglebutton)) conf.options |= mask; - else + else conf.options &= ~mask; } void on_checkbutton_reversely_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTLY << (16 * s_selectedpad); - + if (gtk_toggle_button_get_active(togglebutton)) conf.options |= mask; - else + else conf.options &= ~mask; } void on_checkbutton_reverserx_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTRX << (16 * s_selectedpad); - if (gtk_toggle_button_get_active(togglebutton)) + if (gtk_toggle_button_get_active(togglebutton)) conf.options |= mask; - else + else conf.options &= ~mask; } void on_checkbutton_reversery_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTRY << (16 * s_selectedpad); - - if (gtk_toggle_button_get_active(togglebutton)) + + if (gtk_toggle_button_get_active(togglebutton)) conf.options |= mask; - else + else conf.options &= ~mask; } void on_forcefeedback_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTLX << (16 * s_selectedpad); - + if (gtk_toggle_button_get_active(togglebutton)) { conf.options |= mask; int joyid = gtk_combo_box_get_active(GTK_COMBO_BOX(s_devicecombo)); - + if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) s_vjoysticks[joyid]->TestForce(); } - else + else { conf.options &= ~mask; } @@ -294,7 +294,7 @@ void on_Remove(GtkButton *button, gpointer user_data) { GtkTreeSelection *selection; GtkTreeIter iter; - GtkWidget *view; + GtkWidget *view; view = lookup_widget(Conf,"padtreeview"); diff --git a/plugins/onepad/Linux/ini.cpp b/plugins/onepad/Linux/ini.cpp index 923cefd713..6b381134b3 100644 --- a/plugins/onepad/Linux/ini.cpp +++ b/plugins/onepad/Linux/ini.cpp @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include #include #include @@ -39,7 +39,7 @@ string KeyName(int pad, int key) { string tmp; KeyType k = type_of_key(pad, key); - + switch (k) { case PAD_KEYBOARD: @@ -52,7 +52,7 @@ string KeyName(int pad, int key) { int button = key_to_button(pad, key); tmp.resize(28); - + sprintf(&tmp[0], "JBut %d", button); break; } @@ -60,7 +60,7 @@ string KeyName(int pad, int key) { int axis = key_to_axis(pad, key); tmp.resize(28); - + sprintf(&tmp[0], "JAxis %d", axis); break; } @@ -68,21 +68,21 @@ string KeyName(int pad, int key) { int axis = key_to_axis(pad, key); tmp.resize(28); - + switch(key_to_hat_dir(pad, key)) { case SDL_HAT_UP: sprintf(&tmp[0], "JPOVU-%d", axis); break; - + case SDL_HAT_RIGHT: sprintf(&tmp[0], "JPOVR-%d", axis); break; - + case SDL_HAT_DOWN: sprintf(&tmp[0], "JPOVD-%d", axis); break; - + case SDL_HAT_LEFT: sprintf(&tmp[0], "JPOVL-%d", axis); break; @@ -148,7 +148,7 @@ void LoadConfig() FILE *f; char str[256]; char cfg[255]; - + memset(&conf, 0, sizeof(conf)); DefaultValues(); conf.log = 0; @@ -168,7 +168,7 @@ void LoadConfig() { sprintf(str, "[%d][%d] = 0x%%x\n", pad, key); u32 temp; - + if (fscanf(f, str, &temp) == 0) temp = 0; set_key(pad, key, temp); } @@ -176,4 +176,4 @@ void LoadConfig() fscanf(f, "log = %d\n", &conf.log); fscanf(f, "options = %d\n", &conf.options); fclose(f); -} \ No newline at end of file +} diff --git a/plugins/onepad/Linux/linux.cpp b/plugins/onepad/Linux/linux.cpp index a86a71ab90..789f7632b4 100644 --- a/plugins/onepad/Linux/linux.cpp +++ b/plugins/onepad/Linux/linux.cpp @@ -24,8 +24,8 @@ Display *GSdsp; -const char* s_pGuiKeyMap[] = -{ +const char* s_pGuiKeyMap[] = +{ "L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square", "Select", "L3", "R3", "Start", @@ -40,7 +40,7 @@ extern string KeyName(int pad, int key); s32 _PADopen(void *pDsp) { GtkScrolledWindow *win; - + win = *(GtkScrolledWindow**) pDsp; PAD_LOG("It is a '%s'", GTK_OBJECT_TYPE_NAME(&win)); @@ -48,7 +48,7 @@ s32 _PADopen(void *pDsp) { // Since we have a GtkScrolledWindow, for now we'll grab whatever display // comes along instead. Later, we can fiddle with this, but I'm not sure the - // best way to get a Display* out of a GtkScrolledWindow. A GtkWindow I might + // best way to get a Display* out of a GtkScrolledWindow. A GtkWindow I might // be able to manage... --arcum42 GSdsp = GDK_DISPLAY(); } @@ -56,7 +56,7 @@ s32 _PADopen(void *pDsp) { GSdsp = *(Display**)pDsp; } - + SetAutoRepeat(false); return 0; } @@ -66,14 +66,14 @@ void _PADclose() SetAutoRepeat(true); vector::iterator it = s_vjoysticks.begin(); - + // Delete everything in the vector vjoysticks. while (it != s_vjoysticks.end()) { delete *it; it ++; } - + s_vjoysticks.clear(); } @@ -81,13 +81,13 @@ int _GetJoystickIdFromPAD(int pad) { // select the right joystick id u32 joyid = -1; - + for (int p = 0; p < MAX_SUB_KEYS; p++) { for (int i = 0; i < MAX_KEYS; ++i) { KeyType k = type_of_key(PadEnum[pad][p],i); - + if (k == PAD_JOYSTICK || k == PAD_JOYBUTTONS) { joyid = key_to_joystick_id(PadEnum[pad][p],i); @@ -95,7 +95,7 @@ int _GetJoystickIdFromPAD(int pad) } } } - + if (!JoystickIdWithinBounds(joyid)) { // get first unused joystick @@ -104,7 +104,7 @@ int _GetJoystickIdFromPAD(int pad) if (s_vjoysticks[joyid]->GetPAD() < 0) break; } } - + return joyid; } @@ -115,22 +115,22 @@ EXPORT_C_(void) PADupdate(int pad) // joystick info SDL_JoystickUpdate(); - + for (int i = 0; i < MAX_KEYS; i++) { int cpad = PadEnum[pad][0]; - + if (JoystickIdWithinBounds(key_to_joystick_id(cpad, i))) - { + { JoystickInfo* pjoy = s_vjoysticks[key_to_joystick_id(cpad, i)]; int pad = (pjoy)->GetPAD(); - + switch (type_of_key(cpad, i)) { case PAD_JOYBUTTONS: { int value = SDL_JoystickGetButton((pjoy)->GetJoy(), key_to_button(cpad, i)); - + if (value) clear_bit(status[pad], i); // released else @@ -140,7 +140,7 @@ EXPORT_C_(void) PADupdate(int pad) case PAD_HAT: { int value = SDL_JoystickGetHat((pjoy)->GetJoy(), key_to_axis(cpad, i)); - + if (key_to_hat_dir(cpad, i) == value) { clear_bit(status[pad], i); @@ -156,7 +156,7 @@ EXPORT_C_(void) PADupdate(int pad) case PAD_POV: { int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), key_to_axis(cpad, i)); - + PAD_LOG("%s: %d (%d)\n", KeyName(cpad, i).c_str(), value, key_to_pov_sign(cpad, i)); if (key_to_pov_sign(cpad, i) && (value < -2048)) { @@ -178,7 +178,7 @@ EXPORT_C_(void) PADupdate(int pad) case PAD_JOYSTICK: { int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), key_to_axis(cpad, i)); - + switch (i) { case PAD_LX: @@ -187,7 +187,7 @@ EXPORT_C_(void) PADupdate(int pad) case PAD_RY: if (abs(value) > (pjoy)->GetDeadzone(value)) Analog::ConfigurePad(pad, i, value); - else + else Analog::ResetPad(pad, i); break; } @@ -226,11 +226,11 @@ void UpdateConf(int pad) if (JoystickIdWithinBounds(joyid)) gtk_combo_box_set_active(GTK_COMBO_BOX(s_devicecombo), joyid); // select the combo - else + else gtk_combo_box_set_active(GTK_COMBO_BOX(s_devicecombo), s_vjoysticks.size()); // no gamepad int padopts = conf.options >> (16 * pad); - + set_checked(Conf, "checkbutton_reverselx", padopts & PADOPTION_REVERTLX); set_checked(Conf, "checkbutton_reversely", padopts & PADOPTION_REVERTLY); set_checked(Conf, "checkbutton_reverserx", padopts & PADOPTION_REVERTRX); @@ -246,31 +246,31 @@ int GetLabelId(GtkWidget *label) return -1; } - return (int)(uptr)gtk_object_get_user_data(GTK_OBJECT(label)); + return (int)(uptr)gtk_object_get_user_data(GTK_OBJECT(label)); } void OnConf_Key(GtkButton *button, gpointer user_data) { bool captured = false; - + const char* buttonname = gtk_widget_get_name(GTK_WIDGET(button)); GtkWidget* label = lookup_widget(Conf, buttonname); - + int id = GetLabelId(label); - + if (id == -1) return; - + int pad = id / MAX_KEYS; int key = id % MAX_KEYS; // save the joystick states UpdateJoysticks(); - + while (!captured) { vector::iterator itjoy; char *tmp; - + u32 pkey = get_key(pad, key); if (PollX11Keyboard(tmp, pkey)) { @@ -279,14 +279,14 @@ void OnConf_Key(GtkButton *button, gpointer user_data) captured = true; break; } - + SDL_JoystickUpdate(); - + itjoy = s_vjoysticks.begin(); while ((itjoy != s_vjoysticks.end()) && (!captured)) { int button_id, direction; - + pkey = get_key(pad, key); if ((*itjoy)->PollButtons(button_id, pkey)) { @@ -298,9 +298,9 @@ void OnConf_Key(GtkButton *button, gpointer user_data) bool sign = false; bool pov = (!((key == PAD_RY) || (key == PAD_LY) || (key == PAD_RX) || (key == PAD_LX))); - + int axis_id; - + if (pov) { if ((*itjoy)->PollPOV(axis_id, sign, pkey)) @@ -321,7 +321,7 @@ void OnConf_Key(GtkButton *button, gpointer user_data) break; } } - + if ((*itjoy)->PollHats(axis_id, direction, pkey)) { set_key(pad, key, pkey); @@ -332,7 +332,7 @@ void OnConf_Key(GtkButton *button, gpointer user_data) itjoy++; } } - + init_tree_view(); } @@ -355,7 +355,7 @@ EXPORT_C_(void) PADconfigure() // fill the combo char str[255]; vector::iterator it = s_vjoysticks.begin(); - + // Delete everything in the vector vjoysticks. while (it != s_vjoysticks.end()) { @@ -364,7 +364,7 @@ EXPORT_C_(void) PADconfigure() gtk_combo_box_append_text(GTK_COMBO_BOX(s_devicecombo), str); it++; } - + gtk_combo_box_append_text(GTK_COMBO_BOX(s_devicecombo), "No Gamepad"); UpdateConf(0); diff --git a/plugins/onepad/Linux/linux.h b/plugins/onepad/Linux/linux.h index da9642eb6a..8e1017014f 100644 --- a/plugins/onepad/Linux/linux.h +++ b/plugins/onepad/Linux/linux.h @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "joystick.h" #include "keyboard.h" #include "onepad.h" diff --git a/plugins/onepad/analog.cpp b/plugins/onepad/analog.cpp index 2c849eaafb..f1bc460167 100644 --- a/plugins/onepad/analog.cpp +++ b/plugins/onepad/analog.cpp @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "analog.h" PADAnalog g_lanalog[NUM_OF_PADS], g_ranalog[NUM_OF_PADS]; @@ -31,25 +31,25 @@ namespace Analog case PAD_LX: return g_lanalog[pad].x; break; - + case PAD_RX: return g_ranalog[pad].x; break; - + case PAD_LY: return g_lanalog[pad].y; break; - + case PAD_RY: return g_ranalog[pad].y; break; - + default: return 0; break; } } - + void SetPad(u8 pad, int index, u8 value) { switch (index) @@ -57,34 +57,34 @@ namespace Analog case PAD_LX: g_lanalog[pad].x = value; break; - + case PAD_RX: g_ranalog[ pad].x = value; break; - + case PAD_LY: g_lanalog[ pad].y = value; break; - + case PAD_RY: g_ranalog[pad].y = value; break; - + default: break; } } - + void InvertPad(u8 pad, int key) { SetPad(pad, key, -Pad(pad, key)); } - + void ResetPad( u8 pad, int key) { SetPad(pad, key, 0x80); } - + void Init() { for (u8 pad = 0; pad < 2; ++pad) @@ -95,7 +95,7 @@ namespace Analog ResetPad(pad, PAD_RY); } } - + bool RevertPad(u8 index) { switch (index) @@ -103,25 +103,25 @@ namespace Analog case PAD_LX: return ((conf.options & PADOPTION_REVERTLX) != 0); break; - + case PAD_RX: return ((conf.options & PADOPTION_REVERTRX) != 0); break; - + case PAD_LY: return ((conf.options & PADOPTION_REVERTLY) != 0); break; - + case PAD_RY: return ((conf.options & PADOPTION_REVERTRY) != 0); break; - + default: return false; break; } } - + void ConfigurePad( u8 pad, int index, int value) { Pad(pad, index); @@ -129,7 +129,7 @@ namespace Analog if (RevertPad(index)) InvertPad(pad,index); SetPad(pad, index, Pad(pad, index) + 0x80); } - + int AnalogToPad(int index) { switch (index) diff --git a/plugins/onepad/analog.h b/plugins/onepad/analog.h index ab3053ec14..ec6756c2a6 100644 --- a/plugins/onepad/analog.h +++ b/plugins/onepad/analog.h @@ -18,9 +18,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #define NUM_OF_PADS 2 - + #include "onepad.h" namespace Analog { @@ -33,4 +33,4 @@ extern void ConfigurePad( u8 pad, int index, int value); extern int KeypadToPad(u8 keypress); extern int AnalogToPad(int index); -} \ No newline at end of file +} diff --git a/plugins/onepad/bitwise.h b/plugins/onepad/bitwise.h index 02cfa8a058..3518e1d678 100644 --- a/plugins/onepad/bitwise.h +++ b/plugins/onepad/bitwise.h @@ -18,27 +18,27 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + template static void __forceinline set_bit(T &value, int bit) { value |= (1 << bit); } - + template static void __forceinline clear_bit(T &value, int bit) { value &= ~(1 << bit); } - + template static void __forceinline toggle_bit(T &value, int bit) { value ^= (1 << bit); } - + template static bool __forceinline test_bit(T &value, int bit) { return (value & (1 << bit)); - } \ No newline at end of file + } diff --git a/plugins/onepad/controller.cpp b/plugins/onepad/controller.cpp index 709edb9c87..cc1ebc6189 100644 --- a/plugins/onepad/controller.cpp +++ b/plugins/onepad/controller.cpp @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "onepad.h" #include "controller.h" @@ -37,7 +37,7 @@ __forceinline int get_key(int pad, int index) __forceinline KeyType type_of_key(int pad, int index) { int key = conf.keys[pad][index]; - + if (key < 0x10000) return PAD_KEYBOARD; else if (key >= 0x10000 && key < 0x20000) return PAD_JOYBUTTONS; else if (key >= 0x20000 && key < 0x30000) return PAD_JOYSTICK; @@ -45,12 +45,12 @@ __forceinline KeyType type_of_key(int pad, int index) else if (key >= 0x40000 && key < 0x50000) return PAD_HAT; else return PAD_NULL; } - + __forceinline int pad_to_key(int pad, int index) { return ((conf.keys[pad][index]) & 0xffff); } - + __forceinline int key_to_joystick_id(int pad, int index) { return (((conf.keys[pad][index]) & 0xf000) >> 12); diff --git a/plugins/onepad/controller.h b/plugins/onepad/controller.h index 2950c763c3..069c4dc5d3 100644 --- a/plugins/onepad/controller.h +++ b/plugins/onepad/controller.h @@ -75,7 +75,7 @@ static __forceinline void set_hat_pins(int tilt_o_the_hat) hat_position.right = false; hat_position.up = false; hat_position.down = false; - + switch (tilt_o_the_hat) { case SDL_HAT_UP: diff --git a/plugins/onepad/joystick.cpp b/plugins/onepad/joystick.cpp index aa5e81eaba..3336f16697 100644 --- a/plugins/onepad/joystick.cpp +++ b/plugins/onepad/joystick.cpp @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "joystick.h" ////////////////////////// @@ -34,7 +34,7 @@ void UpdateJoysticks() vector::iterator itjoy = s_vjoysticks.begin(); SDL_JoystickUpdate(); - + // Save everything in the vector s_vjoysticks. while (itjoy != s_vjoysticks.end()) { @@ -58,7 +58,7 @@ const char *HatName(int value) case SDL_HAT_LEFTDOWN: return "SDL_HAT_LEFTDOWN"; default: return "Unknown"; } - + return "Unknown"; } @@ -76,18 +76,18 @@ void JoystickInfo::EnumerateJoysticks(vector& vjoysticks) SDL_JoystickEventState(SDL_QUERY); s_bSDLInit = true; } - + vector::iterator it = vjoysticks.begin(); - + // Delete everything in the vector vjoysticks. while (it != vjoysticks.end()) { delete *it; it ++; } - + vjoysticks.resize(SDL_NumJoysticks()); - + for (int i = 0; i < (int)vjoysticks.size(); ++i) { vjoysticks[i] = new JoystickInfo(); @@ -99,7 +99,7 @@ void JoystickInfo::EnumerateJoysticks(vector& vjoysticks) { // select the right joystick id int joyid = -1; - + for (int i = 0; i < MAX_KEYS; ++i) { KeyType k = type_of_key(pad,i); @@ -118,7 +118,7 @@ void JoystickInfo::EnumerateJoysticks(vector& vjoysticks) JoystickInfo::JoystickInfo() { joy = NULL; - + _id = -1; pad = -1; axisrange = 0x7fff; @@ -150,7 +150,7 @@ bool JoystickInfo::Init(int id, bool bStartThread) numbuttons = SDL_JoystickNumButtons(joy); numhats = SDL_JoystickNumHats(joy); devname = SDL_JoystickName(id); - + vaxisstate.resize(numaxes); vbuttonstate.resize(numbuttons); vhatstate.resize(numhats); @@ -170,7 +170,7 @@ void JoystickInfo::Assign(int newpad) for (int i = 0; i < MAX_KEYS; ++i) { KeyType k = type_of_key(pad,i); - + if (k == PAD_JOYBUTTONS) { set_key(pad, i, button_to_key(_id, key_to_button(pad,i))); @@ -203,7 +203,7 @@ bool JoystickInfo::PollButtons(int &jbutton, u32 &pkey) for (int i = 0; i < GetNumButtons(); ++i) { int but = SDL_JoystickGetButton(GetJoy(), i); - + if (but != GetButtonState(i)) { if (!but) // released, we don't really want this @@ -217,8 +217,8 @@ bool JoystickInfo::PollButtons(int &jbutton, u32 &pkey) return true; } } - - return false; + + return false; } bool JoystickInfo::PollPOV(int &axis_id, bool &sign, u32 &pkey) @@ -241,10 +241,10 @@ bool JoystickInfo::PollPOV(int &axis_id, bool &sign, u32 &pkey) if (abs(value) > 0x3fff) { axis_id = i; - + sign = (value < 0); pkey = pov_to_key(GetId(), sign, i); - + return true; } } @@ -273,7 +273,7 @@ bool JoystickInfo::PollAxes(int &axis_id, u32 &pkey) { axis_id = i; pkey = joystick_to_key(GetId(), i); - + return true; } } diff --git a/plugins/onepad/joystick.h b/plugins/onepad/joystick.h index 460a032bae..9d06ac316b 100644 --- a/plugins/onepad/joystick.h +++ b/plugins/onepad/joystick.h @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef __JOYSTICK_H__ #define __JOYSTICK_H__ @@ -51,84 +51,84 @@ class JoystickInfo void TestForce(); bool PollButtons(int &jbutton, u32 &pkey); - + bool PollAxes(int &axis_id, u32 &pkey); - + bool PollHats(int &jbutton, int &dir, u32 &pkey); - + bool PollPOV(int &axis_id, bool &sign, u32 &pkey); - + const string& GetName() { return devname; } - + int GetNumButtons() { return numbuttons; } - + int GetNumAxes() { return numaxes; } - + int GetNumHats() { return numhats; } - + int GetId() { return _id; } - + int GetPAD() { return pad; } - + int GetDeadzone(int axis) { return deadzone; } void SaveState(); - + int GetButtonState(int i) { return vbuttonstate[i]; } - + int GetAxisState(int i) { return vaxisstate[i]; } - + int GetHatState(int i) { //PAD_LOG("Getting POV State of %d.\n", i); set_hat_pins(vhatstate[i]); return vhatstate[i]; } - + void SetButtonState(int i, int state) { vbuttonstate[i] = state; } - + void SetAxisState(int i, int value) { vaxisstate[i] = value; } - + void SetHatState(int i, int value) { //PAD_LOG("We should set %d to %d.\n", i, value); set_hat_pins(i); vhatstate[i] = value; } - + SDL_Joystick* GetJoy() { return joy; diff --git a/plugins/onepad/onepad.cpp b/plugins/onepad/onepad.cpp index d01ba93dee..6e88dbf3b0 100644 --- a/plugins/onepad/onepad.cpp +++ b/plugins/onepad/onepad.cpp @@ -53,7 +53,7 @@ const u32 build = 1; // increase that with each version int PadEnum[2][2] = {{0, 2}, {1, 3}}; u32 pads = 0; -u8 stdpar[2][20] = { +u8 stdpar[2][20] = { {0xff, 0x5a, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, @@ -81,23 +81,23 @@ u8 unk4c[2][8] = { {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; -u8 unk4d[2][8] = { +u8 unk4d[2][8] = { {0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, {0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; -u8 cmd4f[2][8] = { +u8 cmd4f[2][8] = { {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a}, {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a} }; -u8 stdcfg[2][8] = { +u8 stdcfg[2][8] = { {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; // 2 & 3 = 0 -u8 stdmode[2][8] = { +u8 stdmode[2][8] = { {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; -u8 stdmodel[2][8] = { +u8 stdmodel[2][8] = { {0xff, 0x5a, 0x03, // 03 - dualshock2, 01 - dualshock @@ -106,7 +106,7 @@ u8 stdmodel[2][8] = { 0x02, 0x01, 0x00}, - {0xff, + {0xff, 0x5a, 0x03, // 03 - dualshock2, 01 - dualshock 0x02, // number of modes @@ -189,7 +189,7 @@ EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) return (version << 16) | (revision << 8) | build; } -void __Log(const char *fmt, ...) +void __Log(const char *fmt, ...) { va_list list; @@ -199,7 +199,7 @@ void __Log(const char *fmt, ...) va_end(list); } -void __LogToConsole(const char *fmt, ...) +void __LogToConsole(const char *fmt, ...) { va_list list; @@ -279,7 +279,7 @@ EXPORT_C_(s32) PADopen(void *pDsp) pthread_spin_init(&s_mutexStatus, PTHREAD_PROCESS_PRIVATE); s_keyPress[0] = s_keyPress[1] = 0; s_keyRelease[0] = s_keyRelease[1] = 0; - + #ifdef __LINUX__ JoystickInfo::EnumerateJoysticks(s_vjoysticks); #endif @@ -306,7 +306,7 @@ void UpdateKeys(int pad, int keyPress, int keyRelease) { pthread_spin_lock(&s_mutexStatus); s_keyPress[pad] |= keyPress; - s_keyPress[pad] &= ~keyRelease; + s_keyPress[pad] &= ~keyRelease; s_keyRelease[pad] |= keyRelease; s_keyRelease[pad] &= ~keyPress; pthread_spin_unlock(&s_mutexStatus); @@ -334,7 +334,7 @@ void PADsetMode(int pad, int mode) break; } break; - + case 1: // dualshock2 switch (mode) { @@ -353,7 +353,7 @@ void PADsetMode(int pad, int mode) EXPORT_C_(u8) PADstartPoll(int pad) { //PAD_LOG("PADstartPoll: %d\n", pad); - + curPad = pad - 1; curByte = 0; @@ -368,7 +368,7 @@ u8 _PADpoll(u8 value) if (curByte == 0) { curByte++; - + //PAD_LOG("PADpoll: cmd: %x\n", value); curCmd = value; @@ -394,47 +394,47 @@ u8 _PADpoll(u8 value) stdpar[curPad][5] = Analog::Pad(curPad, PAD_RY); stdpar[curPad][6] = Analog::Pad(curPad, PAD_LX); stdpar[curPad][7] = Analog::Pad(curPad, PAD_LY); - - if (padMode[curPad] == 1) + + if (padMode[curPad] == 1) cmdLen = 20; - else + else cmdLen = 4; - + button_check = stdpar[curPad][2] >> 4; switch (stdpar[curPad][3]) { case 0xBF: // X stdpar[curPad][14] = avg_pressure; break; - + case 0xDF: // Circle stdpar[curPad][13] = avg_pressure; break; - + case 0xEF: // Triangle stdpar[curPad][12] = avg_pressure; break; - + case 0x7F: // Square stdpar[curPad][15] = avg_pressure; break; - + case 0xFB: // L1 stdpar[curPad][16] = avg_pressure; break; - + case 0xF7: // R1 stdpar[curPad][17] = avg_pressure; break; - + case 0xFE: // L2 stdpar[curPad][18] = avg_pressure; break; - + case 0xFD: // R2 stdpar[curPad][19] = avg_pressure; break; - + default: stdpar[curPad][14] = 0x00; // Not pressed stdpar[curPad][13] = 0x00; // Not pressed @@ -451,19 +451,19 @@ u8 _PADpoll(u8 value) case 0xE: // UP stdpar[curPad][10] = avg_pressure; break; - + case 0xB: // DOWN stdpar[curPad][11] = avg_pressure; break; - + case 0x7: // LEFT stdpar[curPad][9] = avg_pressure; break; - + case 0xD: // RIGHT stdpar[curPad][8] = avg_pressure; break; - + default: stdpar[curPad][8] = 0x00; // Not pressed stdpar[curPad][9] = 0x00; // Not pressed @@ -479,7 +479,7 @@ u8 _PADpoll(u8 value) buf = stdcfg[curPad]; if (stdcfg[curPad][3] == 0xff) return 0xf3; - else + else return padID[curPad]; case CMD_SET_MODE_AND_LOCK: // SET_MODE_AND_LOCK @@ -595,7 +595,7 @@ u8 _PADpoll(u8 value) EXPORT_C_(u8) PADpoll(u8 value) { u8 ret; - + ret = _PADpoll(value); //PAD_LOG("PADpoll: %x (%d: %x)\n", value, curByte, ret); return ret; diff --git a/plugins/onepad/onepad.h b/plugins/onepad/onepad.h index bc00f5a180..24c91f1ca2 100644 --- a/plugins/onepad/onepad.h +++ b/plugins/onepad/onepad.h @@ -86,7 +86,7 @@ enum PadCommands CMD_SET_DS2_NATIVE_MODE = 0x4F // SET_DS2_NATIVE_MODE }; -enum gamePadValues +enum gamePadValues { PAD_R_LEFT = 27, PAD_R_DOWN = 26, diff --git a/plugins/spu2-x/src/3rdparty/liba52/bitstream.c b/plugins/spu2-x/src/3rdparty/liba52/bitstream.c index 013d8e0afc..b9d3efa241 100644 --- a/plugins/spu2-x/src/3rdparty/liba52/bitstream.c +++ b/plugins/spu2-x/src/3rdparty/liba52/bitstream.c @@ -88,7 +88,7 @@ int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits) 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/spu2-x/src/3rdparty/liba52/imdct.c b/plugins/spu2-x/src/3rdparty/liba52/imdct.c index 6148705460..29f788647c 100644 --- a/plugins/spu2-x/src/3rdparty/liba52/imdct.c +++ b/plugins/spu2-x/src/3rdparty/liba52/imdct.c @@ -247,7 +247,7 @@ void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias) 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; @@ -311,7 +311,7 @@ void a52_imdct_256(sample_t * data, sample_t * delay, sample_t bias) /* 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]) ; */ + /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */ t_r = post2[i].real; t_i = post2[i].imag; diff --git a/plugins/spu2-x/src/3rdparty/liba52/parse.c b/plugins/spu2-x/src/3rdparty/liba52/parse.c index 3626944f65..8be3039eb0 100644 --- a/plugins/spu2-x/src/3rdparty/liba52/parse.c +++ b/plugins/spu2-x/src/3rdparty/liba52/parse.c @@ -262,7 +262,7 @@ static int parse_exponents (a52_state_t * state, int expstr, int ngrps, case EXP_D15: *(dest++) = exponent; } - } + } return 0; } @@ -310,7 +310,7 @@ 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; @@ -640,7 +640,7 @@ int a52_block (a52_state_t * state) cplexpstr = bitstream_get (state, 2); for (i = 0; i < nfchans; i++) chexpstr[i] = bitstream_get (state, 2); - if (state->lfeon) + if (state->lfeon) lfeexpstr = bitstream_get (state, 1); for (i = 0; i < nfchans; i++) @@ -858,7 +858,7 @@ int a52_block (a52_state_t * state) if (blksw[i]) a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i, bias); - else + else a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i, bias); } else { @@ -887,7 +887,7 @@ int a52_block (a52_state_t * state) for (i = 0; i < nfchans; i++) a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i, state->bias); - else + else for (i = 0; i < nfchans; i++) a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i, state->bias); diff --git a/plugins/spu2-x/src/ADSR.cpp b/plugins/spu2-x/src/ADSR.cpp index a9bf88595e..c4eb4b00da 100644 --- a/plugins/spu2-x/src/ADSR.cpp +++ b/plugins/spu2-x/src/ADSR.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -79,7 +79,7 @@ bool V_ADSR::Calculate() if( Value < 0 ) { - // We hit the ceiling. + // We hit the ceiling. Phase++; Value = ADSR_MAX_VOL; } @@ -114,7 +114,7 @@ bool V_ADSR::Calculate() { u32 off = InvExpOffsets[(Value>>28)&7]; Value -= PsxRates[(SustainRate^0x7f)-0x1b+off+32]; - } + } else // linear Value -= PsxRates[(SustainRate^0x7f)-0xf+32]; @@ -123,7 +123,7 @@ bool V_ADSR::Calculate() Value = 0; Phase++; } - } + } else // increasing { if( (SustainMode&4) && (Value>=0x60000000) ) @@ -152,7 +152,7 @@ bool V_ADSR::Calculate() { u32 off=InvExpOffsets[(Value>>28)&7]; Value-=PsxRates[((ReleaseRate^0x1f)*4)-0x18+off+32]; - } + } else // linear { //Value-=PsxRates[((ReleaseRate^0x1f)*4)-0xc+32]; @@ -173,7 +173,7 @@ bool V_ADSR::Calculate() jNO_DEFAULT } - + // returns true if the voice is active, or false if it's stopping. return Phase != 6; } @@ -190,10 +190,10 @@ bool V_ADSR::Calculate() void V_VolumeSlide::Update() { if( !(Mode & VOLFLAG_SLIDE_ENABLE) ) return; - + // Volume slides use the same basic logic as ADSR, but simplified (single-stage // instead of multi-stage) - + if( Increment == 0x7f ) return; if (Mode & VOLFLAG_DECREMENT) diff --git a/plugins/spu2-x/src/Config.h b/plugins/spu2-x/src/Config.h index 441a0ff342..6edee2e9d6 100644 --- a/plugins/spu2-x/src/Config.h +++ b/plugins/spu2-x/src/Config.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms diff --git a/plugins/spu2-x/src/ConvertUTF.cpp b/plugins/spu2-x/src/ConvertUTF.cpp index 02a08906ae..fd5e089b93 100644 --- a/plugins/spu2-x/src/ConvertUTF.cpp +++ b/plugins/spu2-x/src/ConvertUTF.cpp @@ -1,8 +1,8 @@ /* * Copyright 2001-2004 Unicode, Inc. - * + * * Disclaimer - * + * * This source code is provided as is by Unicode, Inc. No claims are * made as to fitness for any particular purpose. No warranties of any * kind are expressed or implied. The recipient agrees to determine @@ -10,9 +10,9 @@ * purchased on magnetic or optical media from Unicode, Inc., the * sole remedy for any claim will be exchange of defective media * within 90 days of receipt. - * + * * Limitations on Rights to Redistribute This Code - * + * * Unicode, Inc. hereby grants the right to freely use the information * supplied in this file in the creation of products supporting the * Unicode Standard, and to make copies of this file in any form @@ -95,7 +95,7 @@ namespace Unicode * This table contains as many values as there might be trailing bytes * in a UTF-8 sequence. */ - static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, + static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; /* @@ -123,7 +123,7 @@ namespace Unicode { const UTF16* source = (UTF16*)src.c_str(); const UTF16* sourceEnd = &source[ src.length() ]; - + // initialize a four-char packet: std::wstring packet( L" " ); @@ -132,7 +132,7 @@ namespace Unicode UTF32 ch; unsigned short bytesToWrite = 0; const UTF32 byteMask = 0xBF; - const UTF32 byteMark = 0x80; + const UTF32 byteMark = 0x80; //const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */ ch = *source++; @@ -182,7 +182,7 @@ namespace Unicode } } #endif - + /* Figure out how many bytes the result will require */ if (ch < (UTF32)0x80) bytesToWrite = 1; else if (ch < (UTF32)0x800) bytesToWrite = 2; @@ -224,7 +224,7 @@ namespace Unicode UTF8 a; const UTF8 *srcptr = source+length; - switch (length) + switch (length) { default: return false; /* Everything else falls through when "true"... */ @@ -268,12 +268,12 @@ namespace Unicode { const UTF8* source = (UTF8*)src.c_str(); const UTF8* sourceEnd = &source[ src.length() ]; - + while (source < sourceEnd) { UTF32 ch = 0; u16 extraBytesToRead = trailingBytesForUTF8[*source]; - + if( source + extraBytesToRead >= sourceEnd ) { throw Exception::UTFConversion( dest, "UTF8->UTF16 String Conversion failed: Unexpected end of string data." ); @@ -318,7 +318,7 @@ namespace Unicode dest += UNI_REPLACEMENT_CHAR; } } - else + else { dest += (UTF16)ch; /* normal case */ } @@ -364,7 +364,7 @@ namespace Unicode similarly unrolled loops. --------------------------------------------------------------------- */ - + wstring Convert( const string& src ) { wstring dest; diff --git a/plugins/spu2-x/src/ConvertUTF.h b/plugins/spu2-x/src/ConvertUTF.h index 6a1e8091c2..a5c240c903 100644 --- a/plugins/spu2-x/src/ConvertUTF.h +++ b/plugins/spu2-x/src/ConvertUTF.h @@ -14,13 +14,13 @@ namespace Unicode SourceExhausted, /* partial character in source, but hit end */ SourceIllegal /* source sequence is illegal/malformed */ }; - + /// /// Converts from UTF-16 to UTF-8. /// void Convert( const std::wstring& src, std::string& dest ); std::string Convert( const std::wstring& src ); - + /// /// Converts from UTF-16 to UTF-8. /// @@ -35,7 +35,7 @@ namespace Exception { public: const ResultType PartialResult; - + virtual ~UTFConversion() throw() {} UTFConversion( const ResultType& result, const std::string& msg ) : runtime_error( msg ), diff --git a/plugins/spu2-x/src/Debug.cpp b/plugins/spu2-x/src/Debug.cpp index 0ae0751025..40a3ca2430 100644 --- a/plugins/spu2-x/src/Debug.cpp +++ b/plugins/spu2-x/src/Debug.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -165,7 +165,7 @@ void DoFullDump() { fprintf(dump,"Voice %d:\n",v); Cores[c].Voices[v].Volume.DebugDump( dump, "" ); - + fprintf(dump," - ADSR Envelope: %x & %x\n" " - Ar: %x\n" " - Am: %x\n" diff --git a/plugins/spu2-x/src/Debug.h b/plugins/spu2-x/src/Debug.h index ce79684b90..01815438d3 100644 --- a/plugins/spu2-x/src/Debug.h +++ b/plugins/spu2-x/src/Debug.h @@ -50,7 +50,7 @@ namespace WaveDump , CoreSrc_External , CoreSrc_Count - }; + }; extern void Open(); extern void Close(); diff --git a/plugins/spu2-x/src/DecodeDPLII.cpp b/plugins/spu2-x/src/DecodeDPLII.cpp index 960f83acb1..f1d6e2f58f 100644 --- a/plugins/spu2-x/src/DecodeDPLII.cpp +++ b/plugins/spu2-x/src/DecodeDPLII.cpp @@ -1,22 +1,22 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Originally based on SPU2ghz v1.9 beta, by 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 + * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the the License, or (at your * option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT + * + * 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 * 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" @@ -67,7 +67,7 @@ void DPLII::Convert( s16 *obuffer, s32 ValL, s32 ValR ) ValR >>= 2; if(PlayMode&4) { - spdif_get_samples(spdif_data); + spdif_get_samples(spdif_data); } else { @@ -193,7 +193,7 @@ void DPLII::Convert( s16 *obuffer, s32 ValL, s32 ValR ) if(-ValL>LMax) LMax = -ValL; if(ValR>RMax) RMax = ValR; if(-ValR>RMax) RMax = -ValR; - + ANum++; if(ANum>=128) { diff --git a/plugins/spu2-x/src/Decoder.cpp b/plugins/spu2-x/src/Decoder.cpp index e0f8e56b9e..0d7f8e4d2b 100644 --- a/plugins/spu2-x/src/Decoder.cpp +++ b/plugins/spu2-x/src/Decoder.cpp @@ -130,14 +130,14 @@ s32 stoi(sample_t n) //input: [-1..1] void spdif_update() { - + for(int i=0;iValidated = false; cacheLine++; @@ -252,7 +252,7 @@ void V_Core::PlainDMAWrite(u16 *pMem, u32 size) // 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 + // 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 ); @@ -291,7 +291,7 @@ void V_Core::PlainDMAWrite(u16 *pMem, u32 size) { // Buffer doesn't wrap/overflow! // Just set the TDA and check for an IRQ... - + TDA = buff1end; // Flag interrupt? If IRQA occurs between start and dest, flag it. @@ -323,7 +323,7 @@ void V_Core::PlainDMAWrite(u16 *pMem, u32 size) TADR = MADR + (size<<1); } -void V_Core::DoDMAread(u16* pMem, u32 size) +void V_Core::DoDMAread(u16* pMem, u32 size) { #ifndef ENABLE_NEW_IOPDMA_SPU2 TSA &= 0xffff8; @@ -394,7 +394,7 @@ void V_Core::DoDMAread(u16* pMem, u32 size) #endif } -void V_Core::DoDMAwrite(u16* pMem, u32 size) +void V_Core::DoDMAwrite(u16* pMem, u32 size) { #ifndef ENABLE_NEW_IOPDMA_SPU2 DMAPtr = pMem; @@ -516,7 +516,7 @@ s32 V_Core::NewDmaWrite(u32* data, u32 bytesLeft, u32* bytesProcessed) bool DmaStarting = !DmaStarted; DmaStarted = true; - if(bytesLeft<2) + if(bytesLeft<2) { // execute interrupt code early NewDmaInterrupt(); @@ -554,7 +554,7 @@ s32 V_Core::NewDmaWrite(u32* data, u32 bytesLeft, u32* bytesProcessed) s16* mptr = (s16*)data; if(false)//(mode) - { + { memcpy((ADMATempBuffer+(InputPosWrite<<1)),mptr,0x400); mptr+=0x200; diff --git a/plugins/spu2-x/src/Dma.h b/plugins/spu2-x/src/Dma.h index df5472ee69..07c6651db5 100644 --- a/plugins/spu2-x/src/Dma.h +++ b/plugins/spu2-x/src/Dma.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms diff --git a/plugins/spu2-x/src/Global.h b/plugins/spu2-x/src/Global.h index 6f5adcb5e8..2b9f972fa0 100644 --- a/plugins/spu2-x/src/Global.h +++ b/plugins/spu2-x/src/Global.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms diff --git a/plugins/spu2-x/src/Linux/AboutBox.cpp b/plugins/spu2-x/src/Linux/AboutBox.cpp index c4cbb89a70..d71653af2c 100644 --- a/plugins/spu2-x/src/Linux/AboutBox.cpp +++ b/plugins/spu2-x/src/Linux/AboutBox.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -14,9 +14,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with SPU2-X. If not, see . */ - + #include "Dialogs.h" - + void AboutBox() { SysMessage("Yay: Aboutbox."); diff --git a/plugins/spu2-x/src/Linux/Alsa.cpp b/plugins/spu2-x/src/Linux/Alsa.cpp index 9992b6bc0b..9bf0ff1de5 100644 --- a/plugins/spu2-x/src/Linux/Alsa.cpp +++ b/plugins/spu2-x/src/Linux/Alsa.cpp @@ -206,7 +206,7 @@ public: return 0; } - int GetEmptySampleCount() + int GetEmptySampleCount() { if(handle == NULL) return 0; diff --git a/plugins/spu2-x/src/Linux/Alsa.h b/plugins/spu2-x/src/Linux/Alsa.h index 62c00f3d46..adaece82c6 100644 --- a/plugins/spu2-x/src/Linux/Alsa.h +++ b/plugins/spu2-x/src/Linux/Alsa.h @@ -15,12 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + // Modified by arcum42@gmail.com - + #ifndef __LINUX_H__ #define __LINUX_H__ - + #include #include @@ -30,7 +30,7 @@ #include // Make it easier to check and set checkmarks in the gui -#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) +#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) #define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state) #define ALSA_PCM_NEW_HW_PARAMS_API @@ -57,4 +57,4 @@ extern void RemoveSound(); extern int SoundGetBytesBuffered(); extern void SoundFeedVoiceData(unsigned char* pSound,long lBytes); -#endif // __LINUX_H__ \ No newline at end of file +#endif // __LINUX_H__ diff --git a/plugins/spu2-x/src/Linux/CfgHelpers.cpp b/plugins/spu2-x/src/Linux/CfgHelpers.cpp index a57232355b..b58cd48d46 100644 --- a/plugins/spu2-x/src/Linux/CfgHelpers.cpp +++ b/plugins/spu2-x/src/Linux/CfgHelpers.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -14,38 +14,38 @@ * You should have received a copy of the GNU Lesser General Public License * along with SPU2-X. If not, see . */ - + #include "Dialogs.h" #include - + wxConfigBase *oldConfig; wxString path; - + wxFileConfig *setIni(const wchar_t* Section) - { + { wxConfig *tempConfig; - + oldConfig = wxConfigBase::Get(false); - + tempConfig = new wxFileConfig(L"", L"", path, L"", wxCONFIG_USE_LOCAL_FILE); wxConfigBase::Set(tempConfig); tempConfig->SetPath(L"/"); tempConfig->SetPath(Section); return tempConfig; } - + void writeIni(wxFileConfig *tempConfig) { tempConfig->Flush(); - + if (oldConfig != NULL) wxConfigBase::Set(oldConfig); delete tempConfig; } - + void CfgSetSettingsDir(const char* dir) { path = wxString::FromAscii(dir) + L"spu2-x.ini"; - + } void CfgWriteBool(const wchar_t* Section, const wchar_t* Name, bool Value) @@ -72,22 +72,22 @@ void CfgWriteStr(const wchar_t* Section, const wchar_t* Name, const wstring& Dat bool CfgReadBool(const wchar_t *Section,const wchar_t* Name, bool Default) { bool ret; - - wxConfig *config = setIni(Section); + + wxConfig *config = setIni(Section); config->Read(Name, &ret, Default); writeIni(config); - + return ret; } int CfgReadInt(const wchar_t* Section, const wchar_t* Name,int Default) { int ret; - - wxConfig *config = setIni(Section); + + wxConfig *config = setIni(Section); config->Read(Name, &ret, Default); writeIni(config); - + return ret; } diff --git a/plugins/spu2-x/src/Linux/Config.cpp b/plugins/spu2-x/src/Linux/Config.cpp index 8de0d08c6e..d7b87ff0b1 100644 --- a/plugins/spu2-x/src/Linux/Config.cpp +++ b/plugins/spu2-x/src/Linux/Config.cpp @@ -61,7 +61,7 @@ void ReadSettings() wstring temp; CfgReadStr( L"OUTPUT", L"Output_Module", temp, 127, PortaudioOut->GetIdent() ); OutputModule = FindOutputModuleById( temp.c_str() );// find the driver index of this module - + SndOutLatencyMS = CfgReadInt(L"OUTPUT",L"Latency", 150); timeStretchEnabled = CfgReadBool( L"OUTPUT", L"Enable_Timestretch", true ); asyncMixingEnabled = CfgReadBool( L"OUTPUT", L"Enable_AsyncMixing", false ); @@ -74,7 +74,7 @@ void ReadSettings() // ------------- Clampify( SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX ); - + WriteSettings(); } @@ -91,7 +91,7 @@ void WriteSettings() CfgWriteBool(L"OUTPUT",L"Enable_Timestretch", timeStretchEnabled); CfgWriteBool(L"OUTPUT",L"Enable_AsyncMixing", asyncMixingEnabled); - PortaudioOut->WriteSettings(); + PortaudioOut->WriteSettings(); SoundtouchCfg::WriteSettings(); DebugConfig::WriteSettings(); } @@ -109,23 +109,23 @@ void debug_dialog() void DisplayDialog() { int return_value; - + GtkWidget *dialog; GtkWidget *main_frame, *main_box; - + GtkWidget *mixing_frame, *mixing_box; GtkWidget *int_label, *int_box; GtkWidget *effects_check; GtkWidget *reverb_label, *reverb_box; GtkWidget *debug_check; GtkWidget *debug_button; - + GtkWidget *output_frame, *output_box; GtkWidget *mod_label, *mod_box; GtkWidget *latency_slide; GtkWidget *time_check; GtkWidget *advanced_button; - + /* Create the widgets */ dialog = gtk_dialog_new_with_buttons ( "Spu2-X Config", @@ -136,7 +136,7 @@ void DisplayDialog() GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); - + int_label = gtk_label_new ("Interpolation:"); int_box = gtk_combo_box_new_text (); gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "0 - Nearest (fastest/bad quality)"); @@ -145,9 +145,9 @@ void DisplayDialog() gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "3 - Hermite (slower/better highs)"); gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "4 - Catmull-Rom (slow/hq)"); gtk_combo_box_set_active(GTK_COMBO_BOX(int_box), Interpolation); - + effects_check = gtk_check_button_new_with_label("Disable Effects Processing"); - + reverb_label = gtk_label_new ("Reverb Boost Factor:"); reverb_box = gtk_combo_box_new_text (); gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "1X - Normal Reverb Volume"); @@ -155,7 +155,7 @@ void DisplayDialog() gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "4X - Reverb Volume x 4"); gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "8X - Reverb Volume x 8"); gtk_combo_box_set_active(GTK_COMBO_BOX(reverb_box), ReverbBoost); - + debug_check = gtk_check_button_new_with_label("Enable Debug Options"); debug_button = gtk_button_new_with_label("Debug..."); @@ -163,30 +163,30 @@ void DisplayDialog() mod_box = gtk_combo_box_new_text (); gtk_combo_box_append_text(GTK_COMBO_BOX(mod_box), "0 - No Sound (emulate SPU2 only)"); gtk_combo_box_append_text(GTK_COMBO_BOX(mod_box), "1 - PortAudio (cross-platform)"); - if (OutputModule == 0) + if (OutputModule == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(mod_box), 0); else gtk_combo_box_set_active(GTK_COMBO_BOX(mod_box), 1); - + latency_slide = gtk_hscale_new_with_range(LATENCY_MIN, LATENCY_MAX, 5); gtk_range_set_value(GTK_RANGE(latency_slide), SndOutLatencyMS); - + time_check = gtk_check_button_new_with_label("Enable Time Stretch"); - + advanced_button = gtk_button_new_with_label("Advanced..."); - + main_box = gtk_hbox_new(false, 5); main_frame = gtk_frame_new ("Spu2-X Config"); gtk_container_add (GTK_CONTAINER(main_frame), main_box); - + mixing_box = gtk_vbox_new(false, 5); mixing_frame = gtk_frame_new ("Mixing Settings:"); gtk_container_add (GTK_CONTAINER(mixing_frame), mixing_box); - + output_box = gtk_vbox_new(false, 5); output_frame = gtk_frame_new ("Output Settings:"); gtk_container_add (GTK_CONTAINER(output_frame), output_box); - + gtk_container_add(GTK_CONTAINER(mixing_box), int_label); gtk_container_add(GTK_CONTAINER(mixing_box), int_box); gtk_container_add(GTK_CONTAINER(mixing_box), effects_check); @@ -194,50 +194,50 @@ void DisplayDialog() gtk_container_add(GTK_CONTAINER(mixing_box), reverb_box); gtk_container_add(GTK_CONTAINER(mixing_box), debug_check); gtk_container_add(GTK_CONTAINER(mixing_box), debug_button); - + gtk_container_add(GTK_CONTAINER(output_box), mod_label); gtk_container_add(GTK_CONTAINER(output_box), mod_box); gtk_container_add(GTK_CONTAINER(output_box), latency_slide); gtk_container_add(GTK_CONTAINER(output_box), advanced_button); gtk_container_add(GTK_CONTAINER(output_box), time_check); - + gtk_container_add(GTK_CONTAINER(main_box), mixing_frame); gtk_container_add(GTK_CONTAINER(main_box), output_frame); - + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(effects_check), EffectsDisabled); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(debug_check), DebugEnabled); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(time_check), timeStretchEnabled); - + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_frame); gtk_widget_show_all (dialog); - + g_signal_connect_swapped(GTK_OBJECT (advanced_button), "clicked", G_CALLBACK(advanced_dialog), advanced_button); g_signal_connect_swapped(GTK_OBJECT (debug_button), "clicked", G_CALLBACK(debug_dialog), debug_button); - + return_value = gtk_dialog_run (GTK_DIALOG (dialog)); - + if (return_value == GTK_RESPONSE_ACCEPT) { DebugEnabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(debug_check)); - if (gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)) != -1) + if (gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)) != -1) Interpolation = gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)); - + EffectsDisabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(effects_check)); - - if (gtk_combo_box_get_active(GTK_COMBO_BOX(reverb_box)) != -1) + + if (gtk_combo_box_get_active(GTK_COMBO_BOX(reverb_box)) != -1) ReverbBoost = gtk_combo_box_get_active(GTK_COMBO_BOX(reverb_box)); - + if (gtk_combo_box_get_active(GTK_COMBO_BOX(mod_box)) != 1) OutputModule = 0; else OutputModule = FindOutputModuleById( PortaudioOut->GetIdent() ); - + SndOutLatencyMS = gtk_range_get_value(GTK_RANGE(latency_slide)); timeStretchEnabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(time_check)); } - + gtk_widget_destroy (dialog); - + } void configure() diff --git a/plugins/spu2-x/src/Linux/Config.h b/plugins/spu2-x/src/Linux/Config.h index d910b36feb..bf38e9d88b 100644 --- a/plugins/spu2-x/src/Linux/Config.h +++ b/plugins/spu2-x/src/Linux/Config.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -102,7 +102,7 @@ namespace SoundtouchCfg void WriteSettings(); void DisplayDialog(); - + static void ClampValues(); }; diff --git a/plugins/spu2-x/src/Linux/ConfigDebug.cpp b/plugins/spu2-x/src/Linux/ConfigDebug.cpp index 9d154d430c..6bc6fdc6e4 100644 --- a/plugins/spu2-x/src/Linux/ConfigDebug.cpp +++ b/plugins/spu2-x/src/Linux/ConfigDebug.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -14,11 +14,11 @@ * You should have received a copy of the GNU Lesser General Public License * along with SPU2-X. If not, see . */ - + #include "Global.h" #include "Dialogs.h" #include "Config.h" - + bool DebugEnabled=false; bool _MsgToConsole=false; bool _MsgKeyOnOff=false; @@ -56,7 +56,7 @@ static void set_default_filenames() swprintf(WaveLogFileName, 255, L"logs/SPU2log.wav"); swprintf(DMA4LogFileName, 255, L"logs/logs/SPU2dma4.dat"); swprintf(DMA7LogFileName, 255, L"logs/SPU2dma7.dat"); - + swprintf(CoresDumpFileName, 255, L"logs/SPU2Cores.txt"); swprintf(MemDumpFileName, 255, L"logs/SPU2mem.dat"); swprintf(RegDumpFileName, 255, L"logs/SPU2regs.dat"); @@ -80,9 +80,9 @@ void ReadSettings() _CoresDump = CfgReadBool(Section, L"Dump_Info",0); _MemDump = CfgReadBool(Section, L"Dump_Memory",0); _RegDump = CfgReadBool(Section, L"Dump_Regs",0); - + set_default_filenames(); - + /*CfgReadStr(Section,L"Access_Log_Filename",AccessLogFileName,255,L"logs/SPU2Log.txt"); CfgReadStr(Section,L"WaveLog_Filename", WaveLogFileName, 255,L"logs/SPU2log.wav"); CfgReadStr(Section,L"DMA4Log_Filename", DMA4LogFileName, 255,L"logs/SPU2dma4.dat"); @@ -113,7 +113,7 @@ void WriteSettings() CfgWriteBool(Section,L"Dump_Info", _CoresDump); CfgWriteBool(Section,L"Dump_Memory",_MemDump); CfgWriteBool(Section,L"Dump_Regs", _RegDump); - + set_default_filenames(); /*CfgWriteStr(Section,L"Access_Log_Filename",AccessLogFileName); CfgWriteStr(Section,L"WaveLog_Filename", WaveLogFileName); @@ -123,26 +123,26 @@ void WriteSettings() CfgWriteStr(Section,L"Info_Dump_Filename",CoresDumpFileName); CfgWriteStr(Section,L"Mem_Dump_Filename", MemDumpFileName); CfgWriteStr(Section,L"Reg_Dump_Filename", RegDumpFileName);*/ - + } void DisplayDialog() { GtkWidget *dialog; int return_value; - + GtkWidget *msg_box, *log_box, *dump_box, *main_box; GtkWidget *msg_frame, *log_frame, *dump_frame, *main_frame; - + GtkWidget *msg_console_check, *msg_key_check, *msg_voice_check, *msg_dma_check; GtkWidget *msg_autodma_check, *msg_overrun_check, *msg_cache_check; - + GtkWidget *log_access_check, *log_dma_check, *log_wave_check; GtkWidget *dump_core_check, *dump_mem_check, *dump_reg_check; - + ReadSettings(); - - // Create the widgets + + // Create the widgets dialog = gtk_dialog_new_with_buttons ( "Spu2-X Config", NULL, // parent window @@ -152,15 +152,15 @@ void DisplayDialog() GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); - + main_box = gtk_hbox_new(false, 5); main_frame = gtk_frame_new ("Spu2-X Config"); gtk_container_add (GTK_CONTAINER(main_frame), main_box); - + // Message Section - + msg_box = gtk_vbox_new(false, 5); - + msg_console_check = gtk_check_button_new_with_label("Show In Console"); msg_key_check = gtk_check_button_new_with_label("KeyOn/Off Events"); msg_voice_check = gtk_check_button_new_with_label("Voice Stop Events"); @@ -168,7 +168,7 @@ void DisplayDialog() msg_autodma_check = gtk_check_button_new_with_label("AutoDMA Operations"); msg_overrun_check = gtk_check_button_new_with_label("Buffer Over/Underruns"); msg_cache_check = gtk_check_button_new_with_label("ADPCM Cache Statistics"); - + gtk_container_add(GTK_CONTAINER(msg_box), msg_console_check); gtk_container_add(GTK_CONTAINER(msg_box), msg_key_check); gtk_container_add(GTK_CONTAINER(msg_box), msg_voice_check); @@ -176,7 +176,7 @@ void DisplayDialog() gtk_container_add(GTK_CONTAINER(msg_box), msg_autodma_check); gtk_container_add(GTK_CONTAINER(msg_box), msg_overrun_check); gtk_container_add(GTK_CONTAINER(msg_box), msg_cache_check); - + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_console_check), _MsgToConsole); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_key_check), _MsgKeyOnOff); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_voice_check), _MsgVoiceOff); @@ -184,58 +184,58 @@ void DisplayDialog() gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_autodma_check), _MsgAutoDMA); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_overrun_check), _MsgOverruns); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_cache_check), _MsgCache); - + msg_frame = gtk_frame_new ("Message/Log Options"); gtk_container_add (GTK_CONTAINER(msg_frame), msg_box); - + // Log Section log_box = gtk_vbox_new(false, 5); - - log_access_check = gtk_check_button_new_with_label("Log Register/DMA Actions"); + + log_access_check = gtk_check_button_new_with_label("Log Register/DMA Actions"); log_dma_check = gtk_check_button_new_with_label("Log DMA Writes"); log_wave_check = gtk_check_button_new_with_label("Log Audio Output"); gtk_container_add(GTK_CONTAINER(log_box), log_access_check); gtk_container_add(GTK_CONTAINER(log_box), log_dma_check); gtk_container_add(GTK_CONTAINER(log_box), log_wave_check); - + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_access_check), _AccessLog); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_dma_check), _DMALog); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_wave_check), _WaveLog); - + log_frame = gtk_frame_new ("Log Options"); gtk_container_add (GTK_CONTAINER(log_frame), log_box); - + // Dump Section dump_box = gtk_vbox_new(false, 5); - + dump_core_check = gtk_check_button_new_with_label("Dump Core and Voice State"); dump_mem_check = gtk_check_button_new_with_label("Dump Memory Contents"); dump_reg_check = gtk_check_button_new_with_label("Dump Register Data"); - + gtk_container_add(GTK_CONTAINER(dump_box), dump_core_check); gtk_container_add(GTK_CONTAINER(dump_box), dump_mem_check); gtk_container_add(GTK_CONTAINER(dump_box), dump_reg_check); - + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_core_check), _CoresDump); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_mem_check), _MemDump); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_reg_check), _RegDump); - + dump_frame = gtk_frame_new ("Dumps (on close)"); gtk_container_add (GTK_CONTAINER(dump_frame), dump_box); - + // Add everything - + gtk_container_add (GTK_CONTAINER(main_box), msg_frame); gtk_container_add (GTK_CONTAINER(main_box), log_frame); gtk_container_add (GTK_CONTAINER(main_box), dump_frame); - - // Add all our widgets, and show everything we've added to the dialog. + + // Add all our widgets, and show everything we've added to the dialog. gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_frame); gtk_widget_show_all (dialog); - + return_value = gtk_dialog_run (GTK_DIALOG (dialog)); - + if (return_value == GTK_RESPONSE_ACCEPT) { _MsgToConsole = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_console_check)); @@ -254,9 +254,9 @@ void DisplayDialog() _MemDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_mem_check)); _RegDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_reg_check)); } - + gtk_widget_destroy (dialog); - + WriteSettings(); } diff --git a/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp b/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp index 6785710824..b960037c1d 100644 --- a/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp +++ b/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp @@ -1,22 +1,22 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * 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 + * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the the License, or (at your * option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT + * + * 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 * 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 "Global.h" @@ -47,7 +47,7 @@ void ReadSettings() OverlapMS = CfgReadInt( L"SOUNDTOUCH", L"OverlapMS", 7 ); ClampValues(); - WriteSettings(); + WriteSettings(); } void WriteSettings() @@ -72,9 +72,9 @@ void DisplayDialog() int return_value; GtkWidget *dialog, *main_label, *main_frame, *main_box; GtkWidget *default_button; - + ReadSettings(); - + /* Create the widgets */ dialog = gtk_dialog_new_with_buttons ( "Advanced Settings", @@ -85,27 +85,27 @@ void DisplayDialog() GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); - + main_label = gtk_label_new ("These are advanced configuration options fine tuning time stretching behavior. Larger values are better for slowdown, while smaller values are better for speedup (more then 60 fps.). All options are in microseconds."); gtk_label_set_line_wrap (GTK_LABEL(main_label), true); - + default_button = gtk_button_new_with_label("Reset to Defaults"); - + seq_label = gtk_label_new("Sequence Length"); seq_slide = gtk_hscale_new_with_range(SequenceLen_Min, SequenceLen_Max, 2); gtk_range_set_value(GTK_RANGE(seq_slide), SequenceLenMS); - + seek_label = gtk_label_new("Seek Window Size"); seek_slide = gtk_hscale_new_with_range(SeekWindow_Min, SeekWindow_Max, 1); gtk_range_set_value(GTK_RANGE(seek_slide), SeekWindowMS); - + over_label = gtk_label_new("Overlap"); over_slide = gtk_hscale_new_with_range(Overlap_Min, Overlap_Max, 1); gtk_range_set_value(GTK_RANGE(over_slide), OverlapMS); - + main_box = gtk_vbox_new(false, 5); main_frame = gtk_frame_new ("Spu2-X Config"); - + gtk_container_add(GTK_CONTAINER (main_box), default_button); gtk_container_add(GTK_CONTAINER (main_box), seq_label); gtk_container_add(GTK_CONTAINER (main_box), seq_slide); @@ -114,24 +114,24 @@ void DisplayDialog() gtk_container_add(GTK_CONTAINER (main_box), over_label); gtk_container_add(GTK_CONTAINER (main_box), over_slide); gtk_container_add (GTK_CONTAINER(main_frame), main_box); - + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_label); gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_frame); gtk_widget_show_all (dialog); - + g_signal_connect_swapped(GTK_OBJECT (default_button), "clicked", G_CALLBACK(restore_defaults), default_button); - + return_value = gtk_dialog_run (GTK_DIALOG (dialog)); - + if (return_value == GTK_RESPONSE_ACCEPT) { SequenceLenMS = gtk_range_get_value(GTK_RANGE(seq_slide));; SeekWindowMS = gtk_range_get_value(GTK_RANGE(seek_slide));; OverlapMS = gtk_range_get_value(GTK_RANGE(over_slide));; } - + gtk_widget_destroy (dialog); - + WriteSettings(); } } diff --git a/plugins/spu2-x/src/Linux/Dialogs.cpp b/plugins/spu2-x/src/Linux/Dialogs.cpp index 56693dc214..e7caf54bc5 100644 --- a/plugins/spu2-x/src/Linux/Dialogs.cpp +++ b/plugins/spu2-x/src/Linux/Dialogs.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -14,9 +14,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with SPU2-X. If not, see . */ - + // To be continued... - + #include "Dialogs.h" #include #include @@ -49,7 +49,7 @@ void SysMessage(const wchar_t *fmt, ...) wxString msg; msg.PrintfV( fmt, list ); va_end(list); - + GtkWidget *dialog; dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, diff --git a/plugins/spu2-x/src/Linux/Dialogs.h b/plugins/spu2-x/src/Linux/Dialogs.h index c085fd62d8..3037953fee 100644 --- a/plugins/spu2-x/src/Linux/Dialogs.h +++ b/plugins/spu2-x/src/Linux/Dialogs.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms diff --git a/plugins/spu2-x/src/Lowpass.cpp b/plugins/spu2-x/src/Lowpass.cpp index d9d89b171b..9aac4e2236 100644 --- a/plugins/spu2-x/src/Lowpass.cpp +++ b/plugins/spu2-x/src/Lowpass.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -20,13 +20,13 @@ #include #include -template< typename FloatType > __forceinline +template< typename FloatType > __forceinline LowPassFilter::LowPassFilter( FloatType freq, FloatType srate ) { typedef FloatType FT; FloatType omega = (FT)2.0 * freq / srate; - static const FloatType g = (FT)1.0; + static const FloatType g = (FT)1.0; // calculating coefficients: @@ -41,14 +41,14 @@ LowPassFilter::LowPassFilter( FloatType freq, FloatType srate ) a = (FT)1.0/(tan((FT)0.5*omega)*((FT)1.0+p)); p = (FT)1.0+a; q = (FT)1.0-a; - + a0 = (FT)1.0/(k+p*p*p*p); a1 = (FT)4.0*(k+p*p*p*q); a2 = (FT)6.0*(k+p*p*q*q); a3 = (FT)4.0*(k+p*q*q*q); a4 = (k+q*q*q*q); p = a0*(k+(FT)1.0); - + coef[0] = p; coef[1] = (FT)4.0*p; coef[2] = (FT)6.0*p; @@ -61,14 +61,14 @@ LowPassFilter::LowPassFilter( FloatType freq, FloatType srate ) } // Processes a single sample into the LPF. -template< typename FloatType > __forceinline +template< typename FloatType > __forceinline FloatType LowPassFilter::sample( FloatType inval ) { const FloatType out = (coef[0]*inval) + d[0]; d[0] = (coef[1]*inval) + (coef[5]*out) + d[1]; d[1] = (coef[2]*inval) + (coef[6]*out) + d[2]; d[2] = (coef[3]*inval) + (coef[7]*out) + d[3]; - d[3] = (coef[4]*inval) + (coef[8]*out); + d[3] = (coef[4]*inval) + (coef[8]*out); return out; } diff --git a/plugins/spu2-x/src/Lowpass.h b/plugins/spu2-x/src/Lowpass.h index f1876b04c0..1d969926c2 100644 --- a/plugins/spu2-x/src/Lowpass.h +++ b/plugins/spu2-x/src/Lowpass.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms diff --git a/plugins/spu2-x/src/Mixer.cpp b/plugins/spu2-x/src/Mixer.cpp index fc45925ffd..8e7330e89b 100644 --- a/plugins/spu2-x/src/Mixer.cpp +++ b/plugins/spu2-x/src/Mixer.cpp @@ -365,7 +365,7 @@ static __forceinline void CalculateADSR( V_Core& thiscore, uint voiceidx ) Tension: 65535 is high, 32768 is normal, 0 is low */ template - __forceinline + __forceinline static s32 HermiteInterpolate( s32 y0, // 16.0 s32 y1, // 16.0 @@ -389,7 +389,7 @@ static s32 HermiteInterpolate( return(val + (y1<<1)); } -__forceinline +__forceinline static s32 CatmullRomInterpolate( s32 y0, // 16.0 s32 y1, // 16.0 @@ -415,7 +415,7 @@ static s32 CatmullRomInterpolate( return (a0 + val); } -__forceinline +__forceinline static s32 CubicInterpolate( s32 y0, // 16.0 s32 y1, // 16.0 @@ -468,7 +468,7 @@ static __forceinline s32 GetVoiceValues( V_Core& thiscore, uint voiceidx ) jNO_DEFAULT; } - + return 0; // technically unreachable! } @@ -560,7 +560,7 @@ static __forceinline StereoOut32 MixVoice( uint coreidx, uint voiceidx ) case 2: Value = GetVoiceValues<2>( thiscore, voiceidx ); break; case 3: Value = GetVoiceValues<3>( thiscore, voiceidx ); break; case 4: Value = GetVoiceValues<4>( thiscore, voiceidx ); break; - + jNO_DEFAULT; } } @@ -657,7 +657,7 @@ StereoOut32 V_Core::Mix( const VoiceMixSet& inVoices, const StereoOut32& Input, TD.Right += Ext.Right & DryGate.ExtR; if( EffectsDisabled ) return TD; - + // ---------------------------------------------------------------------------- // Reverberation Effects Processing // ---------------------------------------------------------------------------- @@ -666,7 +666,7 @@ StereoOut32 V_Core::Mix( const VoiceMixSet& inVoices, const StereoOut32& Input, // but it does not actually disable reverb effects processing. In practical terms // this means that when a game turns off reverb, an existing reverb effect should trail // off naturally, instead of being chopped off dead silent. - + Reverb_AdvanceBuffer(); StereoOut32 TW; diff --git a/plugins/spu2-x/src/Mixer.h b/plugins/spu2-x/src/Mixer.h index da309c5f76..faee20cfda 100644 --- a/plugins/spu2-x/src/Mixer.h +++ b/plugins/spu2-x/src/Mixer.h @@ -54,7 +54,7 @@ struct StereoOut32 Right *= factor; return *this; } - + StereoOut32 operator+( const StereoOut32& right ) const { return StereoOut32( diff --git a/plugins/spu2-x/src/PS2E-spu2.cpp b/plugins/spu2-x/src/PS2E-spu2.cpp index 3aa50c32a8..38a7633292 100644 --- a/plugins/spu2-x/src/PS2E-spu2.cpp +++ b/plugins/spu2-x/src/PS2E-spu2.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with SPU2-X. If not, see . */ - + #include "Global.h" #include "PS2E-spu2.h" #include "Dma.h" @@ -48,7 +48,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved) if( dwReason == DLL_PROCESS_ATTACH ) { hInstance = hinstDLL; - } + } else if( dwReason == DLL_PROCESS_DETACH ) { // TODO : perform shutdown procedure, just in case PCSX2 itself failed @@ -129,18 +129,18 @@ static bool CheckSSE() return true; } -EXPORT_C_(u32) PS2EgetLibType() +EXPORT_C_(u32) PS2EgetLibType() { return PS2E_LT_SPU2; } -EXPORT_C_(char*) PS2EgetLibName() +EXPORT_C_(char*) PS2EgetLibName() { InitLibraryName(); return libraryName; } -EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) +EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) { return (PS2E_SPU2_VERSION<<16) | (VersionInfo::Release<<8) | VersionInfo::Revision; } @@ -292,7 +292,7 @@ EXPORT_C_(void) CALLBACK SPU2writeDMA7Mem(u16* pMem, u32 size) Cores[1].DoDMAwrite(pMem,size); } -EXPORT_C_(s32) SPU2init() +EXPORT_C_(s32) SPU2init() { assert( regtable[0x400] == NULL ); @@ -300,7 +300,7 @@ EXPORT_C_(s32) SPU2init() ReadSettings(); #ifdef SPU2_LOG - if(AccessLog()) + if(AccessLog()) { spu2Log = fopen( Unicode::Convert( AccessLogFileName ).c_str(), "w" ); setvbuf(spu2Log, NULL, _IONBF, 0); @@ -384,7 +384,7 @@ EXPORT_C_(s32) SPU2open(void *pDsp) if( IsOpened ) return 0; FileLog("[%10d] SPU2 Open\n",Cycles); - + if( pDsp != NULL ) gsWindowHandle = *(uptr*)pDsp; else @@ -419,7 +419,7 @@ EXPORT_C_(s32) SPU2open(void *pDsp) return 0; } -EXPORT_C_(void) SPU2close() +EXPORT_C_(void) SPU2close() { if( !IsOpened ) return; IsOpened = false; @@ -433,7 +433,7 @@ EXPORT_C_(void) SPU2close() SndBuffer::Cleanup(); } -EXPORT_C_(void) SPU2shutdown() +EXPORT_C_(void) SPU2shutdown() { if(!IsInitialized) return; IsInitialized = false; @@ -487,7 +487,7 @@ u32 lastTicks; bool lState[5]; #endif -EXPORT_C_(void) SPU2async(u32 cycles) +EXPORT_C_(void) SPU2async(u32 cycles) { DspUpdate(); @@ -536,7 +536,7 @@ EXPORT_C_(void) SPU2async(u32 cycles) #endif } -EXPORT_C_(u16) SPU2read(u32 rmem) +EXPORT_C_(u16) SPU2read(u32 rmem) { // if(!replay_mode) // s2r_readreg(Cycles,rmem); @@ -562,18 +562,18 @@ EXPORT_C_(u16) SPU2read(u32 rmem) ret = spu2Ru16(mem); ConLog(" * SPU2: Read from reg>=0x800: %x value %x\n",mem,ret); } - else + else { ret = *(regtable[(mem>>1)]); //FileLog("[%10d] SPU2 read mem %x (core %d, register %x): %x\n",Cycles, mem, core, (omem & 0x7ff), ret); SPU2writeLog( "read", rmem, ret ); } } - + return ret; } -EXPORT_C_(void) SPU2write(u32 rmem, u16 value) +EXPORT_C_(void) SPU2write(u32 rmem, u16 value) { #ifdef S2R_ENABLE if(!replay_mode) @@ -627,10 +627,10 @@ EXPORT_C_(s32) SPU2freeze(int mode, freezeData *data) { case FREEZE_LOAD: return Savestate::ThawIt( spud ); case FREEZE_SAVE: return Savestate::FreezeIt( spud ); - + jNO_DEFAULT; } - + // technically unreachable, but kills a warning: return 0; } diff --git a/plugins/spu2-x/src/ReadInput.cpp b/plugins/spu2-x/src/ReadInput.cpp index 0d78e3611d..5e5469eece 100644 --- a/plugins/spu2-x/src/ReadInput.cpp +++ b/plugins/spu2-x/src/ReadInput.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -39,7 +39,7 @@ StereoOut32 V_Core::ReadInput_HiFi() *((s32*)(ADMATempBuffer+(InputPosRead<<1)+2)) ); #else - StereoOut32 retval( + StereoOut32 retval( (s32&)(ADMATempBuffer[InputPosRead]), (s32&)(ADMATempBuffer[InputPosRead+0x200]) ); @@ -78,7 +78,7 @@ StereoOut32 V_Core::ReadInput_HiFi() TSA = (Index<<10) + InputPosRead; - if (InputDataLeft < 0x200) + if (InputDataLeft < 0x200) { FileLog("[%10d] %s AutoDMA%c block end.\n", (Index==1) ? "CDDA" : "SPDIF", Cycles, GetDmaIndexChar()); @@ -108,7 +108,7 @@ StereoOut32 V_Core::ReadInput() return StereoOut32(); StereoOut32 retval; - + if( (Index!=1) || ((PlayMode&2)==0) ) { // Using the temporary buffer because this area gets overwritten by some other code. diff --git a/plugins/spu2-x/src/RegLog.cpp b/plugins/spu2-x/src/RegLog.cpp index a0ff132f5a..0d4bb8949d 100644 --- a/plugins/spu2-x/src/RegLog.cpp +++ b/plugins/spu2-x/src/RegLog.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -20,7 +20,7 @@ const char *ParamNames[8]={"VOLL","VOLR","PITCH","ADSR1","ADSR2","ENVX","VOLXL","VOLXR"}; const char *AddressNames[6]={"SSAH","SSAL","LSAH","LSAL","NAXH","NAXL"}; -__forceinline void _RegLog_( const char* action, int level, const char *RName, u32 mem, u32 core, u16 value ) +__forceinline void _RegLog_( const char* action, int level, const char *RName, u32 mem, u32 core, u16 value ) { if( level > 1 ) FileLog("[%10d] SPU2 %s mem %08x (core %d, register %s) value %04x\n", @@ -29,10 +29,10 @@ __forceinline void _RegLog_( const char* action, int level, const char *RName, u #define RegLog( lev, rname, mem, core, val ) _RegLog_( action, lev, rname, mem, core, val ) -void SPU2writeLog( const char* action, u32 rmem, u16 value ) +void SPU2writeLog( const char* action, u32 rmem, u16 value ) { if( !IsDevBuild ) return; - + //u32 vx=0, vc=0; u32 core=0, omem, mem; omem=mem=rmem & 0x7FF; //FFFF; @@ -188,7 +188,7 @@ void SPU2writeLog( const char* action, u32 rmem, u16 value ) //ConLog(" * SPU2: Core %d ENDX cleared!\n",core); RegLog(2,"ENDX0",rmem,core,value); break; - case (REG_S_ENDX + 2): + case (REG_S_ENDX + 2): //ConLog(" * SPU2: Core %d ENDX cleared!\n",core); RegLog(2,"ENDX1",rmem,core,value); break; diff --git a/plugins/spu2-x/src/RegTable.cpp b/plugins/spu2-x/src/RegTable.cpp index 3028204f0c..c622c006b9 100644 --- a/plugins/spu2-x/src/RegTable.cpp +++ b/plugins/spu2-x/src/RegTable.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -81,7 +81,7 @@ u16* regtable[0x401] = PCORE(0,TSA)+1, PCORE(0,TSA), - PRAW(REG__1AC), PRAW(REG__1AE), + PRAW(REG__1AC), PRAW(REG__1AE), PCORE(0,AutoDMACtrl), @@ -184,7 +184,7 @@ u16* regtable[0x401] = PCORE(1,TSA)+1, PCORE(1,TSA), - PRAW(0x5ac), PRAW(0x5ae), + PRAW(0x5ac), PRAW(0x5ae), PCORE(1,AutoDMACtrl), diff --git a/plugins/spu2-x/src/Reverb.cpp b/plugins/spu2-x/src/Reverb.cpp index 5d0194db18..d8a367c95c 100644 --- a/plugins/spu2-x/src/Reverb.cpp +++ b/plugins/spu2-x/src/Reverb.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -37,7 +37,7 @@ __forceinline s32 V_Core::RevbGetIndexer( s32 offset ) pos += EffectsStartA; } return pos; -} +} void V_Core::Reverb_AdvanceBuffer() { @@ -84,7 +84,7 @@ StereoOut32 V_Core::DoReverb( const StereoOut32& Input ) // Advance the current reverb buffer pointer, and cache the read/write addresses we'll be // needing for this session of reverb. - + const u32 src_a0 = RevbGetIndexer( RevBuffers.IIR_SRC_A0 ); const u32 src_a1 = RevbGetIndexer( RevBuffers.IIR_SRC_A1 ); const u32 src_b0 = RevbGetIndexer( RevBuffers.IIR_SRC_B0 ); @@ -94,12 +94,12 @@ StereoOut32 V_Core::DoReverb( const StereoOut32& Input ) const u32 dest_a1 = RevbGetIndexer( RevBuffers.IIR_DEST_A1 ); const u32 dest_b0 = RevbGetIndexer( RevBuffers.IIR_DEST_B0 ); const u32 dest_b1 = RevbGetIndexer( RevBuffers.IIR_DEST_B1 ); - + const u32 dest2_a0 = RevbGetIndexer( RevBuffers.IIR_DEST_A0 + 2 ); const u32 dest2_a1 = RevbGetIndexer( RevBuffers.IIR_DEST_A1 + 2 ); const u32 dest2_b0 = RevbGetIndexer( RevBuffers.IIR_DEST_B0 + 2 ); const u32 dest2_b1 = RevbGetIndexer( RevBuffers.IIR_DEST_B1 + 2 ); - + const u32 acc_src_a0 = RevbGetIndexer( RevBuffers.ACC_SRC_A0 ); const u32 acc_src_b0 = RevbGetIndexer( RevBuffers.ACC_SRC_B0 ); const u32 acc_src_c0 = RevbGetIndexer( RevBuffers.ACC_SRC_C0 ); @@ -123,7 +123,7 @@ StereoOut32 V_Core::DoReverb( const StereoOut32& Input ) // ----------------------------------------- // Optimized IRQ Testing ! // ----------------------------------------- - + // This test is enhanced by using the reverb effects area begin/end test as a // shortcut, since all buffer addresses are within that area. If the IRQA isn't // within that zone then the "bulk" of the test is skipped, so this should only @@ -135,7 +135,7 @@ StereoOut32 V_Core::DoReverb( const StereoOut32& Input ) { if( (Cores[i].IRQA == src_a0) || (Cores[i].IRQA == src_a1) || (Cores[i].IRQA == src_b0) || (Cores[i].IRQA == src_b1) || - + (Cores[i].IRQA == dest_a0) || (Cores[i].IRQA == dest_a1) || (Cores[i].IRQA == dest_b0) || (Cores[i].IRQA == dest_b1) || @@ -159,7 +159,7 @@ StereoOut32 V_Core::DoReverb( const StereoOut32& Input ) } } } - + // ----------------------------------------- // Begin Reverb Processing ! // ----------------------------------------- @@ -223,7 +223,7 @@ StereoOut32 V_Core::DoReverb( const StereoOut32& Input ) (_spu2mem[mix_dest_a0] + _spu2mem[mix_dest_b0]), // left (_spu2mem[mix_dest_a1] + _spu2mem[mix_dest_b1]) // right ) ); - } + } StereoOut32 retval; diff --git a/plugins/spu2-x/src/SndOut.cpp b/plugins/spu2-x/src/SndOut.cpp index d5c2e4d0c2..6d17c770d9 100644 --- a/plugins/spu2-x/src/SndOut.cpp +++ b/plugins/spu2-x/src/SndOut.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -59,7 +59,7 @@ public: void Configure(uptr parent) { } bool Is51Out() const { return false; } int GetEmptySampleCount() { return 0; } - + const wchar_t* GetIdent() const { return L"nullout"; @@ -126,7 +126,7 @@ bool SndBuffer::CheckUnderrunStatus( int& nSamples, int& quietSampleCount ) { quietSampleCount = 0; if( m_underrun_freeze ) - { + { int toFill = m_size / (!timeStretchEnabled && !asyncMixingEnabled ? 32 : 400); toFill = GetAlignedBufferSize( toFill ); @@ -229,8 +229,8 @@ void SndBuffer::_WriteSamples(StereoOut32 *bData, int nSamples) m_wpos += nSamples; memcpy( wposbuffer, bData, nSamples * sizeof( *bData ) ); - - // Use to monitor buffer levels in real time + + // Use to monitor buffer levels in real time /*int drvempty = mods[OutputModule]->GetEmptySampleCount(); float result = (float)(m_data + m_predictData - drvempty) - (m_size/16); result /= (m_size/16); @@ -331,7 +331,7 @@ void SndBuffer::Write( const StereoOut32& Sample ) //Don't play anything directly after loading a savestate, avoids static killing your speakers. if ( ssFreeze > 0 ) - { + { ssFreeze--; memset( sndTempBuffer, 0, sizeof(StereoOut32) * SndOutPacketSize ); // Play silence } @@ -357,7 +357,7 @@ void SndBuffer::Write( const StereoOut32& Sample ) m_dsp_progress -= SndOutPacketSize; } - + // copy any leftovers to the front of the dsp buffer. if( m_dsp_progress > 0 ) { diff --git a/plugins/spu2-x/src/SndOut.h b/plugins/spu2-x/src/SndOut.h index eedbbdd65e..539fdf96b5 100644 --- a/plugins/spu2-x/src/SndOut.h +++ b/plugins/spu2-x/src/SndOut.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms diff --git a/plugins/spu2-x/src/SndOut_Portaudio.cpp b/plugins/spu2-x/src/SndOut_Portaudio.cpp index f1f7c73697..661fcd3abf 100644 --- a/plugins/spu2-x/src/SndOut_Portaudio.cpp +++ b/plugins/spu2-x/src/SndOut_Portaudio.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -33,7 +33,7 @@ int PaLinuxCallback( const void *inputBuffer, void *outputBuffer, PaStreamCallbackFlags statusFlags, void *userData ); #endif - + class Portaudio : public SndOutModule { private: @@ -53,10 +53,10 @@ private: int writtenSoFar; int writtenLastTime; int availableLastTime; - + bool started; PaStream* stream; - + #ifndef __LINUX__ static int PaCallback( const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, @@ -67,7 +67,7 @@ private: return PA.ActualPaCallback(inputBuffer,outputBuffer,framesPerBuffer,timeInfo,statusFlags,userData); } #endif - + public: int ActualPaCallback( const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, @@ -86,7 +86,7 @@ public: return 0; } - + Portaudio() { m_ApiId=-1; @@ -113,7 +113,7 @@ public: for(int i=0;ihostApi); fprintf(stderr," *** Device %d: '%s' (%s)", i, info->name, apiinfo->name); @@ -152,17 +152,17 @@ public: } } } - + if(deviceIndex>=0) { void* infoPtr = NULL; #ifdef __WIN32__ - PaWasapiStreamInfo info = { - sizeof(PaWasapiStreamInfo), - paWASAPI, - 1, - paWinWasapiExclusive + PaWasapiStreamInfo info = { + sizeof(PaWasapiStreamInfo), + paWASAPI, + 1, + paWinWasapiExclusive }; if((m_ApiId == paWASAPI) && m_WasapiExclusiveMode) @@ -185,15 +185,15 @@ public: 0, //? infoPtr }; - + err = Pa_OpenStream(&stream, NULL, &outParams, SampleRate, SndOutPacketSize, - paNoFlag, + paNoFlag, #ifndef __LINUX__ - PaCallback, + PaCallback, #else - PaLinuxCallback, + PaLinuxCallback, #endif NULL); } @@ -203,9 +203,9 @@ public: 0, 2, paInt32, 48000, SndOutPacketSize, #ifndef __LINUX__ - PaCallback, + PaCallback, #else - PaLinuxCallback, + PaLinuxCallback, #endif NULL ); } @@ -290,7 +290,7 @@ public: { return L"Portaudio (crossplatform)"; } - + void ReadSettings() { wstring api=L"EMPTYEMPTYEMPTY"; diff --git a/plugins/spu2-x/src/Spu2replay.cpp b/plugins/spu2-x/src/Spu2replay.cpp index 0c9d0973ba..49bbbf31c5 100644 --- a/plugins/spu2-x/src/Spu2replay.cpp +++ b/plugins/spu2-x/src/Spu2replay.cpp @@ -188,7 +188,7 @@ EXPORT_C_(void) s2r_replay(HWND hwnd, HINSTANCE hinst, LPSTR filename, int nCmdS break; } } - + //shutdown SPU2close(); SPU2shutdown(); diff --git a/plugins/spu2-x/src/Timestretcher.cpp b/plugins/spu2-x/src/Timestretcher.cpp index 27ae2d32e2..fbbe8ed9cd 100644 --- a/plugins/spu2-x/src/Timestretcher.cpp +++ b/plugins/spu2-x/src/Timestretcher.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. -* +* * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -258,7 +258,7 @@ static void CvtPacketToFloat( StereoOut32* srcdest ) static void CvtPacketToInt( StereoOut32* srcdest, uint size ) { //jASSUME( (size & 127) == 0 ); - + const StereoOutFloat* src = (StereoOutFloat*)srcdest; StereoOut32* dest = srcdest; @@ -287,7 +287,7 @@ void SndBuffer::timeStretchWrite() { // Hint: It's assumed that pSoundTouch will return chunks of 128 bytes (it always does as // long as the SSE optimizations are enabled), which means we can do our own SSE opts here. - + CvtPacketToInt( sndTempBuffer, tempProgress ); _WriteSamples( sndTempBuffer, tempProgress ); progress = true; @@ -354,4 +354,4 @@ void SndBuffer::soundtouchClearContents() void SndBuffer::soundtouchCleanup() { safe_delete( pSoundTouch ); -} \ No newline at end of file +} diff --git a/plugins/spu2-x/src/Wavedump_wav.cpp b/plugins/spu2-x/src/Wavedump_wav.cpp index da1322619d..4a8acb36ff 100644 --- a/plugins/spu2-x/src/Wavedump_wav.cpp +++ b/plugins/spu2-x/src/Wavedump_wav.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -41,7 +41,7 @@ namespace WaveDump { if( !IsDevBuild ) return; if( !WaveLog() ) return; - + char wavfilename[256]; for( uint cidx=0; cidx<2; cidx++ ) @@ -49,7 +49,7 @@ namespace WaveDump for( int srcidx=0; srcidx. */ - + #include "Global.h" #include "Dialogs.h" @@ -29,13 +29,13 @@ static LRESULT WINAPI AboutProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { ConvertStaticToHyperlink( hDlg, IDC_LINK_GOOGLECODE ); ConvertStaticToHyperlink( hDlg, IDC_LINK_WEBSITE ); - + wchar_t outstr[256]; if( IsDevBuild ) swprintf_s( outstr, L"Build r%d -- Compiled on " _T(__DATE__), SVN_REV ); else swprintf_s( outstr, L"Release v%d.%d -- Compiled on " _T(__DATE__), - VersionInfo::Release, VersionInfo::Revision ); + VersionInfo::Release, VersionInfo::Revision ); SetWindowText( GetDlgItem(hDlg, IDC_LABEL_VERSION_INFO), outstr ); ShowWindow( hDlg, true ); @@ -60,7 +60,7 @@ static LRESULT WINAPI AboutProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar return TRUE; } break; - + default: return FALSE; } diff --git a/plugins/spu2-x/src/Windows/CfgHelpers.cpp b/plugins/spu2-x/src/Windows/CfgHelpers.cpp index 2d964ee6cd..7cf2bf63db 100644 --- a/plugins/spu2-x/src/Windows/CfgHelpers.cpp +++ b/plugins/spu2-x/src/Windows/CfgHelpers.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -137,7 +137,7 @@ void CfgReadStr(const TCHAR* Section, const TCHAR* Name, TCHAR* Data, int DataSi { GetPrivateProfileString(Section,Name,L"",Data,DataSize,CfgFile); - if(wcslen(Data)==0) { + if(wcslen(Data)==0) { swprintf_s( Data, DataSize, L"%s", Default ); CfgWriteStr( Section, Name, Data ); } @@ -151,7 +151,7 @@ void CfgReadStr(const TCHAR* Section, const TCHAR* Name, wstring& Data, int Data Data = workspace; if(Data.empty()) - { + { Data = Default; CfgWriteStr( Section, Name, Default ); } diff --git a/plugins/spu2-x/src/Windows/Config.cpp b/plugins/spu2-x/src/Windows/Config.cpp index e7c8e53a4a..55a42167b5 100644 --- a/plugins/spu2-x/src/Windows/Config.cpp +++ b/plugins/spu2-x/src/Windows/Config.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -92,7 +92,7 @@ void ReadSettings() // ------------- Clampify( SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX ); - + if( mods[OutputModule] == NULL ) { // Unsupported or legacy module. @@ -125,7 +125,7 @@ void WriteSettings() CfgWriteInt(L"DSP PLUGIN",L"ModuleNum",dspPluginModule); CfgWriteBool(L"DSP PLUGIN",L"Enabled",dspPluginEnabled); - DSoundOut->WriteSettings(); + DSoundOut->WriteSettings(); SoundtouchCfg::WriteSettings(); DebugConfig::WriteSettings(); @@ -143,23 +143,23 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) case WM_INITDIALOG: { - SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_RESETCONTENT,0,0 ); + SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_RESETCONTENT,0,0 ); SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) L"0 - Nearest (fastest/bad quality)" ); SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) L"1 - Linear (simple/nice)" ); SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) L"2 - Cubic (slower/good highs)" ); SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) L"3 - Hermite (slower/better highs)" ); SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) L"4 - Catmull-Rom (slow/hq)" ); - SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_SETCURSEL,Interpolation,0 ); - - SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_RESETCONTENT,0,0 ); + SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_SETCURSEL,Interpolation,0 ); + + SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_RESETCONTENT,0,0 ); SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_ADDSTRING,0,(LPARAM) L"1X - Normal Reverb Volume" ); SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_ADDSTRING,0,(LPARAM) L"2X - Reverb Volume * 2" ); SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_ADDSTRING,0,(LPARAM) L"4X - Reverb Volume * 4" ); SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_ADDSTRING,0,(LPARAM) L"8X - Reverb Volume * 8" ); - SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_SETCURSEL,ReverbBoost,0 ); + SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_SETCURSEL,ReverbBoost,0 ); SendDialogMsg( hWnd, IDC_OUTPUT, CB_RESETCONTENT,0,0 ); - + int modidx = 0; while( mods[modidx] != NULL ) { @@ -173,13 +173,13 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) int maxexp = (int)(pow( (double)LATENCY_MAX+2, 1.0/3.0 ) * 128.0); INIT_SLIDER( IDC_LATENCY_SLIDER, minexp, maxexp, 200, 42, 1 ); - SendDialogMsg( hWnd, IDC_LATENCY_SLIDER, TBM_SETPOS, TRUE, (int)((pow( (double)SndOutLatencyMS, 1.0/3.0 ) * 128.0) + 1) ); + SendDialogMsg( hWnd, IDC_LATENCY_SLIDER, TBM_SETPOS, TRUE, (int)((pow( (double)SndOutLatencyMS, 1.0/3.0 ) * 128.0) + 1) ); swprintf_s(temp,L"%d ms (avg)",SndOutLatencyMS); SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp); - + EnableWindow( GetDlgItem( hWnd, IDC_OPEN_CONFIG_SOUNDTOUCH ), timeStretchEnabled ); EnableWindow( GetDlgItem( hWnd, IDC_OPEN_CONFIG_DEBUG ), DebugEnabled ); - + SET_CHECK(IDC_EFFECTS_DISABLE, EffectsDisabled); SET_CHECK(IDC_EXPANSION_ENABLE,StereoExpansionEnabled); SET_CHECK(IDC_TS_ENABLE, timeStretchEnabled); @@ -189,8 +189,8 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) break; case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { @@ -220,7 +220,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) mods[module]->Configure((uptr)hWnd); } break; - + case IDC_OPEN_CONFIG_DEBUG: { // Quick Hack -- DebugEnabled is re-loaded with the DebugConfig's API, @@ -242,7 +242,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) HANDLE_CHECKNB(IDC_TS_ENABLE,timeStretchEnabled); EnableWindow( GetDlgItem( hWnd, IDC_OPEN_CONFIG_SOUNDTOUCH ), timeStretchEnabled ); break; - + HANDLE_CHECKNB(IDC_DEBUG_ENABLE,DebugEnabled); DebugConfig::EnableControls( hWnd ); EnableWindow( GetDlgItem( hWnd, IDC_OPEN_CONFIG_DEBUG ), DebugEnabled ); @@ -252,12 +252,12 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) return FALSE; } break; - + case WM_HSCROLL: { - wmEvent = LOWORD(wParam); + wmEvent = LOWORD(wParam); HWND hwndDlg = (HWND)lParam; - + // TB_THUMBTRACK passes the curpos in wParam. Other messages // have to use TBM_GETPOS, so they will override this assignment (see below) @@ -295,13 +295,13 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) } } break; - + default: return FALSE; } return TRUE; } - + void configure() { INT_PTR ret; diff --git a/plugins/spu2-x/src/Windows/ConfigDebug.cpp b/plugins/spu2-x/src/Windows/ConfigDebug.cpp index 7e1c62d84b..0b56b13bb2 100644 --- a/plugins/spu2-x/src/Windows/ConfigDebug.cpp +++ b/plugins/spu2-x/src/Windows/ConfigDebug.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -170,8 +170,8 @@ static BOOL CALLBACK DialogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) break; case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { @@ -226,4 +226,4 @@ void OpenDialog() ReadSettings(); } -} \ No newline at end of file +} diff --git a/plugins/spu2-x/src/Windows/ConfigSoundtouch.cpp b/plugins/spu2-x/src/Windows/ConfigSoundtouch.cpp index 6be100dfa7..eecc7af600 100644 --- a/plugins/spu2-x/src/Windows/ConfigSoundtouch.cpp +++ b/plugins/spu2-x/src/Windows/ConfigSoundtouch.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -54,7 +54,7 @@ void SoundtouchCfg::ReadSettings() SeekWindowMS = CfgReadInt( L"SOUNDTOUCH", L"SeekWindowMS", 15 ); OverlapMS = CfgReadInt( L"SOUNDTOUCH", L"OverlapMS", 25 ); - ClampValues(); + ClampValues(); } void SoundtouchCfg::WriteSettings() @@ -84,10 +84,10 @@ BOOL CALLBACK SoundtouchCfg::DialogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM SendDialogMsg( hWnd, IDC_SEEKWIN_SLIDER, TBM_SETPOS, TRUE, SeekWindowMS ); SendDialogMsg( hWnd, IDC_OVERLAP_SLIDER, TBM_SETPOS, TRUE, OverlapMS ); } - + case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); // Parse the menu selections: if( wmId == IDOK ) { @@ -104,11 +104,11 @@ BOOL CALLBACK SoundtouchCfg::DialogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM EndDialog(hWnd,0); } break; - + case WM_HSCROLL: DoHandleScrollMessage( hWnd, wParam, lParam ); break; - + default: return FALSE; } diff --git a/plugins/spu2-x/src/Windows/Dialogs.h b/plugins/spu2-x/src/Windows/Dialogs.h index 02807e6e06..4e6de46b73 100644 --- a/plugins/spu2-x/src/Windows/Dialogs.h +++ b/plugins/spu2-x/src/Windows/Dialogs.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms diff --git a/plugins/spu2-x/src/Windows/Dsound51.cpp b/plugins/spu2-x/src/Windows/Dsound51.cpp index 683d020717..98c8301028 100644 --- a/plugins/spu2-x/src/Windows/Dsound51.cpp +++ b/plugins/spu2-x/src/Windows/Dsound51.cpp @@ -1,22 +1,22 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Originally based on SPU2ghz v1.9 beta, by 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 + * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the the License, or (at your * option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT + * + * 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 * 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 @@ -144,11 +144,11 @@ DSound51_Driver::DSound51_Driver( SndBuffer *sb ) : verifyc(dsound->SetCooperativeLevel(GetDesktopWindow(),DSSCL_PRIORITY)); IDirectSoundBuffer* buffer_; - DSBUFFERDESC desc; + DSBUFFERDESC desc; - // Set up WAV format structure. + // Set up WAV format structure. - memset(&wfx, 0, sizeof(WAVEFORMATEX)); + memset(&wfx, 0, sizeof(WAVEFORMATEX)); wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; wfx.Format.nSamplesPerSec = SampleRate; wfx.Format.nChannels=6; @@ -162,13 +162,13 @@ DSound51_Driver::DSound51_Driver( SndBuffer *sb ) : verifyc(dsound->SetSpeakerConfig(DSSPEAKER_5POINT1)); - // Set up DSBUFFERDESC structure. + // 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 = DSound51::BufferSizeBytes * numBuffers; - desc.lpwfxFormat = &wfx.Format; + memset(&desc, 0, sizeof(DSBUFFERDESC)); + desc.dwSize = sizeof(DSBUFFERDESC); + desc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY;// _CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY; + desc.dwBufferBytes = DSound51::BufferSizeBytes * numBuffers; + desc.lpwfxFormat = &wfx.Format; desc.dwFlags |=DSBCAPS_LOCSOFTWARE; desc.dwFlags|=DSBCAPS_GLOBALFOCUS; @@ -275,10 +275,10 @@ DWORD DSound51_Driver::WorkerThread() { // DPL2 code here: inputs s[0] and s[1]. outputs t[0] to t[5] dpl2.Convert( t, s[0], s[1] ); - + t+=6; s+=2; - } + } } #ifndef PUBLIC @@ -330,7 +330,7 @@ BOOL CALLBACK DSound51::ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lPar case WM_INITDIALOG: haveGuid = ! FAILED(GUIDFromString(Config_DSound51.Device,&DevGuid)); - SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_RESETCONTENT,0,0); + SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_RESETCONTENT,0,0); ndevs=0; DirectSoundEnumerate(DSEnumCallback,NULL); @@ -359,30 +359,30 @@ BOOL CALLBACK DSound51::ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lPar 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_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_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 ); + 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); + 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); + 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 "" @@ -427,8 +427,8 @@ BOOL CALLBACK DSound51::ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lPar break; case WM_HSCROLL: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); switch(wmId) { //case TB_ENDTRACK: //case TB_THUMBPOSITION: @@ -498,4 +498,4 @@ const char* DSound51::GetLongName() const return "DSound 5.1 (Experimental)"; } -SndOutModule *DSound51Out=&DS51; \ No newline at end of file +SndOutModule *DSound51Out=&DS51; diff --git a/plugins/spu2-x/src/Windows/RealtimeDebugger.cpp b/plugins/spu2-x/src/Windows/RealtimeDebugger.cpp index d4a9e2ab4d..9c76eefeca 100644 --- a/plugins/spu2-x/src/Windows/RealtimeDebugger.cpp +++ b/plugins/spu2-x/src/Windows/RealtimeDebugger.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -36,10 +36,10 @@ static BOOL CALLBACK DebugProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) debugDialogOpen=true; } break; - + case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { @@ -52,7 +52,7 @@ static BOOL CALLBACK DebugProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) return FALSE; } break; - + default: return FALSE; } diff --git a/plugins/spu2-x/src/Windows/SndOut_DSound.cpp b/plugins/spu2-x/src/Windows/SndOut_DSound.cpp index 87bde40bda..ba4ebcd45d 100644 --- a/plugins/spu2-x/src/Windows/SndOut_DSound.cpp +++ b/plugins/spu2-x/src/Windows/SndOut_DSound.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -45,7 +45,7 @@ private: ////////////////////////////////////////////////////////////////////////////////////////// // Instance vars - + int channel; int myLastWrite; // last write position, in bytes @@ -76,11 +76,11 @@ private: while( dsound_running ) { u32 rv = WaitForMultipleObjects(m_NumBuffers,buffer_events,FALSE,200); - + T* p1, *oldp1; LPVOID p2; DWORD s1,s2; - + u32 poffset = BufferSizeBytes * rv; if( FAILED(buffer->Lock(poffset,BufferSizeBytes,(LPVOID*)&p1,&s1,&p2,&s2,0) ) ) @@ -116,11 +116,11 @@ public: { if( m_Device.empty() ) throw std::runtime_error( "screw it" ); - + // Convert from unicode to ANSI: char guid[256]; sprintf_s( guid, "%S", m_Device.c_str() ); - + if( (FAILED(GUIDFromString( guid, &cGuid ))) || FAILED( DirectSoundCreate8(&cGuid,&dsound,NULL) ) ) throw std::runtime_error( "try again?" ); @@ -134,19 +134,19 @@ public: if( FAILED(dsound->SetCooperativeLevel(GetDesktopWindow(),DSSCL_PRIORITY)) ) throw std::runtime_error( "DirectSound Error: Cooperative level could not be set." ); - + // Determine the user's speaker configuration, and select an expansion option as needed. // FAIL : Directsound doesn't appear to support audio expansion >_< - + DWORD speakerConfig = 2; //dsound->GetSpeakerConfig( &speakerConfig ); IDirectSoundBuffer* buffer_; - DSBUFFERDESC desc; - - // Set up WAV format structure. - - memset(&wfx, 0, sizeof(WAVEFORMATEX)); + DSBUFFERDESC desc; + + // Set up WAV format structure. + + memset(&wfx, 0, sizeof(WAVEFORMATEX)); wfx.wFormatTag = WAVE_FORMAT_PCM; wfx.nSamplesPerSec = SampleRate; wfx.nChannels = (WORD)speakerConfig; @@ -156,21 +156,21 @@ public: wfx.cbSize = 0; uint BufferSizeBytes = BufferSize * wfx.nBlockAlign; - - // Set up DSBUFFERDESC structure. - - memset(&desc, 0, sizeof(DSBUFFERDESC)); - desc.dwSize = sizeof(DSBUFFERDESC); + + // Set up DSBUFFERDESC structure. + + memset(&desc, 0, sizeof(DSBUFFERDESC)); + desc.dwSize = sizeof(DSBUFFERDESC); desc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY; desc.dwBufferBytes = BufferSizeBytes * m_NumBuffers; desc.lpwfxFormat = &wfx; - + // Try a hardware buffer first, and then fall back on a software buffer if // that one fails. - + desc.dwFlags |= m_UseHardware ? DSBCAPS_LOCHARDWARE : DSBCAPS_LOCSOFTWARE; desc.dwFlags |= m_DisableGlobalFocus ? DSBCAPS_STICKYFOCUS : DSBCAPS_GLOBALFOCUS; - + if( FAILED(dsound->CreateSoundBuffer(&desc, &buffer_, 0) ) ) { if( m_UseHardware ) @@ -191,24 +191,24 @@ public: verifyc( buffer->QueryInterface(IID_IDirectSoundNotify8,(void**)&buffer_notify) ); DSBPOSITIONNOTIFY not[MAX_BUFFER_COUNT]; - + for(uint i=0;iSetNotificationPositions(m_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)); @@ -226,7 +226,7 @@ public: // Stop Thread fprintf(stderr," * SPU2: Waiting for DSound thread to finish..."); dsound_running=false; - + WaitForSingleObject(thread,INFINITE); CloseHandle(thread); @@ -238,7 +238,7 @@ public: if( buffer != NULL ) { buffer->Stop(); - + for(u32 i=0;iGetCurrentPosition( &play, &write ); @@ -452,7 +452,7 @@ public: { return L"DirectSound (nice)"; } - + void ReadSettings() { CfgReadStr( L"DSOUNDOUT", L"Device", m_Device, 254, L"default" ); @@ -476,7 +476,7 @@ public: BOOL CALLBACK DSound::ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { return DS._ConfigProc( hWnd, uMsg, wParam, lParam ); -} +} BOOL CALLBACK DSound::DSEnumCallback( LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext ) { diff --git a/plugins/spu2-x/src/Windows/SndOut_XAudio2.cpp b/plugins/spu2-x/src/Windows/SndOut_XAudio2.cpp index c13447a2dc..6e949b9969 100644 --- a/plugins/spu2-x/src/Windows/SndOut_XAudio2.cpp +++ b/plugins/spu2-x/src/Windows/SndOut_XAudio2.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -85,7 +85,7 @@ private: CRITICAL_SECTION cs; public: - int GetEmptySampleCount() + int GetEmptySampleCount() { XAUDIO2_VOICE_STATE state; pSourceVoice->GetState( &state ); @@ -103,14 +103,14 @@ private: m_BufferSizeBytes( m_BufferSize * sizeof(s16) ) { } - + virtual void Init( IXAudio2* pXAudio2 ) = 0; - + protected: // Several things must be initialized separate of the constructor, due to the fact that // virtual calls can't be made from the constructor's context. void _init( IXAudio2* pXAudio2, uint chanConfig ) - { + { WAVEFORMATEXTENSIBLE wfx; memset(&wfx, 0, sizeof(WAVEFORMATEXTENSIBLE)); @@ -163,10 +163,10 @@ private: STDMETHOD_(void, OnVoiceProcessingPassEnd) () {} STDMETHOD_(void, OnStreamEnd) () {} STDMETHOD_(void, OnBufferStart) ( void* ) {} - STDMETHOD_(void, OnLoopEnd) ( void* ) {} + STDMETHOD_(void, OnLoopEnd) ( void* ) {} STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) { }; }; - + template< typename T > class StreamingVoice : public BaseStreamingVoice { @@ -175,7 +175,7 @@ private: BaseStreamingVoice( sizeof(T) / sizeof( s16 ) ) { } - + virtual ~StreamingVoice() { IXAudio2SourceVoice* killMe = pSourceVoice; @@ -297,7 +297,7 @@ public: ConLog( "* SPU2 > 4 speaker expansion enabled [quadraphenia]\n" ); voiceContext = new StreamingVoice( pXAudio2 ); break; - + case 5: ConLog( "* SPU2 > 4.1 speaker expansion enabled.\n" ); voiceContext = new StreamingVoice( pXAudio2 ); @@ -315,7 +315,7 @@ public: voiceContext = new StreamingVoice( pXAudio2 ); break; } - + voiceContext->Init( pXAudio2 ); } catch( Exception::XAudio2Error& ex ) @@ -364,7 +364,7 @@ public: return 0; } - int GetEmptySampleCount() + int GetEmptySampleCount() { if( voiceContext == NULL ) return 0; return voiceContext->GetEmptySampleCount(); @@ -383,7 +383,7 @@ public: void ReadSettings() { } - + void WriteSettings() const { } diff --git a/plugins/spu2-x/src/Windows/SndOut_waveOut.cpp b/plugins/spu2-x/src/Windows/SndOut_waveOut.cpp index 905f5a7cad..8b2de3a5a3 100644 --- a/plugins/spu2-x/src/Windows/SndOut_waveOut.cpp +++ b/plugins/spu2-x/src/Windows/SndOut_waveOut.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -96,7 +96,7 @@ public: int speakerConfig; if( StereoExpansionEnabled ) - speakerConfig = 2; // better not mess with this in wavout :p (rama) + speakerConfig = 2; // better not mess with this in wavout :p (rama) // Any windows driver should support stereo at the software level, I should think! jASSUME( speakerConfig > 1 ); @@ -138,7 +138,7 @@ public: wformat.nBlockAlign = ((wformat.wBitsPerSample * wformat.nChannels) / 8); wformat.nAvgBytesPerSec = (wformat.nSamplesPerSec * wformat.nBlockAlign); wformat.cbSize = 0; - + qbuffer = new StereoOut16[BufferSize*numBuffers]; woores = waveOutOpen(&hwodevice,WAVE_MAPPER,&wformat,0,0,0); @@ -176,12 +176,12 @@ public: return 0; } - void Close() + void Close() { // Stop Thread fprintf(stderr," * SPU2: Waiting for waveOut thread to finish..."); waveout_running=false; - + WaitForSingleObject(thread,INFINITE); CloseHandle(thread); @@ -213,14 +213,14 @@ private: wchar_t temp[128]; INIT_SLIDER( IDC_BUFFERS_SLIDER, 3, MAX_BUFFER_COUNT, 2, 1, 1 ); - SendMessage(GetDlgItem(hWnd,IDC_BUFFERS_SLIDER),TBM_SETPOS,TRUE,Config_WaveOut.NumBuffers); + SendMessage(GetDlgItem(hWnd,IDC_BUFFERS_SLIDER),TBM_SETPOS,TRUE,Config_WaveOut.NumBuffers); swprintf_s(temp, 128, L"%d (%d ms latency)",Config_WaveOut.NumBuffers, 1000 / (96000 / (Config_WaveOut.NumBuffers * BufferSize))); SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp); break; case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { @@ -242,8 +242,8 @@ private: break; case WM_HSCROLL: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); switch(wmId) { //case TB_ENDTRACK: //case TB_THUMBPOSITION: @@ -292,7 +292,7 @@ public: return 0; } - int GetEmptySampleCount() + int GetEmptySampleCount() { int result = 0; for(int i=0;i. */ - + #include "Global.h" #include "Dialogs.h" @@ -64,7 +64,7 @@ __forceinline void Verifyc(HRESULT hr, const char* fn) void AssignSliderValue( HWND idcwnd, HWND hwndDisplay, int value ) { value = std::min( std::max( value, 0 ), 512 ); - SendMessage(idcwnd,TBM_SETPOS,TRUE,value); + SendMessage(idcwnd,TBM_SETPOS,TRUE,value); wchar_t tbox[32]; swprintf_s( tbox, L"%d", value ); @@ -81,8 +81,8 @@ void AssignSliderValue( HWND hWnd, int idc, int editbox, int value ) // updating a custom label. BOOL DoHandleScrollMessage( HWND hwndDisplay, WPARAM wParam, LPARAM lParam ) { - int wmId = LOWORD(wParam); - int wmEvent = HIWORD(wParam); + int wmId = LOWORD(wParam); + int wmEvent = HIWORD(wParam); static char temp[64]; switch(wmId) { diff --git a/plugins/spu2-x/src/Windows/dsp.h b/plugins/spu2-x/src/Windows/dsp.h index e3d3c2ce4a..437d082d29 100644 --- a/plugins/spu2-x/src/Windows/dsp.h +++ b/plugins/spu2-x/src/Windows/dsp.h @@ -39,7 +39,7 @@ typedef struct winampDSPModule { // (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 diff --git a/plugins/spu2-x/src/Windows/resource.h b/plugins/spu2-x/src/Windows/resource.h index 61831378ac..e1ac30294d 100644 --- a/plugins/spu2-x/src/Windows/resource.h +++ b/plugins/spu2-x/src/Windows/resource.h @@ -56,7 +56,7 @@ #define IDC_USE_HARDWARE 1061 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 119 diff --git a/plugins/spu2-x/src/defs.h b/plugins/spu2-x/src/defs.h index d5cf9eba1a..b610c6051a 100644 --- a/plugins/spu2-x/src/defs.h +++ b/plugins/spu2-x/src/defs.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -45,7 +45,7 @@ struct V_VolumeLR Right( both ) { } - + void DebugDump( FILE* dump, const char* title ); }; @@ -53,12 +53,12 @@ struct V_VolumeSlide { // Holds the "original" value of the volume for this voice, prior to slides. // (ie, the volume as written to the register) - + s16 Reg_VOL; s32 Value; s8 Increment; s8 Mode; - + public: V_VolumeSlide() {} V_VolumeSlide( s16 regval, s32 fullvol ) : @@ -83,7 +83,7 @@ struct V_VolumeSlideLR public: V_VolumeSlideLR() {} - + V_VolumeSlideLR( s16 regval, s32 bothval ) : Left( regval, bothval ), Right( regval, bothval ) @@ -95,7 +95,7 @@ public: Left.Update(); Right.Update(); } - + void DebugDump( FILE* dump, const char* title ); }; @@ -104,14 +104,14 @@ struct V_ADSR union { u32 reg32; - - struct + + struct { u16 regADSR1; u16 regADSR2; }; - - struct + + struct { u32 SustainLevel:4, DecayRate:4, @@ -143,9 +143,9 @@ struct V_Voice // Envelope V_ADSR ADSR; // Pitch (also Reg_PITCH) - s16 Pitch; + s16 Pitch; // Loop Start address (also Reg_LSAH/L) - u32 LoopStartA; + u32 LoopStartA; // Sound Start address (also Reg_SSAH/L) u32 StartA; // Next Read Data address (also Reg_NAXH/L) @@ -224,7 +224,7 @@ struct V_Reverb s16 FB_ALPHA; s16 FB_X; - + u32 IIR_SRC_A0; u32 IIR_SRC_A1; u32 IIR_SRC_B1; @@ -286,7 +286,7 @@ struct V_ReverbBuffers s32 MIX_DEST_A1; s32 MIX_DEST_B0; s32 MIX_DEST_B1; - + bool NeedsUpdated; }; @@ -331,7 +331,7 @@ struct V_CoreGates { u128 v128; - struct + struct { s16 InpL; // Sound Data Input to Direct Output (Left) s16 InpR; // Sound Data Input to Direct Output (Right) @@ -341,7 +341,7 @@ struct V_CoreGates s16 ExtR; // External Input to Direct Output (Right) }; }; - + }; struct VoiceMixSet @@ -373,10 +373,10 @@ struct V_Core V_VolumeSlideLR MasterVol; // Master Volume V_VolumeLR ExtVol; // Volume for External Data Input V_VolumeLR InpVol; // Volume for Sound Data Input - V_VolumeLR FxVol; // Volume for Output from Effects + V_VolumeLR FxVol; // Volume for Output from Effects V_Voice Voices[NumVoices]; - + u32 IRQA; // Interrupt Address u32 TSA; // DMA Transfer Start Address u32 TDA; // DMA Transfer Data Address (Internal...) @@ -400,12 +400,12 @@ struct V_Core u32 EffectsStartA; u32 EffectsEndA; u32 ReverbX; - + // Current size of the effects buffer. Pre-caculated when the effects start // or end position registers are written. CAN BE NEGATIVE OR ZERO, in which // case reverb should be disabled. s32 EffectsBufferSize; - + V_CoreRegs Regs; // Registers // Last samples to pass through the effects processor. @@ -455,7 +455,7 @@ struct V_Core void WriteRegPS1( u32 mem, u16 value ); u16 ReadRegPS1( u32 mem ); - + // -------------------------------------------------------------------------------------- // Mixer Section // -------------------------------------------------------------------------------------- @@ -467,7 +467,7 @@ struct V_Core StereoOut32 ReadInput(); StereoOut32 ReadInput_HiFi(); - + // -------------------------------------------------------------------------- // DMA Section // -------------------------------------------------------------------------- diff --git a/plugins/spu2-x/src/regs.h b/plugins/spu2-x/src/regs.h index 38d11cd1b9..9cbc63f029 100644 --- a/plugins/spu2-x/src/regs.h +++ b/plugins/spu2-x/src/regs.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -50,7 +50,7 @@ #define REG_A_TSA 0x01A8 // Transfer starting address #define REG__1AC 0x01AC // Transfer data -#define REG__1AE 0x01AE +#define REG__1AE 0x01AE #define REG_S_ADMAS 0x01B0 // AutoDMA Status // 1b2, 1b4, 1b6, 1b8, 1ba, 1bc, 1be are unknown @@ -117,7 +117,7 @@ #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_FB_X 0x0782 //feedback #define R_IN_COEF_L 0x0784 #define R_IN_COEF_R 0x0786 @@ -127,9 +127,9 @@ // SPDIF interface #define SPDIF_OUT 0x07C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass -#define SPDIF_IRQINFO 0x07C2 -#define SPDIF_MODE 0x07C6 -#define SPDIF_MEDIA 0x07C8 // SPDIF Media: 'CD'/DVD +#define SPDIF_IRQINFO 0x07C2 +#define SPDIF_MODE 0x07C6 +#define SPDIF_MEDIA 0x07C8 // SPDIF Media: 'CD'/DVD #define SPDIF_PROTECT 0x07CC // SPDIF Copy Protection diff --git a/plugins/spu2-x/src/spu2freeze.cpp b/plugins/spu2-x/src/spu2freeze.cpp index 7956c62086..c5d839630c 100644 --- a/plugins/spu2-x/src/spu2freeze.cpp +++ b/plugins/spu2-x/src/spu2freeze.cpp @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz] * * SPU2-X is free software: you can redistribute it and/or modify it under the terms @@ -83,7 +83,7 @@ s32 __fastcall Savestate::ThawIt( DataBlock& spud ) else fprintf(stderr, "\tThe savestate you are trying to load was not made with this plugin.\n"); - fprintf(stderr, + fprintf(stderr, "\tAudio may not recover correctly. Save your game to memorycard, reset,\n\n" "\tand then continue from there.\n\n" ); diff --git a/plugins/spu2-x/src/spu2sys.cpp b/plugins/spu2-x/src/spu2sys.cpp index 55c7aebfc0..f6c6e47573 100644 --- a/plugins/spu2-x/src/spu2sys.cpp +++ b/plugins/spu2-x/src/spu2sys.cpp @@ -111,7 +111,7 @@ void V_Core::Reset( int index ) { ConLog( " * SPU2: RESET SPU2 core%d \n", index ); memset( this, 0, sizeof(V_Core) ); - + const int c = Index = index; Regs.STATX = 0; @@ -283,7 +283,7 @@ __forceinline void TimeUpdate(u32 cClocks) // such cases we just want to ignore the TimeUpdate call. if( dClocks > (u32)-15 ) return; - + // But if for some reason our clock value seems way off base (typically due to bad dma // timings from PCSX2), just mix out a little bit, skip the rest, and hope the ship // "rights" itself later on. @@ -830,9 +830,9 @@ static void __fastcall RegWrite_Core( u16 value ) // optimized block copy fashion elsewhere, but some games will write this register // directly, so handle those here: - // Performance Note: The PS2 Bios uses this extensively right before booting games, + // Performance Note: The PS2 Bios uses this extensively right before booting games, // causing massive slowdown if we don't shortcut it here. - + for( int i=0; i<2; i++ ) { if(Cores[i].IRQEnable && (Cores[i].IRQA == thiscore.TSA)) @@ -843,7 +843,7 @@ static void __fastcall RegWrite_Core( u16 value ) } thiscore.DmaWrite( value ); break; - + case REG_C_ATTR: { bool irqe = thiscore.IRQEnable; @@ -1058,7 +1058,7 @@ static void __fastcall RegWrite_Core( u16 value ) thiscore.AdmaInProgress=0; } break; - + default: { const int addr = omem | ( (core == 1) ? 0x400 : 0 ); @@ -1197,7 +1197,7 @@ static void __fastcall RegWrite_Raw( u16 value ) // -------------------------------------------------------------------------------------- typedef void __fastcall RegWriteHandler( u16 value ); -static RegWriteHandler * const tbl_reg_writes[0x401] = +static RegWriteHandler * const tbl_reg_writes[0x401] = { VoiceParamsCore(0), // 0x000 -> 0x180 CoreParamsPair(0,REG_S_PMON), @@ -1215,16 +1215,16 @@ static RegWriteHandler * const tbl_reg_writes[0x401] = CoreParamsPair(0,REG_S_KOFF), CoreParamsPair(0,REG_A_TSA), CoreParamsPair(0,REG__1AC), - + RegWrite_Core<0,REG_S_ADMAS>, REGRAW(0x1b2), - + REGRAW(0x1b4), REGRAW(0x1b6), REGRAW(0x1b8), REGRAW(0x1ba), REGRAW(0x1bc), REGRAW(0x1be), - + // 0x1c0! - + VoiceAddrSet(0, 0),VoiceAddrSet(0, 1),VoiceAddrSet(0, 2),VoiceAddrSet(0, 3),VoiceAddrSet(0, 4),VoiceAddrSet(0, 5), VoiceAddrSet(0, 6),VoiceAddrSet(0, 7),VoiceAddrSet(0, 8),VoiceAddrSet(0, 9),VoiceAddrSet(0,10),VoiceAddrSet(0,11), VoiceAddrSet(0,12),VoiceAddrSet(0,13),VoiceAddrSet(0,14),VoiceAddrSet(0,15),VoiceAddrSet(0,16),VoiceAddrSet(0,17), @@ -1285,7 +1285,7 @@ static RegWriteHandler * const tbl_reg_writes[0x401] = REGRAW(0x3E8),REGRAW(0x3EA),REGRAW(0x3EC),REGRAW(0x3EE), REGRAW(0x3F0),REGRAW(0x3F2),REGRAW(0x3F4),REGRAW(0x3F6), REGRAW(0x3F8),REGRAW(0x3FA),REGRAW(0x3FC),REGRAW(0x3FE), - + // AND... we reached 0x400! // Last verse, same as the first: @@ -1305,16 +1305,16 @@ static RegWriteHandler * const tbl_reg_writes[0x401] = CoreParamsPair(1,REG_S_KOFF), CoreParamsPair(1,REG_A_TSA), CoreParamsPair(1,REG__1AC), - + RegWrite_Core<1,REG_S_ADMAS>, REGRAW(0x5b2), - + REGRAW(0x5b4), REGRAW(0x5b6), REGRAW(0x5b8), REGRAW(0x5ba), REGRAW(0x5bc), REGRAW(0x5be), - + // 0x1c0! - + VoiceAddrSet(1, 0),VoiceAddrSet(1, 1),VoiceAddrSet(1, 2),VoiceAddrSet(1, 3),VoiceAddrSet(1, 4),VoiceAddrSet(1, 5), VoiceAddrSet(1, 6),VoiceAddrSet(1, 7),VoiceAddrSet(1, 8),VoiceAddrSet(1, 9),VoiceAddrSet(1,10),VoiceAddrSet(1,11), VoiceAddrSet(1,12),VoiceAddrSet(1,13),VoiceAddrSet(1,14),VoiceAddrSet(1,15),VoiceAddrSet(1,16),VoiceAddrSet(1,17), @@ -1356,7 +1356,7 @@ static RegWriteHandler * const tbl_reg_writes[0x401] = REGRAW(0x758),REGRAW(0x75A),REGRAW(0x75C),REGRAW(0x75E), // ------ ------- - + RegWrite_CoreExt<0,REG_P_MVOLL>, // 0x0760 // Master Volume Left RegWrite_CoreExt<0,REG_P_MVOLR>, // 0x0762 // Master Volume Right RegWrite_CoreExt<0,REG_P_EVOLL>, // 0x0764 // Effect Volume Left @@ -1375,7 +1375,7 @@ static RegWriteHandler * const tbl_reg_writes[0x401] = RegWrite_CoreExt<0,R_ACC_COEF_D>, // 0x077C RegWrite_CoreExt<0,R_IIR_COEF>, // 0x077E RegWrite_CoreExt<0,R_FB_ALPHA>, // 0x0780 //feedback alpha (% used) - RegWrite_CoreExt<0,R_FB_X>, // 0x0782 //feedback + RegWrite_CoreExt<0,R_FB_X>, // 0x0782 //feedback RegWrite_CoreExt<0,R_IN_COEF_L>, // 0x0784 RegWrite_CoreExt<0,R_IN_COEF_R>, // 0x0786 @@ -1399,7 +1399,7 @@ static RegWriteHandler * const tbl_reg_writes[0x401] = RegWrite_CoreExt<1,R_ACC_COEF_D>, // 0x077C RegWrite_CoreExt<1,R_IIR_COEF>, // 0x077E RegWrite_CoreExt<1,R_FB_ALPHA>, // 0x0780 //feedback alpha (% used) - RegWrite_CoreExt<1,R_FB_X>, // 0x0782 //feedback + RegWrite_CoreExt<1,R_FB_X>, // 0x0782 //feedback RegWrite_CoreExt<1,R_IN_COEF_L>, // 0x0784 RegWrite_CoreExt<1,R_IN_COEF_R>, // 0x0786 @@ -1409,10 +1409,10 @@ static RegWriteHandler * const tbl_reg_writes[0x401] = // SPDIF interface RegWrite_SPDIF, // 0x07C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass - RegWrite_SPDIF, // 0x07C2 + RegWrite_SPDIF, // 0x07C2 REGRAW(0x7C4), - RegWrite_SPDIF, // 0x07C6 - RegWrite_SPDIF, // 0x07C8 // SPDIF Media: 'CD'/DVD + RegWrite_SPDIF, // 0x07C6 + RegWrite_SPDIF, // 0x07C8 // SPDIF Media: 'CD'/DVD REGRAW(0x7CA), RegWrite_SPDIF, // 0x07CC // SPDIF Copy Protection @@ -1432,14 +1432,14 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value ) { // Check for these 2 adresses and schedule an interrupt when they get written with 0x3fff. // This is what peops spu2 does, and it helps silent hill origins start a bit more stuff. - + // Update: 0x1f900400 is core0's volume register. Interrupting here is wrong. // So SH:O just set the volume to max, which is a pretty normal operation anyway. // Keeping this in for reference :p //if (value == 0x3fff && (rmem == 0x1f900500 || rmem == 0x1f900400) ) { // // no idea which core >< - // Spdif.Info |= 4 << 0; + // Spdif.Info |= 4 << 0; // SetIrqCall(); // ConLog( "SPU2-X: Schedule IRQ for odd register write. rmem = %x , value = %x \n", rmem, value); //} diff --git a/plugins/xpad/resource.h b/plugins/xpad/resource.h index d908e401a8..8c0ea45b17 100644 --- a/plugins/xpad/resource.h +++ b/plugins/xpad/resource.h @@ -5,7 +5,7 @@ // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 10000 diff --git a/plugins/xpad/stdafx.h b/plugins/xpad/stdafx.h index 9bf9ae82df..82f2547898 100644 --- a/plugins/xpad/stdafx.h +++ b/plugins/xpad/stdafx.h @@ -7,8 +7,8 @@ #pragma warning(disable: 4996 4995 4324 4100 4101 4201) // The following macros define the minimum required platform. The minimum required platform -// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run -// your application. The macros work by enabling all features available on platform versions up to and +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and // including the version specified. // Modify the following defines if you have to target a platform prior to the ones specified below. diff --git a/plugins/xpad/xpad.cpp b/plugins/xpad/xpad.cpp index 26ca027d60..f3425cb8ab 100644 --- a/plugins/xpad/xpad.cpp +++ b/plugins/xpad/xpad.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -41,7 +41,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv // -static struct +static struct { static const UINT32 revision = 0; static const UINT32 build = 2; @@ -86,7 +86,7 @@ EXPORT_C_(UINT32) PS2EgetLibVersion2(UINT32 type) struct XPadButton { - enum + enum { Select = 0x0001, L3 = 0x0002, @@ -132,7 +132,7 @@ public: if(now > m_lastpoll + delay) { memset(&m_state, 0, sizeof(m_state)); - + m_connected = XInputGetState(m_pad, &m_state) == S_OK; // ERROR_DEVICE_NOT_CONNECTED is not an error, SUCCEEDED(...) won't work here m_lastpoll = now; @@ -181,7 +181,7 @@ public: { m_buttons &= ~flag; } - else + else { m_buttons |= flag; } @@ -195,7 +195,7 @@ public: } public: - XPad(int pad) + XPad(int pad) : m_xinput(pad) , m_ds2native(false) , m_analog(!s_ps2) // defaults to analog off for ps2 @@ -269,7 +269,7 @@ public: vibraton.wLeftMotorSpeed = m_large << 8; vibraton.wRightMotorSpeed = m_small << 8; } - + m_xinput.SetState(vibraton); } } @@ -312,9 +312,9 @@ static class XPadPlugin { switch(index) { - case 2: + case 2: return 0x02; - case 5: + case 5: return 'Z'; } @@ -327,17 +327,17 @@ static class XPadPlugin { switch(index) { - case 0: + case 0: return 0xff; - case 1: + case 1: return 0xff; - case 2: + case 2: return 3; - case 3: + case 3: return 0; - case 4: + case 4: return 0; - case 5: + case 5: return 'Z'; } } @@ -349,10 +349,10 @@ static class XPadPlugin { switch(index) { - case 0: + case 0: m_pad->m_small = value == 1 ? 128 : 0; // RE4 map menu, value = 2 break; - case 1: + case 1: m_pad->m_large = value; break; } @@ -364,7 +364,7 @@ static class XPadPlugin { switch(index) { - case 0: + case 0: switch(value) { case 0: @@ -389,11 +389,11 @@ static class XPadPlugin { switch(index) { - case 0: - // if(!m_pad->m_locked) ? + case 0: + // if(!m_pad->m_locked) ? m_pad->m_analog = value == 1; break; - case 1: + case 1: m_pad->m_locked = value == 3; break; } @@ -405,9 +405,9 @@ static class XPadPlugin { switch(index) { - case 0: + case 0: return 3; - case 1: + case 1: return 2; case 2: return m_pad->m_analog ? 1 : 0; @@ -424,7 +424,7 @@ static class XPadPlugin { switch(index) { - case 0: + case 0: m_unknown1 = value; return 0; case 1: @@ -459,7 +459,7 @@ static class XPadPlugin { switch(index) { - case 0: + case 0: m_unknown3 = value; return 0; case 3: @@ -473,9 +473,9 @@ static class XPadPlugin { switch(index) { - case 0: + case 0: return value; - case 1: + case 1: m_pad->m_vibration = value == 1; return value; } @@ -487,7 +487,7 @@ static class XPadPlugin { switch(index) { - case 5: + case 5: m_pad->m_ds2native = true; return 'Z'; } @@ -580,7 +580,7 @@ static int s_nRefs = 0; static HWND s_hWnd = NULL; static WNDPROC s_GSWndProc = NULL; -static class CKeyEventList : protected list, protected CCritSec +static class CKeyEventList : protected list, protected CCritSec { public: void Push(UINT32 event, UINT32 key) @@ -604,7 +604,7 @@ public: e = front(); pop_front(); - + return true; } diff --git a/plugins/xpad/xpad.h b/plugins/xpad/xpad.h index 1c4f48e165..2990d2595e 100644 --- a/plugins/xpad/xpad.h +++ b/plugins/xpad/xpad.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2007 Gabest * http://www.gabest.org * @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -44,10 +44,10 @@ struct PadDataS { // controler type - fill it withe predefined values above BYTE type; - + // status of buttons - every controller fills this field WORD status; - + // for analog pad fill those next 4 bytes // values are analog in range 0-255 where 128 is center position BYTE rightJoyX, rightJoyY, leftJoyX, leftJoyY; diff --git a/plugins/zerogs/dx/GS.h b/plugins/zerogs/dx/GS.h index e81f2f9e79..5293e767ab 100644 --- a/plugins/zerogs/dx/GS.h +++ b/plugins/zerogs/dx/GS.h @@ -48,14 +48,14 @@ typedef int BOOL; #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) #define FASTCALL(fn) __fastcall fn #else #ifdef __x86_64 #define FASTCALL(fn) fn #else -#define FASTCALL(fn) __attribute__((fastcall)) fn +#define FASTCALL(fn) __attribute__((fastcall)) fn #endif #endif @@ -373,7 +373,7 @@ typedef struct { u32 options; u32 gamesettings; // default game settings int width, height; - int winstyle; // window style before full screen + int winstyle; // window style before full screen #ifdef GS_LOG u32 log; #endif @@ -453,7 +453,7 @@ typedef struct { typedef struct { u16 prim; - + union { struct { u16 iip : 1; @@ -587,12 +587,12 @@ typedef struct { tagInfo tag; } pathInfo; -typedef struct { +typedef struct { Vertex gsvertex[3]; u32 rgba; float q; Vertex vertexregs; - + int primC; // number of verts current storing int primIndex; // current prim index int nTriFanVert; @@ -614,13 +614,13 @@ typedef struct { bufInfo dstbuf, dstbufnew; clutInfo clut; - + texaInfo texa; trxposInfo trxpos, trxposnew; int imageWtemp, imageHtemp; - int imageTransfer; + int imageTransfer; int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY; pathInfo path1; @@ -662,7 +662,7 @@ public: inline T* operator->() { return ptr; } inline T* get() { return ptr; } - inline void release() { + inline void release() { if( ptr != NULL ) { ptr->Release(); ptr = NULL; } } diff --git a/plugins/zerogs/dx/GSmain.cpp b/plugins/zerogs/dx/GSmain.cpp index e5b0ae53ae..2609902a39 100644 --- a/plugins/zerogs/dx/GSmain.cpp +++ b/plugins/zerogs/dx/GSmain.cpp @@ -211,7 +211,7 @@ void CALLBACK GSsetFrameSkip(int frameskip) { s_frameskipping |= frameskip; if( frameskip && g_nFrameRender > 1 ) { - + for(int i = 0; i < 16; ++i) { g_GIFPackedRegHandlers[i] = GIFPackedRegHandlerNOP; } @@ -259,7 +259,7 @@ void CALLBACK GSreset() { memset(&gs, 0, sizeof(gs)); ZeroGS::GSStateReset(); - + gs.prac = 1; prim = &gs._prim[0]; gs.nTriFanVert = -1; @@ -369,12 +369,12 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) { g_GameSettings = 0; strcpy(GStitle, Title); - + RECT rc, rcdesktop; rc.left = 0; rc.top = 0; rc.right = conf.width; rc.bottom = conf.height; - WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, + WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, "PS2EMU_ZEROGS", NULL }; RegisterClassEx( &wc ); @@ -422,7 +422,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) { // set just in case SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)MsgProc); - + ShowWindow( GShwnd, SW_SHOWDEFAULT ); UpdateWindow( GShwnd ); SetFocus(GShwnd); @@ -442,7 +442,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) { gs.path2.mode = 0; gs.path3.mode = 0; - return 0; + return 0; } void CALLBACK GSclose() { @@ -474,9 +474,9 @@ void CALLBACK GSchangeSaveState(int newstate, const char* filename) void CALLBACK GSmakeSnapshot(char *path) { FILE *bmpfile; - char filename[256]; + char filename[256]; u32 snapshotnr = 0; - + // increment snapshot value & try to get filename for (;;) { snapshotnr++; @@ -518,10 +518,10 @@ void CALLBACK GSvsync(int interlace) static int nToNextUpdate = 1; char strtitle[512]; - + g_nRealFrame++; - MSG msg; + MSG msg; ZeroMemory( &msg, sizeof(msg) ); while( 1 ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) @@ -551,7 +551,7 @@ void CALLBACK GSvsync(int interlace) SaveConfig(); } else if( msg.wParam == VK_F6 ) { - + if( (GetKeyState(VK_SHIFT)&0x8000) ) { conf.aa--; // -1 if( conf.aa > 4) conf.aa = 4; @@ -602,7 +602,7 @@ void CALLBACK GSvsync(int interlace) else if( msg.wParam == VK_ESCAPE ) { if( conf.options & GSOPTION_FULLSCREEN ) { - // destroy that msg + // destroy that msg conf.options &= ~GSOPTION_FULLSCREEN; conf.winstyle = GetWindowLong( GShwnd, GWL_STYLE ); conf.winstyle &= ~WS_MAXIMIZE & ~WS_MINIMIZE; // remove minimize/maximize style @@ -616,7 +616,7 @@ void CALLBACK GSvsync(int interlace) return; } } - + break; } @@ -667,7 +667,7 @@ void CALLBACK GSvsync(int interlace) (g_GameSettings&GAME_FFXHACK) ? "ffxhack | " : "", g_pShaders[g_nPixelShaderVer], (ppf&0xfffff)/(float)UPDATE_FRAMES); #else - _snprintf(strtitle, 512, "%d | %.1f fps (sk:%d%%) | g: %.1f, t: %.1f, a: %.1f, r: %.1f | p: %.1f | tex: %d %d (%d kbpf)", g_nFrame, fFPS, + _snprintf(strtitle, 512, "%d | %.1f fps (sk:%d%%) | g: %.1f, t: %.1f, a: %.1f, r: %.1f | p: %.1f | tex: %d %d (%d kbpf)", g_nFrame, fFPS, 100*g_nFramesSkipped/g_nFrame, g_nGenVars/(float)UPDATE_FRAMES, g_nTexVars/(float)UPDATE_FRAMES, g_nAlphaVars/(float)UPDATE_FRAMES, g_nResolve/(float)UPDATE_FRAMES, (ppf&0xfffff)/(float)UPDATE_FRAMES, @@ -696,14 +696,14 @@ void CALLBACK GSvsync(int interlace) } void GIFtag(pathInfo *path, u32 *data) { - + path->tag.nloop = data[0] & 0x7fff; path->tag.eop = (data[0] >> 15) & 0x1; u32 tagpre = (data[1] >> 14) & 0x1; u32 tagprim = (data[1] >> 15) & 0x7ff; u32 tagflg = (data[1] >> 26) & 0x3; path->tag.nreg = (data[1] >> 28)<<2; - + if (path->tag.nreg == 0) path->tag.nreg = 64; gs.q = 1; @@ -783,7 +783,7 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) while(size > 0) { //LOG(_T("Transfer(%08x, %d) START\n"), pMem, size); - if (path->tag.nloop == 0) + if (path->tag.nloop == 0) { GIFtag(path, pMem); pMem+= 4; @@ -791,14 +791,14 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) if ((g_GameSettings & GAME_PATH3HACK) && path == &gs.path3 && gs.path3.tag.eop) nPath3Hack = 1; - - if (path == &gs.path1) + + if (path == &gs.path1) { // if too much data, just ignore - if (path->tag.nloop * (path->tag.nreg / 4) > (int)size * (path->mode==2?2:1)) + if (path->tag.nloop * (path->tag.nreg / 4) > (int)size * (path->mode==2?2:1)) { static int lasttime = 0; - if( timeGetTime() - lasttime > 5000 ) + if( timeGetTime() - lasttime > 5000 ) { ERROR_LOG("VU1 too much data, ignore if gfx are fine\n"); lasttime = timeGetTime(); @@ -807,15 +807,15 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) return; } - if (path->mode == 1) + if (path->mode == 1) { // check if 0xb is in any reg, if yes, exit (kh2) - for(int i = 0; i < path->tag.nreg; i += 4) + for(int i = 0; i < path->tag.nreg; i += 4) { - if (((path->regs >> i)&0xf) == 11) + if (((path->regs >> i)&0xf) == 11) { static int lasttime = 0; - if( timeGetTime() - lasttime > 5000 ) + if( timeGetTime() - lasttime > 5000 ) { ERROR_LOG("Invalid unpack type\n"); lasttime = timeGetTime(); @@ -827,12 +827,12 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) } } - if(path->tag.nloop == 0 ) + if(path->tag.nloop == 0 ) { - if( path == &gs.path1 ) + if( path == &gs.path1 ) { // ffx hack - if( g_GameSettings & GAME_FFXHACK ) + if( g_GameSettings & GAME_FFXHACK ) { if( path->tag.eop ) return; @@ -841,13 +841,13 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) return; } - - if( !path->tag.eop ) + + if( !path->tag.eop ) { //DEBUG_LOG("continuing from eop\n"); continue; } - + continue; } } @@ -863,10 +863,10 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) g_GIFPackedRegHandlers[reg](pMem); path->regn += 4; - if (path->tag.nreg == path->regn) + if (path->tag.nreg == path->regn) { path->regn = 0; - if( path->tag.nloop-- <= 1 ) + if( path->tag.nloop-- <= 1 ) { size--; pMem += 4; @@ -886,10 +886,10 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) int reg = (int)((path->regs >> path->regn) & 0xf); g_GIFRegHandlers[reg](pMem); path->regn += 4; - if (path->tag.nreg == path->regn) + if (path->tag.nreg == path->regn) { path->regn = 0; - if( path->tag.nloop-- <= 1 ) + if( path->tag.nloop-- <= 1 ) { size--; pMem += 2; @@ -909,11 +909,11 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) { int process = min((int)size, path->tag.nloop); - if( process > 0 ) + if( process > 0 ) { - if (gs.imageTransfer) + if (gs.imageTransfer) ZeroGS::TransferLocalHost(pMem, process); - else + else ZeroGS::TransferHostLocal(pMem, process*4); path->tag.nloop -= process; @@ -923,7 +923,7 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) } break; } - else + else { // simulate int process = min((int)size, path->tag.nloop); @@ -932,7 +932,7 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) } break; - } + } default: // GIF_IMAGE GS_LOG("*** WARNING **** Unexpected GIFTag flag\n"); assert(0); @@ -1022,7 +1022,7 @@ int CALLBACK GSsetupRecording(int start, void* pData) return 1; } -s32 CALLBACK GSfreeze(int mode, freezeData *data) +s32 CALLBACK GSfreeze(int mode, freezeData *data) { switch (mode) { @@ -1047,7 +1047,7 @@ extern HINSTANCE hInst; void CALLBACK GSconfigure() { DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)ConfigureDlgProc); if( g_nPixelShaderVer == SHADER_20 ) diff --git a/plugins/zerogs/dx/Mem.cpp b/plugins/zerogs/dx/Mem.cpp index ad11615eff..a345b181ba 100644 --- a/plugins/zerogs/dx/Mem.cpp +++ b/plugins/zerogs/dx/Mem.cpp @@ -112,9 +112,9 @@ u32 g_columnTable32[8][8] = { }; u32 g_columnTable16[8][16] = { - { 0, 2, 8, 10, 16, 18, 24, 26, + { 0, 2, 8, 10, 16, 18, 24, 26, 1, 3, 9, 11, 17, 19, 25, 27 }, - { 4, 6, 12, 14, 20, 22, 28, 30, + { 4, 6, 12, 14, 20, 22, 28, 30, 5, 7, 13, 15, 21, 23, 29, 31 }, { 32, 34, 40, 42, 48, 50, 56, 58, 33, 35, 41, 43, 49, 51, 57, 59 }, @@ -141,7 +141,7 @@ u32 g_columnTable8[16][16] = { 43, 47, 59, 63, 11, 15, 27, 31 }, { 96, 100, 112, 116, 64, 68, 80, 84, // column 1 98, 102, 114, 118, 66, 70, 82, 86 }, - { 104, 108, 120, 124, 72, 76, 88, 92, + { 104, 108, 120, 124, 72, 76, 88, 92, 106, 110, 122, 126, 74, 78, 90, 94 }, { 65, 69, 81, 85, 97, 101, 113, 117, 67, 71, 83, 87, 99, 103, 115, 119 }, @@ -176,7 +176,7 @@ u32 g_columnTable4[16][32] = { 22, 30, 54, 62, 86, 94, 118, 126 }, { 65, 73, 97, 105, 1, 9, 33, 41, 67, 75, 99, 107, 3, 11, 35, 43, - 69, 77, 101, 109, 5, 13, 37, 45, + 69, 77, 101, 109, 5, 13, 37, 45, 71, 79, 103, 111, 7, 15, 39, 47 }, { 81, 89, 113, 121, 17, 25, 49, 57, 83, 91, 115, 123, 19, 27, 51, 59, @@ -192,7 +192,7 @@ u32 g_columnTable4[16][32] = { 214, 222, 246, 254, 150, 158, 182, 190 }, { 129, 137, 161, 169, 193, 201, 225, 233, 131, 139, 163, 171, 195, 203, 227, 235, - 133, 141, 165, 173, 197, 205, 229, 237, + 133, 141, 165, 173, 197, 205, 229, 237, 135, 143, 167, 175, 199, 207, 231, 239 }, { 145, 153, 177, 185, 209, 217, 241, 249, 147, 155, 179, 187, 211, 219, 243, 251, @@ -208,7 +208,7 @@ u32 g_columnTable4[16][32] = { 278, 286, 310, 318, 342, 350, 374, 382 }, { 321, 329, 353, 361, 257, 265, 289, 297, 323, 331, 355, 363, 259, 267, 291, 299, - 325, 333, 357, 365, 261, 269, 293, 301, + 325, 333, 357, 365, 261, 269, 293, 301, 327, 335, 359, 367, 263, 271, 295, 303 }, { 337, 345, 369, 377, 273, 281, 305, 313, 339, 347, 371, 379, 275, 283, 307, 315, @@ -224,7 +224,7 @@ u32 g_columnTable4[16][32] = { 470, 478, 502, 510, 406, 414, 438, 446 }, { 385, 393, 417, 425, 449, 457, 481, 489, 387, 395, 419, 427, 451, 459, 483, 491, - 389, 397, 421, 429, 453, 461, 485, 493, + 389, 397, 421, 429, 453, 461, 485, 493, 391, 399, 423, 431, 455, 463, 487, 495 }, { 401, 409, 433, 441, 465, 473, 497, 505, 403, 411, 435, 443, 467, 475, 499, 507, @@ -626,16 +626,16 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); //void TransferHostLocal4(const void* pbyMem, u32 nQWordSize) //{ // START_HOSTLOCAL(); -// +// // const T* pbuf = (const T*)pbyMem; // u32 nSize = nQWordSize*16*2/TRANSMIT_PITCH_4(2, T); // nSize = min(nSize, gs.imageWnew * gs.imageHnew); -// +// // int endY = ROUND_UPPOW2(i, blockheight); // int alignedY = ROUND_DOWNPOW2(gs.imageEndY, blockheight); // int alignedX = ROUND_DOWNPOW2(gs.imageEndX, blockwidth); // bool bCanAlign = MOD_POW2(gs.trxpos.dx, blockwidth) == 0 && (j == gs.trxpos.dx) && (alignedY > endY) && alignedX > gs.trxpos.dx; -// +// // if( (gs.imageEndX-gs.trxpos.dx)%widthlimit ) { // /* hack */ // if( abs((int)nSize - (gs.imageEndY-i)*(gs.imageEndX-gs.trxpos.dx)+(j-gs.trxpos.dx)) <= widthlimit ) { @@ -645,15 +645,15 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); // } // bCanAlign = false; // } -// +// // /* first align on block boundary */ // if( MOD_POW2(i, blockheight) || !bCanAlign ) { -// +// // if( !bCanAlign ) // endY = gs.imageEndY; /* transfer the whole image */ // else // assert( endY < gs.imageEndY); /* part of alignment condition */ -// +// // if( (DSTPSM == 0x13 || DSTPSM == 0x14) && ((gs.imageEndX-gs.trxpos.dx)%widthlimit) ) { // /* transmit with a width of 1 */ // TRANSMIT_HOSTLOCAL_Y_4(4, T, (1+(DSTPSM == 0x14)), endY); @@ -661,24 +661,24 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); // else { // TRANSMIT_HOSTLOCAL_Y_4(4, T, widthlimit, endY); // } -// +// // if( nSize == 0 || i == gs.imageEndY ) // goto End; // } -// +// // assert( MOD_POW2(i, blockheight) == 0 && j == gs.trxpos.dx); -// +// // /* can align! */ // int pitch = gs.imageEndX-gs.trxpos.dx; // u32 area = pitch*blockheight; // int fracX = gs.imageEndX-alignedX; -// +// // /* on top of checking whether pbuf is alinged, make sure that the width is at least aligned to its limits (due to bugs in pcsx2) */ // bool bAligned = !((u32)pbuf & 0xf) && (TRANSMIT_PITCH_4(pitch, T)&0xf) == 0; -// +// // /* transfer aligning to blocks */ // for(; i < alignedY && nSize >= area; i += blockheight, nSize -= area) { -// +// // if( bAligned || ((DSTPSM==PSMCT24) || (DSTPSM==PSMT8H) || (DSTPSM==PSMT4HH) || (DSTPSM==PSMT4HL)) ) { // for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH_4(blockwidth, T)/sizeof(T)) { // SwizzleBlock4(pstart + getPixelAddress4_0(tempj, i, gs.dstbuf.bw)*blockbits/8, @@ -691,7 +691,7 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); // (u8*)pbuf, TRANSMIT_PITCH_4(pitch, T)); // } // } -// +// // /* transfer the rest */ // if( alignedX < gs.imageEndX ) { // TRANSMIT_HOSTLOCAL_X_4(4, T, widthlimit, blockheight, alignedX); @@ -700,13 +700,13 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); // else pbuf += (blockheight-1)*TRANSMIT_PITCH_4(pitch, T)/sizeof(T); // j = 0; // } -// +// // if( TRANSMIT_PITCH_4(nSize, T)/4 > 0 ) { // TRANSMIT_HOSTLOCAL_Y_4(4, T, widthlimit, gs.imageEndY); // /* sometimes wrong sizes are sent (tekken tag) */ // assert( gs.imageTransfer == -1 || TRANSMIT_PITCH_4(nSize,T)/4 <= 2 ); // } -// +// // END_HOSTLOCAL(); //} diff --git a/plugins/zerogs/dx/Regs.cpp b/plugins/zerogs/dx/Regs.cpp index 44338d7080..4a85797185 100644 --- a/plugins/zerogs/dx/Regs.cpp +++ b/plugins/zerogs/dx/Regs.cpp @@ -84,7 +84,7 @@ void __fastcall GIFPackedRegHandlerNull(u32* data) void __fastcall GIFPackedRegHandlerRGBA(u32* data) { - gs.rgba = (data[0] & 0xff) | + gs.rgba = (data[0] & 0xff) | ((data[1] & 0xff) << 8) | ((data[2] & 0xff) << 16) | ((data[3] & 0xff) << 24); @@ -102,32 +102,32 @@ void __fastcall GIFPackedRegHandlerSTQ(u32* data) void __fastcall GIFPackedRegHandlerUV(u32* data) { gs.vertexregs.u = data[0] & 0x3fff; - gs.vertexregs.v = data[1] & 0x3fff; + gs.vertexregs.v = data[1] & 0x3fff; } -void __forceinline KICK_VERTEX2() -{ - if (++gs.primC >= (int)g_primmult[prim->prim]) - { - if (!(g_GameSettings&GAME_XENOSPECHACK) || !ZeroGS::vb[prim->ctxt].zbuf.zmsk) - (*ZeroGS::drawfn[prim->prim])(); - gs.primC -= g_primsub[prim->prim]; - } -} +void __forceinline KICK_VERTEX2() +{ + if (++gs.primC >= (int)g_primmult[prim->prim]) + { + if (!(g_GameSettings&GAME_XENOSPECHACK) || !ZeroGS::vb[prim->ctxt].zbuf.zmsk) + (*ZeroGS::drawfn[prim->prim])(); + gs.primC -= g_primsub[prim->prim]; + } +} -void __forceinline KICK_VERTEX3() -{ - if (++gs.primC >= (int)g_primmult[prim->prim]) - { - gs.primC -= g_primsub[prim->prim]; - if (prim->prim == 5) - { - /* tri fans need special processing */ - if (gs.nTriFanVert == gs.primIndex) - gs.primIndex = (gs.primIndex+1) % ArraySize(gs.gsvertex); - } - } -} +void __forceinline KICK_VERTEX3() +{ + if (++gs.primC >= (int)g_primmult[prim->prim]) + { + gs.primC -= g_primsub[prim->prim]; + if (prim->prim == 5) + { + /* tri fans need special processing */ + if (gs.nTriFanVert == gs.primIndex) + gs.primIndex = (gs.primIndex+1) % ArraySize(gs.gsvertex); + } + } +} void __fastcall GIFPackedRegHandlerXYZF2(u32* data) { @@ -142,7 +142,7 @@ void __fastcall GIFPackedRegHandlerXYZF2(u32* data) KICK_VERTEX3(); } else { - KICK_VERTEX2(); + KICK_VERTEX2(); } } @@ -158,7 +158,7 @@ void __fastcall GIFPackedRegHandlerXYZ2(u32* data) KICK_VERTEX3(); } else { - KICK_VERTEX2(); + KICK_VERTEX2(); } } @@ -222,11 +222,11 @@ void tex2Write(int i, u32 *data) // don't update unless necessary if( (s_uTex0Data[0]&0x03f00000) == (data[0]&0x03f00000) ) { // psm is the same - + if( PSMT_ISCLUT(psm) ) { // have to write the CLUT again if changed if( (s_uTex0Data[1]&0x1fffffe0) == (data[1]&0x1fffffe0) ) { - + if( data[1]&0xe0000000 ) { tex0.cld = (data[1]>>29)&7; ZeroGS::texClutWrite(i); @@ -266,7 +266,7 @@ void tex2Write(int i, u32 *data) ZeroGS::Flush(i); ZeroGS::vb[i].bVarsTexSync = FALSE; ZeroGS::vb[i].bTexConstsSync = FALSE; - + s_uTex0Data[0] = (s_uTex0Data[0]&~0x03f00000)|(psm<<20); s_uTex0Data[1] = (s_uTex0Data[1]&0x1f)|(data[1]&~0x1f); @@ -276,7 +276,7 @@ void tex2Write(int i, u32 *data) tex0.cbp = (data[1] >> 5) & 0x3fff; tex0.cpsm = (data[1] >> 19) & 0xe; tex0.csm = (data[1] >> 23) & 0x1; - + if( tex0.cpsm <= 1 ) tex0.csa = (data[1] >> 24) & 0xf; else tex0.csa = (data[1] >> 24) & 0x1f; @@ -347,7 +347,7 @@ __forceinline void clampWrite(int i, u32 *data) clampInfo& clamp = ZeroGS::vb[i].clamp; if( s_uClampData[i] != data[0] || ((clamp.minv>>8)|(clamp.maxv<<2)) != (data[1]&0x0fff) ) { - + // if( ZeroGS::vb[i].bNeedTexCheck ) // ZeroGS::vb[i].FlushTexData(); @@ -387,9 +387,9 @@ void __fastcall GIFRegHandlerPRIM(u32 *data) { gs.primC = 0; prim->prim = (data[0]) & 0x7; gs._prim[0].prim = (data[0]) & 0x7; - gs._prim[1].prim = (data[0]) & 0x7; + gs._prim[1].prim = (data[0]) & 0x7; gs._prim[1]._val = (data[0]>>3)&0xff; - + ZeroGS::Prim(); } @@ -509,7 +509,7 @@ void tex1Write(int i, u32* data) ZeroGS::Flush(i); ZeroGS::vb[i].bVarsTexSync = FALSE; } - tex1.lcm = (data[0] ) & 0x1; + tex1.lcm = (data[0] ) & 0x1; tex1.mxl = (data[0] >> 2) & 0x7; tex1.mmag = (data[0] >> 5) & 0x1; tex1.mmin = (data[0] >> 6) & 0x7; @@ -689,7 +689,7 @@ void __fastcall GIFRegHandlerSCISSOR_1(u32* data) newscissor.y0 = ((data[1] ) & 0x7ff) << 3; newscissor.y1 = ((data[1] >> 16) & 0x7ff) << 3; - if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || + if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0 ) { ZeroGS::Flush(0); @@ -710,7 +710,7 @@ void __fastcall GIFRegHandlerSCISSOR_2(u32* data) newscissor.y0 = ((data[1] ) & 0x7ff) << 3; newscissor.y1 = ((data[1] >> 16) & 0x7ff) << 3; - if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || + if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0 ) { ZeroGS::Flush(1); @@ -820,7 +820,7 @@ void __fastcall GIFRegHandlerZBUF_1(u32* data) zbufInfo& zbuf = ZeroGS::vb[0].zbuf; int psm = (0x30|((data[0] >> 24) & 0xf)); - if( zbuf.zbp == (data[0] & 0x1ff) * 32 && + if( zbuf.zbp == (data[0] & 0x1ff) * 32 && zbuf.psm == psm && zbuf.zmsk == (data[1] & 0x1) ) { return; @@ -848,7 +848,7 @@ void __fastcall GIFRegHandlerZBUF_2(u32* data) zbufInfo& zbuf = ZeroGS::vb[1].zbuf; int psm = (0x30|((data[0] >> 24) & 0xf)); - if( zbuf.zbp == (data[0] & 0x1ff) * 32 && + if( zbuf.zbp == (data[0] & 0x1ff) * 32 && zbuf.psm == psm && zbuf.zmsk == (data[1] & 0x1) ) { return; @@ -922,7 +922,7 @@ void __fastcall GIFRegHandlerTRXDIR(u32* data) case 0: // host->loc ZeroGS::InitTransferHostLocal(); break; - + case 1: // loc->host ZeroGS::InitTransferLocalHost(); @@ -949,7 +949,7 @@ void __fastcall GIFRegHandlerTRXDIR(u32* data) static u32 oldhw[4]; void __fastcall GIFRegHandlerHWREG(u32* data) -{ +{ if( gs.imageTransfer == 0 ) { ZeroGS::TransferHostLocal(data, 2); } @@ -985,16 +985,16 @@ void __fastcall GIFRegHandlerFINISH(u32* data) { if(!g_GSMultiThreaded) { - if (gs.CSRw & 0x2) + if (gs.CSRw & 0x2) CSR->FINISH = 1; if (!IMR->FINISHMSK && GSirq) GSirq(); - + // if( gs.CSRw & 2 ) { // //gs.CSRw &= ~2; // //CSR->FINISH = 0; // -// +// // } // CSR->FINISH = 1; // diff --git a/plugins/zerogs/dx/Regs.h b/plugins/zerogs/dx/Regs.h index b46799e2c3..d866b508b1 100644 --- a/plugins/zerogs/dx/Regs.h +++ b/plugins/zerogs/dx/Regs.h @@ -112,7 +112,7 @@ void __fastcall GIFRegHandlerLABEL(u32* data); // u32 tex0data[2]; // u32 tex1data[2]; // primInfo curprim; -// +// // std::vector vertices; // bool bCanExecute; //}; diff --git a/plugins/zerogs/dx/Windows/Conf.cpp b/plugins/zerogs/dx/Windows/Conf.cpp index 44cc42d3d7..4ea5a27cac 100644 --- a/plugins/zerogs/dx/Windows/Conf.cpp +++ b/plugins/zerogs/dx/Windows/Conf.cpp @@ -30,7 +30,7 @@ void LoadConfig() { char szValue[256]; const std::string iniFile( s_strIniPath + "zerogs.ini" ); - + memset(&conf, 0, sizeof(conf)); conf.interlace = 0; // on, mode 1 conf.mrtdepth = 1; @@ -91,7 +91,7 @@ void LoadConfig() { conf.height = 1080; break; } - + // turn off all hacks by defaultof conf.options &= ~(GSOPTION_FULLSCREEN|GSOPTION_WIREFRAME|GSOPTION_CAPTUREAVI); conf.options |= GSOPTION_LOADED; diff --git a/plugins/zerogs/dx/Windows/Win32.cpp b/plugins/zerogs/dx/Windows/Win32.cpp index 1672d8c503..580a021d67 100644 --- a/plugins/zerogs/dx/Windows/Win32.cpp +++ b/plugins/zerogs/dx/Windows/Win32.cpp @@ -114,7 +114,7 @@ void OnInitDialog(HWND hW) } void OnOK(HWND hW) { - + u32 newinterlace = IsDlgButtonChecked(hW, IDC_CONFIG_INTERLACE); if( !conf.interlace ) conf.interlace = newinterlace; @@ -231,12 +231,12 @@ s32 CALLBACK GStest() { void CALLBACK GSabout() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)AboutDlgProc); } BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT - DWORD dwReason, + DWORD dwReason, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; return TRUE; // very quick :) diff --git a/plugins/zerogs/dx/Windows/aviUtil.h b/plugins/zerogs/dx/Windows/aviUtil.h index 10a7f91805..8ab371dd15 100644 --- a/plugins/zerogs/dx/Windows/aviUtil.h +++ b/plugins/zerogs/dx/Windows/aviUtil.h @@ -72,21 +72,21 @@ BOOL AVI_CreateStream(PAVIFILE pfile, PAVISTREAM * ps, int rate, // sample/secon //strhdr.fccHandler = mmioFOURCC('M','S','V','C'); // Microsoft video 1 //strhdr.fccHandler = mmioFOURCC('I','V','5','0'); // Intel video 5.0 //strhdr.dwFlags = AVISTREAMINFO_DISABLED; - //strhdr.dwCaps = - //strhdr.wPriority = - //strhdr.wLanguage = + //strhdr.dwCaps = + //strhdr.wPriority = + //strhdr.wLanguage = strhdr.dwScale = 1; strhdr.dwRate = rate; // rate fps - //strhdr.dwStart = - //strhdr.dwLength = - //strhdr.dwInitialFrames = + //strhdr.dwStart = + //strhdr.dwLength = + //strhdr.dwInitialFrames = strhdr.dwSuggestedBufferSize = buffersize; strhdr.dwQuality = -1; // use the default - //strhdr.dwSampleSize = + //strhdr.dwSampleSize = SetRect(&strhdr.rcFrame, 0, 0, // rectangle for stream (int) rectwidth, (int) rectheight); - //strhdr.dwEditCount = + //strhdr.dwEditCount = //strhdr.dwFormatChangeCount = //strcpy(strhdr.szName, "Full Frames (Uncompressed)"); @@ -152,7 +152,7 @@ string dumpAVICOMPRESSOPTIONS(AVICOMPRESSOPTIONS opts) _snprintf(tmp, 255, "LPVOID lpParms = %d\n", opts.lpParms); returnValue += tmp; - _snprintf(tmp, 255, "DWORD cbParms = %d\n", opts.cbParms); + _snprintf(tmp, 255, "DWORD cbParms = %d\n", opts.cbParms); returnValue += tmp; _snprintf(tmp, 255, "DWORD dwInterleaveEvery = %d\n", opts.dwInterleaveEvery); @@ -164,7 +164,7 @@ string dumpAVICOMPRESSOPTIONS(AVICOMPRESSOPTIONS opts) BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEADER lpbi, const char* _compressor) { - + AVICOMPRESSOPTIONS opts; AVICOMPRESSOPTIONS FAR * aopts[1] = {&opts}; @@ -181,10 +181,10 @@ BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEAD //opts.dwQuality //opts.dwBytesPerSecond //opts.dwFlags = AVICOMPRESSF_KEYFRAMES; - //opts.lpFormat + //opts.lpFormat //opts.cbFormat //opts.lpParms - //opts.cbParms + //opts.cbParms //opts.dwInterleaveEvery /* display the compression options dialog box if specified compressor is unknown */ @@ -197,7 +197,7 @@ BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEAD //printf("%s", dumpAVICOMPRESSOPTIONS(opts)); //MessageBox(NULL, dumpAVICOMPRESSOPTIONS(opts).c_str(), "AVICOMPRESSOPTIONS", MB_OK); - } + } HRESULT hr = AVIMakeCompressedStream(psCompressed, *ps, &opts, NULL); if (hr != AVIERR_OK) { @@ -274,7 +274,7 @@ BOOL AVI_AddFrame(PAVISTREAM psCompressed, int time, LPBITMAPINFOHEADER lpbi) MessageBox(NULL, strMsg, "", MB_OK); return FALSE; } - + return TRUE; } @@ -316,7 +316,7 @@ BOOL AVI_CloseFile(PAVIFILE pfile) { if (pfile) AVIFileClose(pfile); - + return TRUE; } @@ -345,13 +345,13 @@ BOOL AVI_Exit() /* Here are the additional functions we need! */ -static PAVIFILE pfile = NULL; +static PAVIFILE pfile = NULL; static PAVISTREAM ps = NULL; -static PAVISTREAM psCompressed = NULL; +static PAVISTREAM psCompressed = NULL; static int count = 0; -// Initialization... +// Initialization... bool START_AVI(const char* file_name) { if(! AVI_Init()) @@ -368,19 +368,19 @@ bool START_AVI(const char* file_name) return true; } - + bool ADD_FRAME_FROM_DIB_TO_AVI(const char* _compressor, int _frameRate, int width, int height, int bits, void* pdata) { if(count == 0) { - if(! AVI_CreateStream(pfile, &ps, _frameRate, - width*height/bits, + if(! AVI_CreateStream(pfile, &ps, _frameRate, + width*height/bits, width, height, _compressor)) { //printf("Error - AVI_CreateStream()\n"); return false; - } + } BITMAPINFOHEADER bi; memset(&bi, 0, sizeof(bi)); @@ -412,7 +412,7 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(const char* _compressor, int _frameRate, int widt MessageBox(NULL, strMsg, "", MB_OK); return FALSE; } - + count++; return true; } @@ -424,16 +424,16 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRa LPBITMAPINFOHEADER lpbi; if(count == 0) { - lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); - if(! AVI_CreateStream(pfile, &ps, _frameRate, - (unsigned long) lpbi->biSizeImage, - (int) lpbi->biWidth, + lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); + if(! AVI_CreateStream(pfile, &ps, _frameRate, + (unsigned long) lpbi->biSizeImage, + (int) lpbi->biWidth, (int) lpbi->biHeight, _compressor)) { //printf("Error - AVI_CreateStream()\n"); GlobalUnlock(lpbi); return false; - } + } if(! AVI_SetOptions(&ps, &psCompressed, lpbi, _compressor)) { @@ -445,7 +445,7 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRa GlobalUnlock(lpbi); } - lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); + lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); if(! AVI_AddFrame(psCompressed, count * 1, lpbi)) { //printf("Error - AVI_AddFrame()\n"); @@ -453,12 +453,12 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRa return false; } - GlobalUnlock(lpbi); + GlobalUnlock(lpbi); count++; return true; } -// The end... +// The end... bool STOP_AVI() { if(! AVI_CloseStream(ps, psCompressed, NULL)) @@ -472,7 +472,7 @@ bool STOP_AVI() //printf("Error - AVI_CloseFile()\n"); return false; } - + if(! AVI_Exit()) { //printf("Error - AVI_Exit()\n"); @@ -480,5 +480,5 @@ bool STOP_AVI() } return true; -} +} diff --git a/plugins/zerogs/dx/Windows/resource.h b/plugins/zerogs/dx/Windows/resource.h index 13bbdd0ce2..cece1dbb0e 100644 --- a/plugins/zerogs/dx/Windows/resource.h +++ b/plugins/zerogs/dx/Windows/resource.h @@ -34,7 +34,7 @@ #define IDC_FILTERS 1014 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 112 diff --git a/plugins/zerogs/dx/Windows/resrc1.h b/plugins/zerogs/dx/Windows/resrc1.h index 1c68bfd57a..b29c257f5e 100644 --- a/plugins/zerogs/dx/Windows/resrc1.h +++ b/plugins/zerogs/dx/Windows/resrc1.h @@ -76,7 +76,7 @@ #define IDC_CONFIG_AA16 2004 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 113 diff --git a/plugins/zerogs/dx/ZeroGSShaders/zerogsshaders.cpp b/plugins/zerogs/dx/ZeroGSShaders/zerogsshaders.cpp index 0601ef271a..7cf1917ef1 100644 --- a/plugins/zerogs/dx/ZeroGSShaders/zerogsshaders.cpp +++ b/plugins/zerogs/dx/ZeroGSShaders/zerogsshaders.cpp @@ -55,7 +55,7 @@ public: _snprintf(strfile, 255, "%s%s", pEffectDir, pFileName); pfilename = strfile; } - + FILE* f = fopen(pfilename, "rb"); if( f == NULL ) @@ -83,7 +83,7 @@ public: }; void LoadShader(int index, const char* name, const char* pshader, D3DXMACRO* pmacros, ID3DXInclude* pInclude) -{ +{ LPD3DXBUFFER pShader = NULL, pError = NULL; HRESULT hr = D3DXCompileShaderFromFile(srcfilename, pmacros, pInclude, name, pshader, dwFlags, &pShader, &pError, NULL); @@ -159,7 +159,7 @@ int main(int argc, char** argv) break; --i; } - + strdir[i] = 0; ZeroGSShaderInclude inc; @@ -169,7 +169,7 @@ int main(int argc, char** argv) memset(macros, 0, sizeof(macros)); macros[0].Name = "WRITE_DEPTH"; - macros[0].Definition = "1"; + macros[0].Definition = "1"; for(i = 0; i < ARRAYSIZE(vsshaders); ++i) { for(int vs30 = 0; vs30 < 2; ++vs30 ) { @@ -194,7 +194,7 @@ int main(int argc, char** argv) } printf("creating shaders, note that ps2hw_ctx0.fx, and ps2hw_ctx1.fx are required\n"); - + for(int texwrap = 0; texwrap < NUM_TEXWRAPS; ++texwrap ) { int macroindex = 0; @@ -236,7 +236,7 @@ int main(int argc, char** argv) } for(int exactcolor = 0; exactcolor < 2; ++exactcolor ) { - + if( exactcolor ) { macros[macroindex].Name = "EXACT_COLOR"; macros[macroindex].Definition = "1"; @@ -274,80 +274,80 @@ int main(int argc, char** argv) // tex32 sprintf(str, "Texture%s%d_tex32PS", fog?"Fog":"", texfilter); inc.ps2x = 0; - + macros[macroindex].Name = "ACCURATE_DECOMPRESSION"; macros[macroindex].Definition = "1"; - + if( texfilter == 0 && exactcolor == 0 ) { LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20), str, g_pShaders[SHADER_20], macros, &inc); } - + inc.ps2x = 1; - + LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20b), str, g_pShaders[SHADER_20b], macros, &inc); - + macros[macroindex].Name = NULL; macros[macroindex].Definition = NULL; - + LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20a), str, g_pShaders[SHADER_20a], macros, &inc); LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_30), str, g_pShaders[SHADER_30], macros, &inc); - + // clut32 sprintf(str, "Texture%s%d_clut32PS", fog?"Fog":"", texfilter); inc.ps2x = 0; - + macros[macroindex].Name = "ACCURATE_DECOMPRESSION"; macros[macroindex].Definition = "1"; - + if( texfilter == 0 && exactcolor == 0 ) { LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20), str, g_pShaders[SHADER_20], macros, &inc); } - + inc.ps2x = 1; - + LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20b), str, g_pShaders[SHADER_20b], macros, &inc); - + macros[macroindex].Name = NULL; macros[macroindex].Definition = NULL; - + LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20a), str, g_pShaders[SHADER_20a], macros, &inc); LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_30), str, g_pShaders[SHADER_30], macros, &inc); - + // tex32to16 sprintf(str, "Texture%s%d_tex32to16PS", fog?"Fog":"", texfilter); inc.ps2x = 0; - + macros[macroindex].Name = "ACCURATE_DECOMPRESSION"; macros[macroindex].Definition = "1"; - - if( texfilter == 0 && exactcolor == 0 ) { + + if( texfilter == 0 && exactcolor == 0 ) { LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20), str, g_pShaders[SHADER_20], macros, &inc); } - + inc.ps2x = 1; - + LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20b), str, g_pShaders[SHADER_20b], macros, &inc); - + macros[macroindex].Name = NULL; macros[macroindex].Definition = NULL; - + LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20a), str, g_pShaders[SHADER_20a], macros, &inc); LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_30), str, g_pShaders[SHADER_30], macros, &inc); - + // tex16to8h sprintf(str, "Texture%s%d_tex16to8hPS", fog?"Fog":"", texfilter); inc.ps2x = 0; - + macros[macroindex].Name = "ACCURATE_DECOMPRESSION"; macros[macroindex].Definition = "1"; - + inc.ps2x = 1; - + LoadShader(GET_SHADER_INDEX(4, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20b), str, g_pShaders[SHADER_20b], macros, &inc); - + macros[macroindex].Name = NULL; macros[macroindex].Definition = NULL; - + LoadShader(GET_SHADER_INDEX(4, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20a), str, g_pShaders[SHADER_20a], macros, &inc); LoadShader(GET_SHADER_INDEX(4, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_30), str, g_pShaders[SHADER_30], macros, &inc); } diff --git a/plugins/zerogs/dx/common.h b/plugins/zerogs/dx/common.h index 698c45c5b9..cd0bac0a97 100644 --- a/plugins/zerogs/dx/common.h +++ b/plugins/zerogs/dx/common.h @@ -217,7 +217,7 @@ extern const uint32_t inverse[256]; #else # define FASTDIV(a,b) ((a)/(b)) #endif - + #ifdef ARCH_X86 // avoid +32 for shift optimization (gcc should do that ...) static inline int32_t NEG_SSR32( int32_t a, int8_t s){ @@ -257,7 +257,7 @@ typedef struct PutBitContext { int64_t data_out_size; /* in bytes */ } PutBitContext; -void init_put_bits(PutBitContext *s, +void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size, void *opaque, void (*write_data)(void *, uint8_t *, int)); @@ -340,7 +340,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) #endif // DEBUG_LOG("put_bits=%d %x\n", n, value); assert(n == 32 || value < (1U << n)); - + bit_buf = s->bit_buf; bit_left = s->bit_left; @@ -398,9 +398,9 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) # else int index= s->index; uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5); - - value<<= 32-n; - + + value<<= 32-n; + ptr[0] |= be2me_32(value>>(index&31)); ptr[1] = be2me_32(value<<(32-(index&31))); //if(n>24) DEBUG_LOG("%d %d\n", n, value); @@ -428,7 +428,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) # else int index= s->index; uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3)); - + ptr[0] |= be2me_32(value<<(32-n-(index&7) )); ptr[1] = 0; //if(n>24) DEBUG_LOG("%d %d\n", n, value); @@ -677,9 +677,9 @@ static inline int get_bits_count(GetBitContext *s){ /** * read mpeg1 dc style vlc (sign bit + mantisse with no MSB). - * if MSB not set it is negative + * if MSB not set it is negative * @param n length in bits - * @author BERO + * @author BERO */ static inline int get_xbits(GetBitContext *s, int n){ register int tmp; @@ -845,11 +845,11 @@ static inline int get_vlc(GetBitContext *s, VLC *vlc) { int code; VLC_TYPE (*table)[2]= vlc->table; - + OPEN_READER(re, s) UPDATE_CACHE(re, s) - GET_VLC(code, re, s, table, vlc->bits, 3) + GET_VLC(code, re, s, table, vlc->bits, 3) CLOSE_READER(re, s) return code; @@ -857,17 +857,17 @@ static inline int get_vlc(GetBitContext *s, VLC *vlc) /** * parses a vlc code, faster then get_vlc() - * @param bits is the number of bits which will be read at once, must be + * @param bits is the number of bits which will be read at once, must be * identical to nb_bits in init_vlc() * @param max_depth is the number of times bits bits must be readed to completly - * read the longest vlc code + * read the longest vlc code * = (max_vlc_length + bits - 1) / bits */ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth) { int code; - + OPEN_READER(re, s) UPDATE_CACHE(re, s) @@ -883,7 +883,7 @@ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], static inline void print_bin(int bits, int n){ int i; - + for(i=n-1; i>=0; i--){ DEBUG_LOG("%d", (bits>>i)&1); } @@ -893,7 +893,7 @@ static inline void print_bin(int bits, int n){ static inline int get_bits_trace(GetBitContext *s, int n, char *file, char *func, int line){ int r= get_bits(s, n); - + print_bin(r, n); DEBUG_LOG("%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line); return r; @@ -904,16 +904,16 @@ static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits int r= get_vlc2(s, table, bits, max_depth); int len= get_bits_count(s) - pos; int bits2= show>>(24-len); - + print_bin(bits2, len); - + DEBUG_LOG("%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line); return r; } static inline int get_xbits_trace(GetBitContext *s, int n, char *file, char *func, int line){ int show= show_bits(s, n); int r= get_xbits(s, n); - + print_bin(show, n); DEBUG_LOG("%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line); return r; @@ -1029,9 +1029,9 @@ static inline int ff_sqrt(int a) int ret=0; int s; int ret_sq=0; - + if(a<128) return ff_sqrt_tab[a]; - + for(s=15; s>=0; s--){ int b= ret_sq + (1<<(s*2)) + (ret<UnlockRect(); @@ -363,7 +363,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth) SETRS(D3DRS_ZENABLE, FALSE); SETRS(D3DRS_ZWRITEENABLE, FALSE); SETRS(D3DRS_COLORWRITEENABLE, 0xf); - + pd3dDevice->SetVertexShader(pvsBitBlt); pd3dDevice->SetStreamSource(0, pvbRect, 0, sizeof(VertexGPU)); @@ -395,7 +395,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth) nUpdateTarg = 0; } } - + if( nUpdateTarg ) { pd3dDevice->SetTexture(SAMP_FINAL, ittarg->second->ptex); @@ -442,12 +442,12 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth) assert( psurf != NULL ); SetViewport(); - + if( conf.options & GSOPTION_WIREFRAME ) SETRS(D3DRS_FILLMODE, D3DFILL_SOLID); if( ZeroGS::IsWriteDestAlphaTest() ) { SETRS(D3DRS_STENCILENABLE, TRUE); - SETRS(D3DRS_STENCILWRITEMASK, 0xff); + SETRS(D3DRS_STENCILWRITEMASK, 0xff); SETRS(D3DRS_STENCILFUNC, D3DCMP_ALWAYS); SETRS(D3DRS_STENCILPASS, D3DSTENCILOP_ZERO); } @@ -484,7 +484,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth) status = TS_Resolved; // reset since settings changed - vb[0].bVarsTexSync = 0; + vb[0].bVarsTexSync = 0; ZeroGS::ResetAlphaVariables(); } @@ -505,7 +505,7 @@ void ZeroGS::CRenderTarget::ConvertTo32() } V(ptexConv->GetSurfaceLevel(0, &psurfConv)); - + if( !s_bBeginScene ) { pd3dDevice->BeginScene(); s_bBeginScene = TRUE; @@ -673,10 +673,10 @@ void ZeroGS::CRenderTarget::ConvertTo32() // TODO, reset depth? if( ZeroGS::icurctx >= 0 ) { // reset since settings changed - vb[icurctx].bVarsTexSync = 0; + vb[icurctx].bVarsTexSync = 0; vb[icurctx].bVarsSetTarg = 0; } - vb[0].bVarsTexSync = 0; + vb[0].bVarsTexSync = 0; } // use when texture is not tiled and converting from 32bit to 16bit @@ -688,7 +688,7 @@ void ZeroGS::CRenderTarget::ConvertTo16() { LPD3DTEX ptexConv; LPD3DSURF psurfConv; - + s_RTs.DestroyChildren(this); // create @@ -701,7 +701,7 @@ void ZeroGS::CRenderTarget::ConvertTo16() } V(ptexConv->GetSurfaceLevel(0, &psurfConv)); - + if( !s_bBeginScene ) { pd3dDevice->BeginScene(); s_bBeginScene = TRUE; @@ -841,7 +841,7 @@ void ZeroGS::CRenderTarget::ConvertTo16() temp[0] = ((col>>16)&0xff)/255.0f; temp[3] = 2*(((col>>24)&0xff)/255.0f); D3DXFloat32To16Array((D3DXFLOAT16*)pdst, temp, 4); - + } } psys->UnlockRect(); @@ -885,7 +885,7 @@ void ZeroGS::CRenderTarget::ConvertTo16() // TODO, reset depth? if( ZeroGS::icurctx >= 0 ) { // reset since settings changed - vb[icurctx].bVarsTexSync = 0; + vb[icurctx].bVarsTexSync = 0; vb[icurctx].bVarsSetTarg = 0; } vb[0].bVarsTexSync = 0; @@ -920,7 +920,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback() SETRS(D3DRS_ZWRITEENABLE, FALSE); SETRS(D3DRS_STENCILENABLE, FALSE); SETRS(D3DRS_COLORWRITEENABLE, 0xf); - + // assume depth already set // if( conf.mrtdepth && bIndepWriteMasks ) SETRS(D3DRS_COLORWRITEENABLE1, 0); // else @@ -977,7 +977,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback() // TODO, reset depth? if( ZeroGS::icurctx >= 0 ) { // reset since settings changed - vb[icurctx].bVarsTexSync = 0; + vb[icurctx].bVarsTexSync = 0; } } @@ -1033,7 +1033,7 @@ void ZeroGS::CDepthTarget::Resolve() if( vb[0].prndr == this || vb[0].pdepth == this ) Flush(0); if( vb[1].prndr == this || vb[1].pdepth == this ) Flush(1); - if( !(status & TS_Virtual) || targoffx != 0 || targoffy != 0 ) + if( !(status & TS_Virtual) || targoffx != 0 || targoffy != 0 ) status |= TS_Resolved; } @@ -1050,7 +1050,7 @@ void ZeroGS::CDepthTarget::Resolve(int startrange, int endrange) if( vb[0].prndr == this || vb[0].pdepth == this ) Flush(0); if( vb[1].prndr == this || vb[1].pdepth == this ) Flush(1); - if( !(status & TS_Virtual) ) + if( !(status & TS_Virtual) ) status |= TS_Resolved; } @@ -1164,7 +1164,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr) if( conf.options & GSOPTION_WIREFRAME ) SETRS(D3DRS_FILLMODE, D3DFILL_SOLID); pd3dDevice->SetDepthStencilSurface(pdepth); - + if( pusetarg != NULL ) { pd3dDevice->SetPixelShader(ppsBitBltDepthTex[conf.mrtdepth]); } @@ -1239,7 +1239,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, DWORD it = mapTargets.insert(MAPTARGETS::value_type(key, itnew->second)).first; // readd mapTargets.erase(itnew); // delete old - + bfound = true; } } @@ -1314,7 +1314,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, DWORD it->second->lastused = timeGetTime(); return Promote(it->first&~TARGET_VIRTUAL_KEY); } - + // check if there exists a more recent target that this target could update from // only update if target isn't mirrored bool bCheckHalfCovering = (g_GameSettings&GAME_FULL16BITRES) && (it->second->psm&2) && it->second->fbh +32 < frame.fbh; @@ -1322,7 +1322,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, DWORD for(MAPTARGETS::iterator itnew = mapTargets.begin(); itnew != mapTargets.end(); ++itnew) { if( itnew->second != it->second && itnew->second->ptex != it->second->ptex && itnew->second->ptexFeedback != it->second->ptex && itnew->second->lastused > it->second->lastused && !(itnew->second->status & CRenderTarget::TS_NeedUpdate) ) { - + // if new target totally encompasses the current one if( itnew->second->start <= it->second->start && itnew->second->end >= it->second->end ) { it->second->status |= CRenderTarget::TS_NeedUpdate; @@ -1387,7 +1387,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, DWORD // //break; // } // else { - if( (g_GameSettings&GAME_FASTUPDATE) || (it->second->fbw == frame.fbw && + if( (g_GameSettings&GAME_FASTUPDATE) || (it->second->fbw == frame.fbw && // check depth targets only if partialdepth option (it->second->fbp != frame.fbp|| ((g_GameSettings&GAME_PARTIALDEPTH)&&(opts&CRenderTargetMngr::TO_DepthBuffer))) ) ) { @@ -1505,7 +1505,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, DWORD } } } - + if( (opts & CRenderTargetMngr::TO_Virtual) ) { ptarg->status = CRenderTarget::TS_Virtual; key |= TARGET_VIRTUAL_KEY; @@ -1673,7 +1673,7 @@ bool ZeroGS::CMemoryTarget::ValidateTex(const tex0Info& tex0, int starttex, int // lock and compare D3DLOCKED_RECT lock; assert( ptex != NULL ); - + if( memory != NULL ) { assert( memory->ptr != NULL ); lock.pBits = memory->ptr; @@ -1822,7 +1822,7 @@ inline list::iterator ZeroGS::CMemoryTargetMngr::DestroyTargetIte // find the target and destroy list::iterator itprev = it; ++it; listClearedTargets.splice(listClearedTargets.end(), listTargets, itprev); - + if( listClearedTargets.size() > TEXDESTROY_THRESH ) { listClearedTargets.pop_front(); } @@ -1880,7 +1880,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info if( PSMT_ISCLUT(tex0.psm) ) { assert( it->clut.size() > 0 ); - + if( it->psm != tex0.psm || it->cpsm != tex0.cpsm || it->clut.size() != clutsize ) { // wrong clut list::iterator itprev = it; @@ -1939,7 +1939,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info it->usedstamp = curstamp; it->validatecount = 0; - + return &(*it); } #ifdef SORT_TARGETS @@ -1961,7 +1961,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info if( (PSMT_ISCLUT(tex0.psm) && tex0.cpsm > 1) || tex0.psm == PSMCT16 || tex0.psm == PSMCT16S) { fmt = D3DFMT_A1R5G5B5; } - + int widthmult = 1; if( g_MaxTexHeight < 4096 ) { if( end-start > g_MaxTexHeight ) @@ -2024,7 +2024,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info targ->cpsm = tex0.cpsm; targ->clut.reserve(256*4); // no matter what targ->clut.resize(clutsize); - + if( tex0.cpsm <= 1 ) { // 32 bit memcpy_amd(&targ->clut[0], ZeroGS::g_pbyGSClut+nClutOffset, clutsize); } @@ -2074,7 +2074,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info targ->psm = tex0.psm; targ->cpsm = tex0.cpsm; targ->widthmult = widthmult; - + // alloc the mem while( FAILED(pd3dDevice->CreateTexture(GPU_TEXWIDTH*channels*widthmult, (targ->realheight+widthmult-1)/widthmult, 1, 0, fmt, D3DPOOL_DEFAULT, &targ->ptex, NULL)) ) { @@ -2088,7 +2088,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info DestroyOldest(); } } - + // lock V(pd3dDevice->CreateTexture(GPU_TEXWIDTH*channels*widthmult, (targ->realheight+widthmult-1)/widthmult, 1, 0, fmt, D3DPOOL_SYSTEMMEM, &targ->ptexsys, NULL)); assert( targ->ptexsys != NULL ); @@ -2100,7 +2100,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info D3DLOCKED_RECT lock; targ->ptexsys->LockRect(0, &lock, NULL, 0); - + // fill with data if( PSMT_ISCLUT(tex0.psm) ) { @@ -2123,7 +2123,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info else { u16* pclut = (u16*)&targ->clut[0]; u16* pdst = (u16*)lock.pBits; - + BUILDCLUT(); } } @@ -2293,7 +2293,7 @@ void ZeroGS::CMemoryTargetMngr::ClearRange(int nbStartY, int nbEndY) // continue; // } // } -// +// // ++it; // } // } @@ -2306,7 +2306,7 @@ void ZeroGS::CMemoryTargetMngr::DestroyCleared() it = listClearedTargets.erase(it); continue; } - + ++it; } @@ -2332,7 +2332,7 @@ void ZeroGS::CMemoryTargetMngr::DestroyOldest() list::iterator it, itbest; it = itbest = listTargets.begin(); - + while(it != listTargets.end()) { if( it->usedstamp < itbest->usedstamp ) itbest = it; @@ -2382,7 +2382,7 @@ LPD3DTEX ZeroGS::CBitwiseTextureMngr::GetTexInt(u32 bitvalue, LPD3DTEX ptexDoNot void ZeroGS::CRangeManager::Insert(int start, int end) { int imin = 0, imax = (int)ranges.size(), imid; - + #ifdef PCSX2_DEBUG // sanity check for(int i = 0; i < (int)ranges.size()-1; ++i) assert( ranges[i].end < ranges[i+1].start ); @@ -2492,7 +2492,7 @@ void ZeroGS::CRangeManager::Insert(int start, int end) assert( end >= ranges.front().start ); if( start < ranges.front().start ) ranges.front().start = start; if( end > ranges.front().end ) ranges.front().end = end; - + #ifdef PCSX2_DEBUG // sanity check for(int i = 0; i < (int)ranges.size()-1; ++i) assert( ranges[i].end < ranges[i+1].start ); @@ -2531,7 +2531,7 @@ void ResolveInRange(int start, int end) Flush(0); Flush(1); - listTargs.clear(); + listTargs.clear(); s_DepthRTs.GetTargs(start, end, listTargs); s_RTs.GetTargs(start, end, listTargs); @@ -2604,7 +2604,7 @@ void FlushTransferRanges(const tex0Info* ptex) if( !(g_GameSettings & GAME_NOQUICKRESOLVE) ) { if( ptarg->fbp != vb[0].gsfb.fbp ) {//&& (vb[0].prndr == NULL || ptarg->fbp != vb[0].prndr->fbp) ) { - + if( ptarg->fbp != vb[1].gsfb.fbp ) { //&& (vb[1].prndr == NULL || ptarg->fbp != vb[1].prndr->fbp) ) { // this render target currently isn't used and is not in the texture's way, so can safely ignore // resolving it. Also the range has to be big enough compared to the target to really call it resolved @@ -2659,7 +2659,7 @@ void FlushTransferRanges(const tex0Info* ptex) } } } - + ptarg->status |= CRenderTarget::TS_Resolved; if( !ptarg->IsDepth() || (!(g_GameSettings & GAME_NODEPTHUPDATE) || end-start > 0x1000) ) ptarg->status |= CRenderTarget::TS_NeedUpdate; @@ -2694,7 +2694,7 @@ void InitTransferHostLocal() gs.imageEndY = gs.imageY + gs.imageHnew; s_vTransferCache.resize(0); - assert( gs.imageEndX < 2048 && gs.imageEndY < 2048 ); + assert( gs.imageEndX < 2048 && gs.imageEndY < 2048 ); // hack! viewful joe if( gs.dstbuf.psm == 63 ) @@ -2829,7 +2829,7 @@ void TransferHostLocal(const void* pbyMem, u32 nQWordSize) //{ // assert( gs.imageTransfer == 0 ); // u8* pstart = g_pbyGSMemory + gs.dstbuf.bp*256; -// +// // const u8* pendbuf = (const u8*)pbyMem + nQWordSize*4; // int i = gs.imageY, j = gs.imageX; // @@ -3027,7 +3027,7 @@ void TransferLocalHost(void* pbyMem, u32 nQWordSize) } } -// dir depends on trxpos.dir +// dir depends on trxpos.dir void TransferLocalLocal() { assert( gs.imageTransfer == 2 ); @@ -3040,7 +3040,7 @@ void TransferLocalLocal() WARN_LOG("Transfer error, dst width exceeds\n"); int srcstart, srcend, dststart, dstend; - + GetRectMemAddress(srcstart, srcend, gs.srcbuf.psm, gs.trxpos.sx, gs.trxpos.sy, gs.imageWnew, gs.imageHnew, gs.srcbuf.bp, gs.srcbuf.bw); GetRectMemAddress(dststart, dstend, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw); @@ -3165,15 +3165,15 @@ void TransferLocalLocal() case PSMT8: if( gs.dstbuf.psm == PSMT8 ) { - TRANSFERLOCALLOCAL(8, 8, 4); + TRANSFERLOCALLOCAL(8, 8, 4); } else { - TRANSFERLOCALLOCAL(8, 8H, 4); + TRANSFERLOCALLOCAL(8, 8H, 4); } break; case PSMT4: - + switch(gs.dstbuf.psm ) { case PSMT4: TRANSFERLOCALLOCAL_4(4, 4); break; case PSMT4HL: TRANSFERLOCALLOCAL_4(4, 4HL); break; @@ -3183,10 +3183,10 @@ void TransferLocalLocal() case PSMT8H: if( gs.dstbuf.psm == PSMT8 ) { - TRANSFERLOCALLOCAL(8H, 8, 4); + TRANSFERLOCALLOCAL(8H, 8, 4); } else { - TRANSFERLOCALLOCAL(8H, 8H, 4); + TRANSFERLOCALLOCAL(8H, 8H, 4); } break; @@ -3272,7 +3272,7 @@ void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h end = 0x00400000; return; } - + if( (psm&0x30) == 0x30 || psm == 0xa ) { const BLOCK& b = m_Blocks[psm]; @@ -3343,7 +3343,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, imask |= 0xff000000; } } - + #define RESOLVE_32BIT(psm, T, Tsrc, blockbits, blockwidth, blockheight, convfn, frame, aax, aay) \ { \ Tsrc* src = (Tsrc*)locksrc.pBits; \ @@ -3407,7 +3407,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(16S, u16, u32, 16, 16, 8, RGBA32to16, Frame, 0, 0); } - + break; case PSMT32Z: case PSMT24Z: @@ -3420,7 +3420,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(32Z, u32, u32, 32, 8, 8, (u32), Frame, 0, 0); } - + break; case PSMT16Z: if( s_AAy ) { @@ -3432,7 +3432,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(16Z, u16, u32, 16, 16, 8, (u16), Frame, 0, 0); } - + break; case PSMT16SZ: if( s_AAy ) { @@ -3444,7 +3444,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(16SZ, u16, u32, 16, 16, 8, (u16), Frame, 0, 0); } - + break; } } @@ -3461,7 +3461,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(32, u32, Vector_16F, 32, 8, 8, Float16ToARGB, Frame16, 0, 0); } - + break; case PSMCT16: if( s_AAy ) { @@ -3473,7 +3473,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(16, u16, Vector_16F, 16, 16, 8, Float16ToARGB16, Frame16, 0, 0); } - + break; case PSMCT16S: if( s_AAy ) { @@ -3485,7 +3485,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(16S, u16, Vector_16F, 16, 16, 8, Float16ToARGB16, Frame16, 0, 0); } - + break; case PSMT32Z: case PSMT24Z: @@ -3498,7 +3498,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(32Z, u32, Vector_16F, 32Z, 8, 8, Float16ToARGB_Z, Frame16, 0, 0); } - + break; case PSMT16Z: if( s_AAy ) { @@ -3510,7 +3510,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(16Z, u16, Vector_16F, 16Z, 16, 8, Float16ToARGB16_Z, Frame16, 0, 0); } - + break; case PSMT16SZ: if( s_AAy ) { @@ -3522,7 +3522,7 @@ void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, else { RESOLVE_32BIT(16SZ, u16, Vector_16F, 16Z, 16, 8, Float16ToARGB16_Z, Frame16, 0, 0); } - + break; } } @@ -3538,7 +3538,7 @@ void SaveTex(tex0Info* ptex, int usevid) { LPD3DTEX pTexture; pd3dDevice->CreateTexture(ptex->tw, ptex->th, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pTexture, NULL); - + D3DLOCKED_RECT lockdst; pTexture->LockRect(0, &lockdst, NULL, 0); @@ -3589,7 +3589,7 @@ void SaveTex(tex0Info* ptex, int usevid) u = RGBA16to32(u); } else u = 0; - + break; case PSMCT16S: addr = getPixelAddress16(j, i, ptex->tbp0, ptex->tbw); @@ -3721,7 +3721,7 @@ void SaveTex(tex0Info* ptex, int usevid) } D3DXSaveTextureToFile("tex.tga", D3DXIFF_TGA, pTexture, NULL); - + SAFE_RELEASE(pTexture); } diff --git a/plugins/zerogs/dx/targets.h b/plugins/zerogs/dx/targets.h index 5e691f36a8..aba9240627 100644 --- a/plugins/zerogs/dx/targets.h +++ b/plugins/zerogs/dx/targets.h @@ -43,7 +43,7 @@ namespace ZeroGS if( ptarg == vb[i].prndr ) { vb[i].prndr = NULL; vb[i].bNeedFrameCheck = 1; } if( ptarg == vb[i].pdepth ) { vb[i].pdepth = NULL; vb[i].bNeedZCheck = 1; } } - + DestroyChildren(ptarg); delete ptarg; } @@ -58,7 +58,7 @@ namespace ZeroGS // kh hack, sometimes kh movies do this to clear the target, so have a static count that periodically checks end static int count = 0; - + if( it->second->fbw == fbw || (it->second->fbw != fbw && (it->second->start < start || ((count++&0xf)?0:it->second->end > end) )) ) it->second->Resolve(); else { @@ -141,7 +141,7 @@ namespace ZeroGS CRenderTarget* ptarg = it->second; mapTargets.erase(it); - + DestroyIntersecting(ptarg); it = mapTargets.find(key); @@ -151,7 +151,7 @@ namespace ZeroGS } else mapTargets[key] = ptarg; - + if( g_GameSettings & GAME_RESOLVEPROMOTED ) ptarg->status = CRenderTarget::TS_Resolved; else @@ -222,7 +222,7 @@ namespace ZeroGS // works in semi logN void Insert(int start, int end); inline void Clear() { ranges.resize(0); } - + vector ranges; // organized in ascending order, non-intersecting }; diff --git a/plugins/zerogs/dx/x86.cpp b/plugins/zerogs/dx/x86.cpp index c09b491c62..1d20c83036 100644 --- a/plugins/zerogs/dx/x86.cpp +++ b/plugins/zerogs/dx/x86.cpp @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -476,11 +476,11 @@ End: void FASTCALL(WriteCLUT_T16_I8_CSM1_c(u32* _vm, u32* _clut)) { - const static u32 map[] = + const static u32 map[] = { 0, 2, 8, 10, 16, 18, 24, 26, 4, 6, 12, 14, 20, 22, 28, 30, - 1, 3, 9, 11, 17, 19, 25, 27, + 1, 3, 9, 11, 17, 19, 25, 27, 5, 7, 13, 15, 21, 23, 29, 31 }; @@ -489,7 +489,7 @@ void FASTCALL(WriteCLUT_T16_I8_CSM1_c(u32* _vm, u32* _clut)) int left = ((u32)(uptr)clut&2) ? 512 : 512-(((u32)(uptr)clut)&0x3ff)/2; - for(int j = 0; j < 8; j++, vm += 32, clut += 64, left -= 32) + for(int j = 0; j < 8; j++, vm += 32, clut += 64, left -= 32) { if(left == 32) { assert( left == 32 ); @@ -519,7 +519,7 @@ void FASTCALL(WriteCLUT_T32_I8_CSM1_c(u32* vm, u32* clut)) u64* dst = (u64*)clut; for(int j = 0; j < 2; j++, src += 32) { - for(int i = 0; i < 4; i++, dst+=16, src+=8) + for(int i = 0; i < 4; i++, dst+=16, src+=8) { dst[0] = src[0]; dst[1] = src[2]; diff --git a/plugins/zerogs/dx/x86.h b/plugins/zerogs/dx/x86.h index 2e19e07ba1..3cdd84e5f4 100644 --- a/plugins/zerogs/dx/x86.h +++ b/plugins/zerogs/dx/x86.h @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/zerogs/dx/zerogs.cpp b/plugins/zerogs/dx/zerogs.cpp index 67e307a598..ed4a68719a 100644 --- a/plugins/zerogs/dx/zerogs.cpp +++ b/plugins/zerogs/dx/zerogs.cpp @@ -109,7 +109,7 @@ BOOL g_bWriteProfile = 0; BOOL g_bSaveTex = 0; // saves the curent texture BOOL g_bSaveFrame = 0; // saves the current psurfTarget BOOL g_bSaveFinalFrame = 0; // saves the input to the CRTC -BOOL g_bUpdateStencil = 1; // only needed for dest alpha test (unfortunately, it has to be on all the time) +BOOL g_bUpdateStencil = 1; // only needed for dest alpha test (unfortunately, it has to be on all the time) BOOL g_bSaveResolved = 0; #endif @@ -117,7 +117,7 @@ BOOL g_bSaveResolved = 0; #define DRAW() pd3dDevice->DrawPrimitive(primtype[curvb.curprim.prim], 0, curvb.dwCount) extern int s_frameskipping; - + //inline void SetRenderTarget_(int index, LPD3DSURF psurf, int counter, const char* pname) //{ // static LPD3DSURF ptargs[4] = {NULL}; @@ -165,11 +165,11 @@ static const DWORD blendinvalpha[3] = { D3DBLEND_INVSRCALPHA, D3DBLEND_INVDESTAL static const int PRIMMASK = 0x0e; // for now ignore 0x10 (AA) -static const DWORD g_dwAlphaCmp[] = { D3DCMP_NEVER, D3DCMP_ALWAYS, D3DCMP_LESS, D3DCMP_LESSEQUAL, +static const DWORD g_dwAlphaCmp[] = { D3DCMP_NEVER, D3DCMP_ALWAYS, D3DCMP_LESS, D3DCMP_LESSEQUAL, D3DCMP_EQUAL, D3DCMP_GREATEREQUAL, D3DCMP_GREATER, D3DCMP_NOTEQUAL }; // used for afail case -static const DWORD g_dwReverseAlphaCmp[] = { D3DCMP_ALWAYS, D3DCMP_NEVER, D3DCMP_GREATEREQUAL, D3DCMP_GREATER, +static const DWORD g_dwReverseAlphaCmp[] = { D3DCMP_ALWAYS, D3DCMP_NEVER, D3DCMP_GREATEREQUAL, D3DCMP_GREATER, D3DCMP_NOTEQUAL, D3DCMP_LESS, D3DCMP_LESSEQUAL, D3DCMP_EQUAL }; static const DWORD g_dwZCmp[] = { D3DCMP_NEVER, D3DCMP_ALWAYS, D3DCMP_GREATEREQUAL, D3DCMP_GREATER }; @@ -210,7 +210,7 @@ static BOOL s_bDestAlphaTest = FALSE; static int s_nLastResolveReset = 0; static int s_nResolveCounts[30] = {0}; // resolve counts for last 30 frames static int s_nCurResolveIndex = 0; -int s_nResolved = 0; // number of targets resolved this frame +int s_nResolved = 0; // number of targets resolved this frame int g_nDepthUsed = 0; // ffx2 pal movies static int s_nWriteDepthCount = 0; static int s_nWireframeCount = 0; @@ -218,7 +218,7 @@ static int s_nWriteDestAlphaTest = 0; //////////////////// // State parameters -static float fiRendWidth, fiRendHeight; +static float fiRendWidth, fiRendHeight; static DWORD dwStencilRef, dwStencilMask; @@ -261,7 +261,7 @@ namespace ZeroGS u8* g_pbyGSMemory = NULL; // 4Mb GS system mem u8* g_pbyGSClut = NULL; - D3DPRESENT_PARAMETERS d3dpp; + D3DPRESENT_PARAMETERS d3dpp; BYTE s_AAx = 0, s_AAy = 0; // if AAy is set, then AAx has to be set BYTE bIndepWriteMasks = 1; @@ -280,7 +280,7 @@ namespace ZeroGS extern CRangeManager s_RangeMngr; // manages overwritten memory void FlushTransferRanges(const tex0Info* ptex); - // returns the first and last addresses aligned to a page that cover + // returns the first and last addresses aligned to a page that cover void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw); HRESULT LoadEffects(); @@ -376,7 +376,7 @@ void ZeroGS::VB::Destroy() { Unlock(); SAFE_RELEASE(pvb); - + prndr = NULL; pdepth = NULL; } @@ -496,7 +496,7 @@ void ZeroGS::VB::CheckFrame(int tbp) ResetAlphaVariables(); } } - + int fbh = (scissor.y1>>MINMAX_SHIFT)+1; if( fbh > 2 && (fbh&1) ) fbh -= 1; @@ -529,7 +529,7 @@ void ZeroGS::VB::CheckFrame(int tbp) frame.fbh = considerheight; else if( frame.fbh <= 32 ) frame.fbh = considerheight; - + if( frame.fbh == considerheight ) { // stops bad resolves (mgs3) if( !curprim.abe && (!test.ate || test.atst == 0) ) @@ -646,7 +646,7 @@ void ZeroGS::VB::CheckFrame(int tbp) f.fbw = prndr->fbw; f.fbh = prndr->fbh; f.psm = zbuf.psm; - + if( zbuf.psm == 0x31 ) f.fbm = 0xff000000; else f.fbm = 0; CDepthTarget* pnewdepth = (CDepthTarget*)s_DepthRTs.GetTarg(f, CRenderTargetMngr::TO_DepthBuffer|CRenderTargetMngr::TO_StrictHeight| @@ -661,13 +661,13 @@ void ZeroGS::VB::CheckFrame(int tbp) pdepth = pnewdepth; } } - + s_nResolved &= 0xff; // restore if( prndr != NULL ) SetContextTarget(ictx); - //if( prndr != NULL && ictx == icurctx) + //if( prndr != NULL && ictx == icurctx) //else bVarsSetTarg = 0; // if( prndr != NULL && bChanged ) { @@ -690,7 +690,7 @@ void ZeroGS::VB::FlushTexData() if( uCurTex0Data[0] == uNextTex0Data[0] && (uCurTex0Data[1]&0x1f) == (uNextTex0Data[1]&0x1f) ) { if( PSMT_ISCLUT(psm) ) { - + // have to write the CLUT again if changed if( (uCurTex0Data[1]&0x1fffffe0) == (uNextTex0Data[1]&0x1fffffe0) ) { @@ -791,7 +791,7 @@ static ZeroGSInit s_ZeroGSInit; HRESULT ZeroGS::Create(LONG _width, LONG _height) { Destroy(1); - GSStateReset(); + GSStateReset(); width = _width; height = _height; @@ -877,7 +877,7 @@ HRESULT ZeroGS::Create(LONG _width, LONG _height) if( FAILED( hr = pD3D->CreateDevice( adapter, devtype, GShwnd, !DEBUG_PS2 ? hwoptions : D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pd3dDevice ) ) ) - { + { ERROR_LOG(_T("Failed to create hardware device, creating software.\n")); if( FAILED( hr = pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, GShwnd, @@ -931,7 +931,7 @@ HRESULT ZeroGS::Create(LONG _width, LONG _height) else if( FAILED(hr) ) { ERROR_LOG("******\nGS ERROR: Device doesn't support alpha blending for 16bit floating point targets.\nQuality will reduce.\n*********\n"); g_RenderFormat = D3DFMT_A8R8G8B8; - } + } // hr = pD3D->CheckDeviceFormat( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_G32R32F); // @@ -1095,7 +1095,7 @@ void ZeroGS::GSStateReset() if( pvb != NULL ) pvb->AddRef(); vb[i].Destroy(); memset(&vb[i], 0, sizeof(VB)); - + vb[i].tex0.tw = 1; vb[i].tex0.th = 1; vb[i].pvb = pvb; @@ -1148,7 +1148,7 @@ void ZeroGS::Reset() { s_RTs.ResolveAll(); s_DepthRTs.ResolveAll(); - + vb[0].Unlock(); vb[1].Unlock(); @@ -1218,7 +1218,7 @@ void ZeroGS::ChangeDeviceSize(int nNewWidth, int nNewHeight) void ZeroGS::SetAA(int mode) { float f; - + // need to flush all targets s_RTs.ResolveAll(); s_RTs.Destroy(); @@ -1226,7 +1226,7 @@ void ZeroGS::SetAA(int mode) s_DepthRTs.Destroy(); s_AAx = s_AAy = 0; - if( mode > 0 ) + if( mode > 0 ) { s_AAx = (mode+1) / 2; s_AAy = mode / 2; @@ -1236,7 +1236,7 @@ void ZeroGS::SetAA(int mode) vb[0].prndr = NULL; vb[0].pdepth = NULL; vb[0].bNeedFrameCheck = 1; vb[0].bNeedZCheck = 1; vb[1].prndr = NULL; vb[1].pdepth = NULL; vb[1].bNeedFrameCheck = 1; vb[1].bNeedZCheck = 1; - + f = mode > 0 ? 2.0f : 1.0f; SETRS(D3DRS_POINTSIZE, FtoDW(f)); } @@ -1303,7 +1303,7 @@ HRESULT ZeroGS::LoadExtraEffects() LOAD_VS(vsshaders[i]|mask|SH_WRITEDEPTH, pvs[2*i+8]); LOAD_VS(vsshaders[i]|mask|SH_WRITEDEPTH|SH_CONTEXT1, pvs[2*i+8+1]); } - + LOAD_VS(SH_BITBLTVS, pvsBitBlt); //LOAD_VS(SH_BITBLTVS|SH_30, pvsBitBlt30); @@ -1354,7 +1354,7 @@ LPD3DPS ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int testaem, i assert( index < ArraySize(ppsTexture) ); LPD3DPS* pps = ppsTexture+index; - if( *pps != NULL ) + if( *pps != NULL ) return *pps; index += NUM_SHADERS*g_nPixelShaderVer; @@ -1372,12 +1372,12 @@ LPD3DPS ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int testaem, i return NULL; } - + #else // not RELEASE_TO_PUBLIC //#define EFFECT_NAME "f:\\ps2dev\\pcsx2\\zerogs\\dx\\" #define EFFECT_NAME ".\\" -#define COMPILE_SHADER(name, type, flags) +#define COMPILE_SHADER(name, type, flags) class ZeroGSShaderInclude : public ID3DXInclude { @@ -1396,7 +1396,7 @@ public: _snprintf(strfile, 255, "%s%s", EFFECT_NAME, pFileName); pfilename = strfile; } - + FILE* f = fopen(pfilename, "rb"); if( f == NULL ) @@ -1490,7 +1490,7 @@ HRESULT ZeroGS::LoadExtraEffects() D3DXMACRO* pmacros = NULL; macros[0].Name = "WRITE_DEPTH"; - macros[0].Definition = "1"; + macros[0].Definition = "1"; for(int i = 0; i < 4; ++i) { pmacros = NULL; @@ -1537,7 +1537,7 @@ HRESULT ZeroGS::LoadExtraEffects() LPD3DPS ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int testaem, int exactcolor, const clampInfo& clamp, int context) { int texwrap; - + assert( texfilter < NUM_FILTERS ); //assert( g_nPixelShaderVer == SHADER_30 ); if( clamp.wms == clamp.wmt ) { @@ -1558,9 +1558,9 @@ LPD3DPS ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int testaem, i LPD3DPS* pps = ppsTexture+index; - if( *pps != NULL ) + if( *pps != NULL ) return *pps; - + ZeroGSShaderInclude inc; inc.context = context; @@ -1630,7 +1630,7 @@ HRESULT ZeroGS::InitDeviceObjects() if( ptexBilinearBlocks != NULL ) ptexBilinearBlocks->LockRect(0, &lockbilinear, NULL, 0); - + BLOCK::FillBlocks(&lock, ptexBilinearBlocks != NULL ? &lockbilinear : NULL, blockfmt); ptexBlocks->UnlockRect(0); @@ -1689,7 +1689,7 @@ HRESULT ZeroGS::InitDeviceObjects() pd3dDevice->SetTexture(SAMP_BLOCKS, ptexBlocks); pd3dDevice->SetTexture(SAMP_BILINEARBLOCKS, ptexBilinearBlocks); pd3dDevice->SetVertexDeclaration(pdecl); - + SETRS(D3DRS_STENCILENABLE, FALSE); SETRS(D3DRS_SCISSORTESTENABLE, 1); SETRS(D3DRS_SEPARATEALPHABLENDENABLE, USEALPHABLENDING); @@ -1871,7 +1871,7 @@ void ZeroGS::Flush(int context) // curvb.dwCount = 0; // return; // } - + // if texture is part of a previous target, use that instead int tbw = curvb.tex0.tbw; int tbp0 = curvb.tex0.tbp0; @@ -1916,13 +1916,13 @@ void ZeroGS::Flush(int context) PRIM_LOG("test: ate:%d, atst: %s, aref: %d, afail: %s, date: %d, datm: %d, zte: %d, ztst: %s, fba: %d\n", curvb.test.ate, patst[curvb.test.atst], curvb.test.aref, pafail[curvb.test.afail], curvb.test.date, curvb.test.datm, curvb.test.zte, pztst[curvb.test.ztst], curvb.fba.fba); PRIM_LOG("alpha: A%d B%d C%d D%d FIX:%d pabe: %d; aem: %d, ta0: %d, ta1: %d\n", curvb.alpha.a, curvb.alpha.b, curvb.alpha.c, curvb.alpha.d, curvb.alpha.fix, gs.pabe, gs.texa.aem, gs.texa.ta[0], gs.texa.ta[1]); - PRIM_LOG("tex0: tbp0=0x%x, tbw=%d, psm=0x%x, tw=%d, th=%d, tcc=%d, tfx=%d, cbp=0x%x, cpsm=0x%x, csm=%d, csa=%d, cld=%d\n", - curvb.tex0.tbp0, curvb.tex0.tbw, curvb.tex0.psm, curvb.tex0.tw, + PRIM_LOG("tex0: tbp0=0x%x, tbw=%d, psm=0x%x, tw=%d, th=%d, tcc=%d, tfx=%d, cbp=0x%x, cpsm=0x%x, csm=%d, csa=%d, cld=%d\n", + curvb.tex0.tbp0, curvb.tex0.tbw, curvb.tex0.psm, curvb.tex0.tw, curvb.tex0.th, curvb.tex0.tcc, curvb.tex0.tfx, curvb.tex0.cbp, curvb.tex0.cpsm, curvb.tex0.csm, curvb.tex0.csa, curvb.tex0.cld); PRIM_LOG("frame: %d\n\n", g_SaveFrameNum); #endif - + CMemoryTarget* pmemtarg = NULL; CRenderTarget* ptextarg = NULL; @@ -2011,7 +2011,7 @@ void ZeroGS::Flush(int context) // have to add an offset to all texture reads mytex0.tbp0 = tbp0; // change so that SetTexVariablesInt can set the right offsets - SetTexVariablesInt(context, GetTexFilter(curvb.tex1), mytex0, pmemtarg, s_bForceTexFlush); + SetTexVariablesInt(context, GetTexFilter(curvb.tex1), mytex0, pmemtarg, s_bForceTexFlush); curvb.bVarsTexSync = TRUE; ptextarg = NULL; // won't be needing this anymore @@ -2086,9 +2086,9 @@ void ZeroGS::Flush(int context) SetContextTarget(context); else { assert( curvb.pdepth != NULL ); - + if( curvb.pdepth->status & CRenderTarget::TS_Virtual) { - + if( !curvb.zbuf.zmsk ) { CRenderTarget* ptemp = s_DepthRTs.Promote(curvb.pdepth->fbp|(curvb.pdepth->fbw<<16)); assert( ptemp == curvb.pdepth ); @@ -2112,7 +2112,7 @@ void ZeroGS::Flush(int context) } } else { - SetTexVariablesInt(context, GetTexFilter(curvb.tex1), curvb.tex0, pmemtarg, s_bForceTexFlush); + SetTexVariablesInt(context, GetTexFilter(curvb.tex1), curvb.tex0, pmemtarg, s_bForceTexFlush); vb[context].bVarsTexSync = TRUE; INC_TEXVARS(); @@ -2123,7 +2123,7 @@ void ZeroGS::Flush(int context) assert( !(curvb.prndr->status&CRenderTarget::TS_NeedUpdate) ); curvb.prndr->status = 0; - + if( curvb.pdepth != NULL ) { assert( !(curvb.pdepth->status&CRenderTarget::TS_NeedUpdate) ); if( !curvb.zbuf.zmsk ) { @@ -2182,7 +2182,7 @@ void ZeroGS::Flush(int context) pd3dDevice->SetSamplerState(SAMP_MEMORY0+context, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); dwFilterOpts |= 1; } - + if( curvb.tex1.mmin ) { pd3dDevice->SetSamplerState(SAMP_MEMORY0+context, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); dwFilterOpts |= 2; @@ -2345,7 +2345,7 @@ void ZeroGS::Flush(int context) pd3dDevice->SetSamplerState(SAMP_MEMORY0+context, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); dwFilterOpts |= 1; } - + if( curvb.tex1.mmin ) { pd3dDevice->SetSamplerState(SAMP_MEMORY0+context, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); dwFilterOpts |= 2; @@ -2424,13 +2424,13 @@ void ZeroGS::Flush(int context) else pps = ppsRegular[curvb.curprim.fge+2*s_bWriteDepth]; pd3dDevice->SetPixelShader(pps); - + BOOL bCanRenderStencil = g_bUpdateStencil && (curvb.prndr->psm&0xf) != 1 && !(curvb.frame.fbm&0x80000000); if( g_GameSettings & GAME_NOSTENCIL ) bCanRenderStencil = 0; if( s_bDestAlphaTest) { - SETRS(D3DRS_STENCILENABLE, bCanRenderStencil); + SETRS(D3DRS_STENCILENABLE, bCanRenderStencil); SETRS(D3DRS_STENCILPASS, D3DSTENCILOP_KEEP); SETRS(D3DRS_STENCILFUNC, D3DCMP_ALWAYS); } @@ -2591,7 +2591,7 @@ void ZeroGS::Flush(int context) SETRS(D3DRS_ALPHAFUNC, g_dwReverseAlphaCmp[curtest.atst]); if( curtest.afail & 1 ) { // front buffer update only - + if( curtest.afail == 3 ) // disable alpha SETRS(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED); @@ -2604,7 +2604,7 @@ void ZeroGS::Flush(int context) } else { // zbuffer update only - SETRS(D3DRS_COLORWRITEENABLE, 0); + SETRS(D3DRS_COLORWRITEENABLE, 0); } if( gs.pabe && bCanRenderStencil ) { @@ -2641,7 +2641,7 @@ void ZeroGS::Flush(int context) // Empty the command buffer and wait until the GPU is idle. // while(S_FALSE == pOcclusionQuery->GetData( &numberOfPixelsDrawn, sizeof(DWORD), D3DGETDATA_FLUSH )); // SAFE_RELEASE(pOcclusionQuery); - + if( gs.pabe ) { // only render the pixels with alpha values < 0x80 SETRS(D3DRS_ALPHABLENDENABLE, 0); @@ -2661,7 +2661,7 @@ void ZeroGS::Flush(int context) } // restore - + if( (curtest.afail & 1) && !curvb.zbuf.zmsk ) { SETRS(D3DRS_ZWRITEENABLE, TRUE); @@ -2740,7 +2740,7 @@ void ZeroGS::Flush(int context) SETRS(D3DRS_ZENABLE, FALSE); SETRS(D3DRS_ZWRITEENABLE, FALSE); SETRS(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN); - + if( s_bWriteDepth ) { if( bIndepWriteMasks ) SETRS(D3DRS_COLORWRITEENABLE1, 0); else pd3dDevice->SetRenderTarget(1,NULL); @@ -2760,7 +2760,7 @@ void ZeroGS::Flush(int context) SETRS(D3DRS_BLENDOP, D3DBLENDOP_MAX); DRAW(); } - + // bios shows white screen if( bAlphaClamping & 2 ) { // max f = 1; @@ -2804,7 +2804,7 @@ void ZeroGS::Flush(int context) //#endif curvb.dwCurOff += POINT_BUFFERFLUSH; SAFE_RELEASE(ptexRenderTargetCached); - + g_MaxRenderedHeight = 0; curvb.dwCount = 0; //curvb.Lock(); @@ -2828,7 +2828,7 @@ void ZeroGS::ProcessMessages() RECT rctext; rctext.left = 25; rctext.top = 15; list::iterator it = listMsgs.begin(); - + while( it != listMsgs.end() ) { rctext.left += 1; rctext.top += 1; @@ -2915,7 +2915,7 @@ void ZeroGS::AdjustTransToAspect(DXVEC4& v, int dispwidth, int dispheight) float temp, f; if( dispwidth * height > dispheight * width ) { // limited by width - + // change in ratio f = ((float)width / (float)dispwidth) / ((float)height / (float)dispheight); v.y *= f; @@ -2988,7 +2988,7 @@ void ZeroGS::RenderCRTC(int interlace) if( g_bSaveFrame ) { if( vb[0].prndr != NULL ) D3DXSaveSurfaceToFile("frame1.tga", D3DXIFF_TGA, vb[0].prndr->psurf, NULL, NULL); - + if( vb[1].prndr != NULL && vb[0].prndr != vb[1].prndr ) D3DXSaveSurfaceToFile("frame2.tga", D3DXIFF_TGA, vb[1].prndr->psurf, NULL, NULL); else DeleteFile("frame2.tga"); } @@ -3066,7 +3066,7 @@ void ZeroGS::RenderCRTC(int interlace) GSRegDISPLAY* pd = i ? DISPLAY2 : DISPLAY1; int magh = pd->MAGH+1; int magv = pd->MAGV+1; - + dispinfo[i].tbp0 = pfb->FBP << 5; dispinfo[i].tbw = pfb->FBW << 6; dispinfo[i].tw = (pd->DW + 1) / magh; @@ -3107,7 +3107,7 @@ void ZeroGS::RenderCRTC(int interlace) // interlace mode pd3dDevice->SetTexture(SAMP_INTERLACE, CreateInterlaceTex(2*texframe.th)); - + if( interlace == (conf.interlace&1) ) { // pass if odd valpha.z = 1.0f; @@ -3173,7 +3173,7 @@ void ZeroGS::RenderCRTC(int interlace) pd3dDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); continue; } - + // first render the current render targets, then from ptexMem if( texframe.psm == 1 ) { valpha.x = 0; @@ -3195,7 +3195,7 @@ void ZeroGS::RenderCRTC(int interlace) s_RTs.GetTargs(start, end, listTargs); for(list::iterator it = listTargs.begin(); it != listTargs.end(); ) { - + CRenderTarget* ptarg = *it; if( ptarg->fbw == texframe.tbw && !(ptarg->status&CRenderTarget::TS_NeedUpdate) && ((256/bpp)*(texframe.tbp0-ptarg->fbp))%texframe.tbw == 0 ) { @@ -3213,7 +3213,7 @@ void ZeroGS::RenderCRTC(int interlace) continue; } } - + static int sindex = 0; char strtemp[25]; sprintf(strtemp, "frames/frame%d.jpg", sindex++); @@ -3267,7 +3267,7 @@ void ZeroGS::RenderCRTC(int interlace) v.y = dh/(float)texframe.th; v.z = 0; v.w = 1-v.y; - + if( movy > 0 ) v.w -= movy/(float)texframe.th; @@ -3301,7 +3301,7 @@ void ZeroGS::RenderCRTC(int interlace) } } } - + ++it; } @@ -3335,7 +3335,7 @@ void ZeroGS::RenderCRTC(int interlace) v.z = 0;//-0.5f * v.x; v.w = -0.5f * v.y; SETCONSTF(GPU_INVTEXDIMS, v); - + pd3dDevice->SetPixelShader(ppsCRTC[bInterlace]); pd3dDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); } @@ -3393,7 +3393,7 @@ void ZeroGS::RenderCRTC(int interlace) } if( g_bMakeSnapshot ) { - + if( SUCCEEDED(D3DXSaveSurfaceToFile(strSnapshot != ""?strSnapshot.c_str():"temp.jpg", (conf.options&GSOPTION_BMPSNAP)?D3DXIFF_BMP:D3DXIFF_JPG, psurfOrgTarg, NULL, NULL)) ) { char str[255]; sprintf(str, "saved %s\n", strSnapshot.c_str()); @@ -3498,7 +3498,7 @@ void ZeroGS::RenderCRTC(int interlace) // Internal Definitions // ////////////////////////// -__forceinline void MOVZ(VertexGPU *p, u32 gsz, const VB& curvb) +__forceinline void MOVZ(VertexGPU *p, u32 gsz, const VB& curvb) { p->z = curvb.zprimmask==0xffff?min((u32)0xffff, gsz):gsz; } @@ -3508,33 +3508,33 @@ __forceinline void MOVFOG(VertexGPU *p, Vertex gsf) p->f = ((s16)(gsf).f<<7)|0x7f; } -__forceinline void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) -{ - int index = Index; - +__forceinline void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) +{ + int index = Index; + p->x = (((int)gs.gsvertex[index].x - curvb.offset.x)>>1)&0xffff; p->y = (((int)gs.gsvertex[index].y - curvb.offset.y)>>1)&0xffff; - + /*x = ((int)gs.gsvertex[index].x - curvb.offset.x); y = ((int)gs.gsvertex[index].y - curvb.offset.y); p.x = (x&0x7fff) | (x < 0 ? 0x8000 : 0); p.y = (y&0x7fff) | (y < 0 ? 0x8000 : 0);*/ - + p->f = ((s16)gs.gsvertex[index].f<<7)|0x7f; MOVZ(p, gs.gsvertex[index].z, curvb); p->rgba = prim->iip ? gs.gsvertex[index].rgba : gs.rgba; - + if ((g_GameSettings & GAME_TEXAHACK) && !(p->rgba&0xffffff)) p->rgba = 0; - if (prim->tme ) + if (prim->tme ) { - if( prim->fst ) + if( prim->fst ) { p->s = (float)gs.gsvertex[index].u * fiTexWidth[prim->ctxt]; p->t = (float)gs.gsvertex[index].v * fiTexHeight[prim->ctxt]; p->q = 1; } - else + else { p->s = gs.gsvertex[index].s; p->t = gs.gsvertex[index].t; @@ -3673,10 +3673,10 @@ void ZeroGS::KickTriangleFan() #endif } -__forceinline void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb) +__forceinline void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb) { - SET_VERTEX(p, next, curvb); - MOVZ(p, v.z, curvb); + SET_VERTEX(p, next, curvb); + MOVZ(p, v.z, curvb); MOVFOG(p, v); } @@ -3700,7 +3700,7 @@ void ZeroGS::KickSprite() int last = (gs.primIndex+2)%ArraySize(gs.gsvertex); // sprite is too small and AA shows lines (tek4) - if( s_AAx ) + if( s_AAx ) { gs.gsvertex[last].x += 4; if (s_AAy) gs.gsvertex[last].y += 4; @@ -3711,7 +3711,7 @@ void ZeroGS::KickSprite() // return; VertexGPU* p = curvb.pbuf+curvb.dwCount*3; - + SetKickVertex(&p[0], gs.gsvertex[last], next, curvb); SetKickVertex(&p[3], gs.gsvertex[last], next, curvb); SetKickVertex(&p[1], gs.gsvertex[last], last, curvb); @@ -3726,7 +3726,7 @@ void ZeroGS::KickSprite() SetKickVertex(&p[5], gs.gsvertex[last], last, curvb); p[5].s = p[0].s; - p[5].x = p[0].x; + p[5].x = p[0].x; curvb.dwCount += 2; @@ -3783,7 +3783,7 @@ __forceinline void ZeroGS::RenderFBA(const VB& curvb) if( !curvb.zbuf.zmsk ) { SETRS(D3DRS_ZWRITEENABLE, TRUE); - + assert( curvb.pdepth != NULL ); if( s_bWriteDepth ) { if( bIndepWriteMasks ) SETRS(D3DRS_COLORWRITEENABLE1, 0xf); @@ -3818,7 +3818,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb) SETRS(D3DRS_STENCILFUNC, D3DCMP_ALWAYS); SETRS(D3DRS_STENCILENABLE, TRUE); - + if( !s_bDestAlphaTest ) { // clear everything SETRS(D3DRS_STENCILREF, 0); @@ -3839,7 +3839,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb) SETRS(D3DRS_STENCILREF, STENCIL_SPECIAL); SETRS(D3DRS_STENCILWRITEMASK, STENCIL_SPECIAL); SETRS(D3DRS_ZENABLE, FALSE); - + DRAW(); if( curvb.test.zte ) SETRS(D3DRS_ZENABLE, TRUE); @@ -3859,7 +3859,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb) __forceinline void ZeroGS::RenderStencil(const VB& curvb, DWORD dwUsingSpecialTesting) { - //NOTE: This stencil hack for dest alpha testing ONLY works when + //NOTE: This stencil hack for dest alpha testing ONLY works when // the geometry in one DrawPrimitive call does not overlap // mark the stencil buffer for the new data's bits (mark 4 if alpha is >= 0xff) @@ -3948,7 +3948,7 @@ __forceinline void ZeroGS::ProcessFBA(const VB& curvb) SETRS(D3DRS_ZENABLE, FALSE); SETRS(D3DRS_ZWRITEENABLE, FALSE); SETRS(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA); - + if( s_bWriteDepth ) { if( bIndepWriteMasks ) SETRS(D3DRS_COLORWRITEENABLE1, 0); else pd3dDevice->SetRenderTarget(1, NULL); @@ -4025,10 +4025,10 @@ inline void ZeroGS::SetContextTarget(int context) curvb.pdepth = (CDepthTarget*)s_DepthRTs.GetTarg(f, CRenderTargetMngr::TO_DepthBuffer|CRenderTargetMngr::TO_StrictHeight| (curvb.zbuf.zmsk?CRenderTargetMngr::TO_Virtual:0), GET_MAXHEIGHT(curvb.zbuf.zbp, curvb.gsfb.fbw, 0)); } - + assert( curvb.prndr != NULL && curvb.pdepth != NULL ); assert( curvb.pdepth->fbh == curvb.prndr->targheight ); - + // if( curvb.pdepth->fbh != curvb.prndr->fbh ) { // // s_DepthRTs.DestroyTarg(curvb.pdepth); @@ -4040,11 +4040,11 @@ inline void ZeroGS::SetContextTarget(int context) // f.psm = curvb.zbuf.psm; // f.fbm = 0; // curvb.pdepth = (CDepthTarget*)s_DepthRTs.GetTarg(f, CRenderTargetMngr::TO_DepthBuffer|CRenderTargetMngr::TO_StrictHeight| -// (curvb.zbuf.zmsk?CRenderTargetMngr::TO_Virtual:0), GET_MAXHEIGHT(curvb.zbuf.zbp, curvb.gsfb.fbw, 0)); +// (curvb.zbuf.zmsk?CRenderTargetMngr::TO_Virtual:0), GET_MAXHEIGHT(curvb.zbuf.zbp, curvb.gsfb.fbw, 0)); // } if( curvb.pdepth->status & CRenderTarget::TS_Virtual) { - + if( !curvb.zbuf.zmsk ) { CRenderTarget* ptemp = s_DepthRTs.Promote(curvb.pdepth->fbp|(curvb.pdepth->fbw<<16)); assert( ptemp == curvb.pdepth ); @@ -4062,7 +4062,7 @@ inline void ZeroGS::SetContextTarget(int context) curvb.pdepth->Update(context, curvb.prndr); bSetTarg = 0; } - + if( curvb.prndr->status & CRenderTarget::TS_NeedUpdate ) { if( s_bWriteDepth ) { @@ -4077,11 +4077,11 @@ inline void ZeroGS::SetContextTarget(int context) curvb.prndr->Update(context, curvb.pdepth); // note, targ already set } - else { + else { //if( (vb[0].prndr != vb[1].prndr && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg ) pd3dDevice->SetRenderTarget(0, curvb.prndr->psurf); - //if( bSetTarg && ((vb[0].pdepth != vb[1].pdepth && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg) ) + //if( bSetTarg && ((vb[0].pdepth != vb[1].pdepth && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg) ) curvb.pdepth->SetDepthTarget(); if( s_ptexCurSet[0] == curvb.prndr->ptex ) { @@ -4120,7 +4120,7 @@ void ZeroGS::SetTexVariables(int context) DXVEC4 v, v2; tex0Info& tex0 = vb[context].tex0; - + float fw = (float)tex0.tw; float fh = (float)tex0.th; @@ -4131,7 +4131,7 @@ void ZeroGS::SetTexVariables(int context) // if clut, use the frame format int psm = tex0.psm; if( PSMT_ISCLUT(tex0.psm) ) psm = tex0.cpsm; - + int nNeedAlpha = (psm == 1 || psm == 2 || psm == 10); DXVEC4 vblack; @@ -4142,26 +4142,26 @@ void ZeroGS::SetTexVariables(int context) valpha.z = 0; valpha.w = 0; valpha2.x = 0; valpha2.y = 0; valpha2.z = 2; valpha2.w = 1; - + break; case 1: valpha.z = 0; valpha.w = 1; valpha2.x = 1; valpha2.y = 0; valpha2.z = 0; valpha2.w = 0; - + break; case 2: valpha.z = 1; valpha.w = 1.0f; valpha2.x = 0; valpha2.y = tex0.tcc ? 1.0f : 0.0f; - valpha2.z = 2; valpha2.w = 0; - + valpha2.z = 2; valpha2.w = 0; + break; case 3: valpha.z = 1; valpha.w = tex0.tcc ? 0.0f : 1.0f; valpha2.x = 0; valpha2.y = tex0.tcc ? 1.0f : 0.0f; valpha2.z = 2; valpha2.w = 0; - + break; default: __assume(0); } @@ -4176,7 +4176,7 @@ void ZeroGS::SetTexVariables(int context) } if( nNeedAlpha ) { - + if( tex0.tfx == 0 ) { // make sure alpha is mult by two when the output is Cv = Ct*Cf valpha.x = 2*gs.texa.fta[0]; @@ -4344,7 +4344,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, float fpage = tex0.tbp0*(64.0f*g_fitexwidth) + 0.05f * g_fitexwidth; float fpageint = floorf(fpage); int starttbp = (int)fpage; - + // 2048 is number of words to span one page float fblockstride = (2048.0f /(float)(g_texwidth*BLOCK_TEXWIDTH)) * b.vTexDims.x * fbw; assert( fblockstride >= 1.0f ); @@ -4465,12 +4465,12 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) if( a.a == 2 ) { // zero all color SETRS(D3DRS_SRCBLEND, D3DBLEND_ZERO); - SETRS(D3DRS_DESTBLEND, D3DBLEND_ZERO); + SETRS(D3DRS_DESTBLEND, D3DBLEND_ZERO); goto EndSetAlpha; } - else if( a.b == 2 ) { + else if( a.b == 2 ) { //b2XAlphaTest = 1; - + SET_ALPHA_COLOR_FACTOR(1); if( bDestAlphaColor == 2 ) { @@ -4481,7 +4481,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) else { if( bNeedAlphaColor ) bAlphaClamping = 2; - SETRS(D3DRS_BLENDOP, D3DBLENDOP_ADD); + SETRS(D3DRS_BLENDOP, D3DBLENDOP_ADD); SETRS(D3DRS_SRCBLEND, a.a == 0 ? blendalpha[usec] : D3DBLEND_ZERO); SETRS(D3DRS_DESTBLEND, a.a == 0 ? D3DBLEND_ZERO : blendalpha[usec]); } @@ -4558,7 +4558,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) if( a.a == a.d ) { // can get away with 1+A, but need to set alpha to negative SETRS(D3DRS_BLENDOP, D3DBLENDOP_ADD); - + if( bDestAlphaColor == 2 ) { assert(usec==1); @@ -4690,7 +4690,7 @@ bool ZeroGS::CheckChangeInClut(u32 highdword, u32 psm) int cpsm = (highdword >> 19) & 0xe; int csm = (highdword >> 23) & 0x1; - + if( cpsm > 1 || csm ) // don't support 16bit for now return true; @@ -4739,7 +4739,7 @@ Start: movq mm7, [edx+56] pcmpeqd mm6, [ecx+40] pcmpeqd mm7, [ecx+56] - + pand mm0, mm4 pand mm6, mm7 pand mm0, mm6 @@ -4756,7 +4756,7 @@ Continue: test ebx, 0x10 jz AddEcx - sub ecx, 448 // go back and down one column, + sub ecx, 448 // go back and down one column, AddEcx: add ecx, 256 // go to the right block @@ -4812,7 +4812,7 @@ void ZeroGS::texClutWrite(int ctx) Flush(!ctx); int entries = (tex0.psm&3)==3 ? 256 : 16; -if (tex0.csm) +if (tex0.csm) { switch (tex0.cpsm) { @@ -4823,51 +4823,51 @@ if (tex0.csm) u16* src = (u16*)g_pbyGSMemory + tex0.cbp*128; u16 *dst = (u16*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0)); - for (int i = 0; i < entries; ++i) + for (int i = 0; i < entries; ++i) { *dst = src[getPixelAddress16_0(gs.clut.cou+i, gs.clut.cov, gs.clut.cbw)]; dst += 2; - + // check for wrapping if (((u32)dst & 0x3ff) == 0) dst = (u16*)(g_pbyGSClut+2); } break; } - + case PSMCT16S: { u16* src = (u16*)g_pbyGSMemory + tex0.cbp*128; u16 *dst = (u16*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0)); - for (int i = 0; i < entries; ++i) + for (int i = 0; i < entries; ++i) { *dst = src[getPixelAddress16S_0(gs.clut.cou+i, gs.clut.cov, gs.clut.cbw)]; dst += 2; - + // check for wrapping if (((u32)dst & 0x3ff) == 0) dst = (u16*)(g_pbyGSClut+2); } break; } - + case PSMCT32: case PSMCT24: { u32* src = (u32*)g_pbyGSMemory + tex0.cbp*64; u32 *dst = (u32*)(g_pbyGSClut+64*tex0.csa); - + // check if address exceeds src - if( src+getPixelAddress32_0(gs.clut.cou+entries-1, gs.clut.cov, gs.clut.cbw) >= (u32*)g_pbyGSMemory + 0x00100000 ) + if( src+getPixelAddress32_0(gs.clut.cou+entries-1, gs.clut.cov, gs.clut.cbw) >= (u32*)g_pbyGSMemory + 0x00100000 ) ERROR_LOG("texClutWrite out of bounds\n"); - else - for(int i = 0; i < entries; ++i) + else + for(int i = 0; i < entries; ++i) { *dst = src[getPixelAddress32_0(gs.clut.cou+i, gs.clut.cov, gs.clut.cbw)]; dst++; } } break; - + default: { #ifndef RELEASE_TO_PUBLIC @@ -4877,7 +4877,7 @@ if (tex0.csm) } } } - else + else { switch (tex0.cpsm) { @@ -4885,17 +4885,17 @@ if (tex0.csm) case PSMCT32: if( entries == 16 ) WriteCLUT_T32_I4_CSM1((u32*)(g_pbyGSMemory + tex0.cbp*256), (u32*)(g_pbyGSClut+64*tex0.csa)); - else + else WriteCLUT_T32_I8_CSM1((u32*)(g_pbyGSMemory + tex0.cbp*256), (u32*)(g_pbyGSClut+64*tex0.csa)); break; - + default: if( entries == 16 ) WriteCLUT_T16_I4_CSM1((u32*)(g_pbyGSMemory + 256 * tex0.cbp), (u32*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0))); else // sse2 for 256 is more complicated, so use regular WriteCLUT_T16_I8_CSM1_c((u32*)(g_pbyGSMemory + 256 * tex0.cbp), (u32*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0))); break; - + } } } @@ -4909,14 +4909,14 @@ void ZeroGS::SetTexFlush() // if( PSMT_ISCLUT(vb[1].tex0.psm) ) // texClutWrite(1); - if( !s_bForceTexFlush ) + if( !s_bForceTexFlush ) { - if( s_ptexCurSet[0] != s_ptexNextSet[0] ) + if( s_ptexCurSet[0] != s_ptexNextSet[0] ) { s_ptexCurSet[0] = s_ptexNextSet[0]; pd3dDevice->SetTexture(SAMP_MEMORY0, s_ptexNextSet[0]); } - if( s_ptexCurSet[1] != s_ptexNextSet[1] ) + if( s_ptexCurSet[1] != s_ptexNextSet[1] ) { s_ptexCurSet[1] = s_ptexNextSet[1]; pd3dDevice->SetTexture(SAMP_MEMORY1, s_ptexNextSet[1]); @@ -4931,10 +4931,10 @@ int ZeroGS::Save(char* pbydata) s_RTs.ResolveAll(); s_DepthRTs.ResolveAll(); - + vb[0].Unlock(); vb[1].Unlock(); - + strcpy(pbydata, libraryName); *(u32*)(pbydata+16) = ZEROGS_SAVEVER; pbydata += 32; @@ -4973,7 +4973,7 @@ bool ZeroGS::Load(char* pbydata) // first 32 bytes are the id u32 savever = *(u32*)(pbydata+16); - + if( strncmp(pbydata, libraryName, 6) == 0 && (savever == ZEROGS_SAVEVER || savever == 0xaa000004) ) { g_MemTargs.Destroy(); @@ -4983,7 +4983,7 @@ bool ZeroGS::Load(char* pbydata) int context = *(int*)pbydata; pbydata += 4; u32 savelimit = VBSAVELIMIT; - + savelimit = *(u32*)pbydata; pbydata += 4; memcpy(g_pbyGSMemory, pbydata, 0x00400000); @@ -5018,13 +5018,13 @@ bool ZeroGS::Load(char* pbydata) for(int i = 0; i < 2; ++i) { vb[i].bNeedZCheck = vb[i].bNeedFrameCheck = 1; - + vb[i].bSyncVars = 0; vb[i].bNeedTexCheck = 1; memset(vb[i].uCurTex0Data, 0, sizeof(vb[i].uCurTex0Data)); } icurctx = -1; - + pd3dDevice->SetRenderTarget(0, psurfOrgTarg); pd3dDevice->SetRenderTarget(1, NULL); pd3dDevice->SetDepthStencilSurface(psurfOrgDepth); @@ -5080,7 +5080,7 @@ void ZeroGS::CaptureFrame() vector mem; pd3dDevice->GetRenderTargetData(psurfOrgTarg, s_ptexAVICapture); - + D3DLOCKED_RECT lock; mem.resize(width * height * 4); diff --git a/plugins/zerogs/dx/zerogs.h b/plugins/zerogs/dx/zerogs.h index 1104b329c2..d6bab3d603 100644 --- a/plugins/zerogs/dx/zerogs.h +++ b/plugins/zerogs/dx/zerogs.h @@ -152,7 +152,7 @@ extern float g_fiGPU_TEXWIDTH; #define GAME_PARTIALPOINTERS 0x02000000 // whenver the texture or render target are small, tries to look for bigger ones to read from #define GAME_PARTIALDEPTH 0x04000000 // tries to save depth targets as much as possible across height changes #define GAME_RELAXEDDEPTH 0x08000000 // tries to save depth targets as much as possible across height changes - + #define USEALPHABLENDING 1//(!(g_GameSettings&GAME_NOALPHABLEND)) #define USEALPHATESTING (!(g_GameSettings&GAME_NOALPHATEST)) @@ -274,7 +274,7 @@ namespace ZeroGS int ref; }; - inline CMemoryTarget() : ptex(NULL), ptexsys(NULL), starty(0), height(0), realy(0), realheight(0), usedstamp(0), psm(0), + inline CMemoryTarget() : ptex(NULL), ptexsys(NULL), starty(0), height(0), realy(0), realheight(0), usedstamp(0), psm(0), cpsm(0), memory(NULL), clearminy(0), clearmaxy(0), validatecount(0) {} inline CMemoryTarget(const CMemoryTarget& r) { ptex = r.ptex; @@ -326,12 +326,12 @@ namespace ZeroGS int starty, height; // assert(starty >= realy) int realy, realheight; // this is never touched once allocated u32 usedstamp; - LPD3DTEX ptex; // can be 16bit if + LPD3DTEX ptex; // can be 16bit if LPD3DTEX ptexsys; D3DFORMAT fmt; int widthmult; - + int validatecount; // count how many times has been validated, if too many, destroy vector clut; // if nonzero, texture uses CLUT @@ -373,7 +373,7 @@ namespace ZeroGS LPD3DTEX ptexClamp[2]; // textures for x and y dir region clamping public: - + void FlushTexData(); u8 bNeedFrameCheck; @@ -403,7 +403,7 @@ namespace ZeroGS int zprimmask; // zmask for incoming points u32 uCurTex0Data[2]; // current tex0 data - u32 uNextTex0Data[2]; // tex0 data that has to be applied if bNeedTexCheck is 1 + u32 uNextTex0Data[2]; // tex0 data that has to be applied if bNeedTexCheck is 1 //int nFrameHeights[8]; // frame heights for the past frame changes int nNextFrameHeight; @@ -415,7 +415,7 @@ namespace ZeroGS }; // visible members - extern DrawFn drawfn[8]; + extern DrawFn drawfn[8]; extern VB vb[2]; extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height extern LONG width, height; @@ -490,7 +490,7 @@ namespace ZeroGS void FlushSysMem(const RECT* prc); void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, u32 fbm); - // returns the first and last addresses aligned to a page that cover + // returns the first and last addresses aligned to a page that cover void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw); // inits the smallest rectangle in ptexMem that covers this region in ptexMem diff --git a/plugins/zerogs/opengl/GLWinX11.cpp b/plugins/zerogs/opengl/GLWinX11.cpp index b1f1c27eb6..ded8437879 100644 --- a/plugins/zerogs/opengl/GLWinX11.cpp +++ b/plugins/zerogs/opengl/GLWinX11.cpp @@ -15,41 +15,41 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "GS.h" #include "zerogs.h" #ifdef GL_X11_WINDOW bool GLWindow::CreateWindow(void *pDisplay) -{ +{ glDisplay = XOpenDisplay(0); glScreen = DefaultScreen(glDisplay); if ( pDisplay == NULL ) return false; - + *(Display**)pDisplay = glDisplay; - + return true; } bool GLWindow::DestroyWindow() -{ +{ if (context) { if (!glXMakeCurrent(glDisplay, None, NULL)) { ERROR_LOG("Could not release drawing context.\n"); } - + glXDestroyContext(glDisplay, context); context = NULL; } - + /* switch back to original desktop resolution if we were in fullScreen */ - if ( glDisplay != NULL ) + if ( glDisplay != NULL ) { - if (fullScreen) + if (fullScreen) { XF86VidModeSwitchToMode(glDisplay, glScreen, &deskMode); XF86VidModeSetViewPort(glDisplay, glScreen, 0, 0); @@ -58,8 +58,8 @@ bool GLWindow::DestroyWindow() } void GLWindow::CloseWindow() -{ - if ( glDisplay != NULL ) +{ + if ( glDisplay != NULL ) { XCloseDisplay(glDisplay); glDisplay = NULL; @@ -76,26 +76,26 @@ void GLWindow::DisplayWindow(int _width, int _height) Atom wmDelete; Window winDummy; unsigned int borderDummy; - + // attributes for a single buffered visual in RGBA format with at least // 8 bits per color and a 24 bit depth buffer - int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, + int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, None}; - // attributes for a double buffered visual in RGBA format with at least + // attributes for a double buffered visual in RGBA format with at least // 8 bits per color and a 24 bit depth buffer - int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, + int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, None }; fullScreen = !!(conf.options & GSOPTION_FULLSCREEN); - + /* get an appropriate visual */ vi = glXChooseVisual(glDisplay, glScreen, attrListDbl); if (vi == NULL) { @@ -107,10 +107,10 @@ void GLWindow::DisplayWindow(int _width, int _height) doubleBuffered = true; ERROR_LOG("Got Doublebuffered Visual!\n"); } - if (vi == NULL) - { - ERROR_LOG("Failed to get buffered Visual!\n"); - return false; + if (vi == NULL) + { + ERROR_LOG("Failed to get buffered Visual!\n"); + return false; } glXQueryVersion(glDisplay, &glxMajorVersion, &glxMinorVersion); @@ -127,7 +127,7 @@ void GLWindow::DisplayWindow(int _width, int _height) XF86VidModeQueryVersion(glDisplay, &vidModeMajorVersion, &vidModeMinorVersion); if (fullScreen) { - + XF86VidModeModeInfo **modes = NULL; int modeNum = 0; int bestMode = 0; @@ -136,7 +136,7 @@ void GLWindow::DisplayWindow(int _width, int _height) bestMode = 0; ERROR_LOG("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion); XF86VidModeGetAllModeLines(glDisplay, glScreen, &modeNum, &modes); - + if( modeNum > 0 && modes != NULL ) { /* save desktop-resolution before switching modes */ GLWin.deskMode = *modes[0]; @@ -145,7 +145,7 @@ void GLWindow::DisplayWindow(int _width, int _height) if ((modes[i]->hdisplay == _width) && (modes[i]->vdisplay == _height)) { bestMode = i; } - } + } XF86VidModeSwitchToMode(glDisplay, glScreen, modes[bestMode]); XF86VidModeSetViewPort(glDisplay, glScreen, 0, 0); @@ -153,7 +153,7 @@ void GLWindow::DisplayWindow(int _width, int _height) GLDisplayHeight = modes[bestMode]->vdisplay; ERROR_LOG("Resolution %dx%d\n", GLDisplayWidth, GLDisplayHeight); XFree(modes); - + /* create a fullscreen window */ attr.override_redirect = True; attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | @@ -177,8 +177,8 @@ void GLWindow::DisplayWindow(int _width, int _height) fullScreen = 0; } } - - + + if( !fullScreen ) { //XRootWindow(glDisplay,glScreen) @@ -197,20 +197,20 @@ void GLWindow::DisplayWindow(int _width, int _height) XSetStandardProperties(glDisplay, glWindow, "ZeroGS", "ZeroGS", None, NULL, 0, NULL); XMapRaised(glDisplay, glWindow); - } + } // connect the glx-context to the window glXMakeCurrent(glDisplay, glWindow, context); XGetGeometry(glDisplay, glWindow, &winDummy, &x, &y, &width, &height, &borderDummy, &depth); ERROR_LOG("Depth %d\n", depth); - if (glXIsDirect(glDisplay, context)) + if (glXIsDirect(glDisplay, context)) ERROR_LOG("you have Direct Rendering!\n"); else ERROR_LOG("no Direct Rendering possible!\n"); // better for pad plugin key input (thc) - XSelectInput(glDisplay, glWindow, ExposureMask | KeyPressMask | KeyReleaseMask | + XSelectInput(glDisplay, glWindow, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask ); } @@ -219,7 +219,7 @@ void GLWindow::SwapBuffers() { glXSwapBuffers(glDisplay, glWindow); } - + void GLWindow::SetTitle(char *strtitle) { XTextProperty prop; @@ -233,8 +233,8 @@ void GLWindow::SetTitle(char *strtitle) void GLWindow::ResizeCheck() { XEvent event; - - while(XCheckTypedEvent(glDisplay, ConfigureNotify, &event)) + + while(XCheckTypedEvent(glDisplay, ConfigureNotify, &event)) { if ((event.xconfigure.width != width) || (event.xconfigure.height != height)) { ZeroGS::ChangeWindowSize(event.xconfigure.width, event.xconfigure.height); diff --git a/plugins/zerogs/opengl/GS.h b/plugins/zerogs/opengl/GS.h index b126253cd1..c424b51008 100644 --- a/plugins/zerogs/opengl/GS.h +++ b/plugins/zerogs/opengl/GS.h @@ -136,8 +136,8 @@ class GLWindow #endif bool fullScreen, doubleBuffered; s32 x, y; - u32 width, height, depth; - + u32 width, height, depth; + public: void SwapBuffers(); void SetTitle(char *strtitle); @@ -458,7 +458,7 @@ typedef struct { u32 options; u32 gamesettings; // default game settings int width, height; - int winstyle; // window style before full screen + int winstyle; // window style before full screen #ifdef GS_LOG u32 log; #endif @@ -534,7 +534,7 @@ typedef struct { typedef struct { u16 prim; - + union { struct { u16 iip : 1; @@ -668,12 +668,12 @@ typedef struct { tagInfo tag; } pathInfo; -typedef struct { +typedef struct { Vertex gsvertex[3]; u32 rgba; float q; Vertex vertexregs; - + int primC; // number of verts current storing int primIndex; // current prim index int nTriFanVert; @@ -695,13 +695,13 @@ typedef struct { bufInfo dstbuf, dstbufnew; clutInfo clut; - + texaInfo texa; trxposInfo trxpos, trxposnew; int imageWtemp, imageHtemp; - int imageTransfer; + int imageTransfer; int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY; pathInfo path1; @@ -743,7 +743,7 @@ public: inline T* operator->() { return ptr; } inline T* get() { return ptr; } - inline void release() { + inline void release() { if( ptr != NULL ) { ptr->Release(); ptr = NULL; } } diff --git a/plugins/zerogs/opengl/GSmain.cpp b/plugins/zerogs/opengl/GSmain.cpp index f419887cf4..eb9b6ccf21 100644 --- a/plugins/zerogs/opengl/GSmain.cpp +++ b/plugins/zerogs/opengl/GSmain.cpp @@ -123,7 +123,7 @@ void SysMessage(char *fmt, ...) { #else GLWindow GLWin; -u32 THR_KeyEvent = 0; // Value for key event processing between threads +u32 THR_KeyEvent = 0; // Value for key event processing between threads bool THR_bShift = false; #endif @@ -202,7 +202,7 @@ void CALLBACK GSsetFrameSkip(int frameskip) { s_frameskipping |= frameskip; if( frameskip && g_nFrameRender > 1 ) { - + for(int i = 0; i < 16; ++i) { g_GIFPackedRegHandlers[i] = GIFPackedRegHandlerNOP; } @@ -250,7 +250,7 @@ void CALLBACK GSreset() { memset(&gs, 0, sizeof(gs)); ZeroGS::GSStateReset(); - + gs.prac = 1; prim = &gs._prim[0]; gs.nTriFanVert = -1; @@ -316,7 +316,7 @@ void OnKeyboardF5(int shift) if( conf.interlace < 2 ) sprintf(strtitle, "interlace on - mode %d", conf.interlace); else sprintf(strtitle, "interlace off"); } - + ZeroGS::AddMessage(strtitle); SaveConfig(); } @@ -326,7 +326,7 @@ void OnKeyboardF6(int shift) char strtitle[256]; if( shift ) { conf.aa--; // -1 - if( conf.aa > 4 ) conf.aa = 4; // u8 in unsigned, so negative value is 255. + if( conf.aa > 4 ) conf.aa = 4; // u8 in unsigned, so negative value is 255. sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]); ZeroGS::SetAA(conf.aa); } @@ -336,7 +336,7 @@ void OnKeyboardF6(int shift) sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]); ZeroGS::SetAA(conf.aa); } - + ZeroGS::AddMessage(strtitle); SaveConfig(); } @@ -422,7 +422,7 @@ extern HINSTANCE hInst; void CALLBACK GSconfigure() { DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)ConfigureDlgProc); if( g_nPixelShaderVer == SHADER_REDUCED ) @@ -444,12 +444,12 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) { LoadConfig(); strcpy(GStitle, Title); - + RECT rc, rcdesktop; rc.left = 0; rc.top = 0; rc.right = conf.width; rc.bottom = conf.height; - WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, + WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, "PS2EMU_ZEROGS", NULL }; RegisterClassEx( &wc ); @@ -513,7 +513,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) { void ProcessMessages() { - MSG msg; + MSG msg; ZeroMemory( &msg, sizeof(msg) ); while( 1 ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) @@ -535,7 +535,7 @@ void ProcessMessages() else if( msg.wParam == VK_ESCAPE ) { if( conf.options & GSOPTION_FULLSCREEN ) { - // destroy that msg + // destroy that msg conf.options &= ~GSOPTION_FULLSCREEN; conf.winstyle = GetWindowLong( GShwnd, GWL_STYLE ); conf.winstyle &= ~WS_MAXIMIZE & ~WS_MINIMIZE; // remove minimize/maximize style @@ -549,7 +549,7 @@ void ProcessMessages() return; } } - + break; } @@ -592,9 +592,9 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) LoadConfig(); strcpy(GStitle, Title); - + GLWin.CreateWindow(pDsp); - + ERROR_LOG("creating zerogs\n"); //if (conf.record) recOpen(); if( !ZeroGS::Create(conf.width, conf.height) ) @@ -642,12 +642,12 @@ void ProcessMessages() break; case XK_F7: OnKeyboardF7(my_bShift); - break; + break; case XK_F9: OnKeyboardF9(my_bShift); - break; + break; } - } + } } #endif // linux @@ -684,9 +684,9 @@ void CALLBACK GSchangeSaveState(int newstate, const char* filename) void CALLBACK GSmakeSnapshot(char *path) { FILE *bmpfile; - char filename[256]; + char filename[256]; u32 snapshotnr = 0; - + // increment snapshot value & try to get filename for (;;) { snapshotnr++; @@ -701,7 +701,7 @@ void CALLBACK GSmakeSnapshot(char *path) // try opening new snapshot file if((bmpfile=fopen(filename,"wb"))==NULL) { char strdir[255]; - + #ifdef _WIN32 sprintf(strdir, "%s", path); CreateDirectory(strdir, NULL); @@ -734,11 +734,11 @@ void CALLBACK GSvsync(int interlace) char strtitle[256]; GL_REPORT_ERRORD(); - + g_nRealFrame++; ZeroGS::RenderCRTC(!interlace); - + ProcessMessages(); if( --nToNextUpdate <= 0 ) { @@ -757,7 +757,7 @@ void CALLBACK GSvsync(int interlace) conf.aa ? s_aa[conf.aa] : "", g_pShaders[g_nPixelShaderVer], (ppf&0xfffff)/(float)UPDATE_FRAMES); #else - sprintf(strtitle, "%d | %.1f fps (sk:%d%%) | g: %.1f, t: %.1f, a: %.1f, r: %.1f | p: %.1f | tex: %d %d (%d kbpf)", g_nFrame, fFPS, + sprintf(strtitle, "%d | %.1f fps (sk:%d%%) | g: %.1f, t: %.1f, a: %.1f, r: %.1f | p: %.1f | tex: %d %d (%d kbpf)", g_nFrame, fFPS, 100*g_nFramesSkipped/g_nFrame, g_nGenVars/(float)UPDATE_FRAMES, g_nTexVars/(float)UPDATE_FRAMES, g_nAlphaVars/(float)UPDATE_FRAMES, g_nResolve/(float)UPDATE_FRAMES, (ppf&0xfffff)/(float)UPDATE_FRAMES, @@ -775,7 +775,7 @@ void CALLBACK GSvsync(int interlace) if( !(conf.options&GSOPTION_FULLSCREEN) ) SetWindowText(GShwnd, strtitle); #else // linux - if (!(conf.options & GSOPTION_FULLSCREEN)) + if (!(conf.options & GSOPTION_FULLSCREEN)) GLWin.SetTitle(strtitle); #endif @@ -838,7 +838,7 @@ int CALLBACK GSsetupRecording(int start, void* pData) return 1; } -s32 CALLBACK GSfreeze(int mode, freezeData *data) +s32 CALLBACK GSfreeze(int mode, freezeData *data) { switch (mode) { @@ -855,7 +855,7 @@ s32 CALLBACK GSfreeze(int mode, freezeData *data) default: break; } - + return 0; } @@ -888,7 +888,7 @@ struct DVPROFSTRUCT { DATA(u64 time, u32 user = 0) : dwTime(time), dwUserData(user) {} DATA() : dwTime(0), dwUserData(0) {} - + u64 dwTime; u32 dwUserData; }; @@ -903,7 +903,7 @@ struct DVPROFSTRUCT list listTimes; // before DVProfEnd is called, contains the global time it started // after DVProfEnd is called, contains the time it lasted - // the list contains all the tracked times + // the list contains all the tracked times char pname[256]; list listpChild; // other profilers called during this profiler period @@ -930,7 +930,7 @@ void DVProfRegister(char* pname) return; list::iterator it = g_listAllProfilers.begin(); - + // while(it != g_listAllProfilers.end() ) { // // if( _tcscmp(pname, (*it)->pname) == 0 ) { @@ -947,7 +947,7 @@ void DVProfRegister(char* pname) // else add in a new profiler to the appropriate parent profiler DVPROFSTRUCT* pprof = NULL; - + if( g_listCurTracking.size() > 0 ) { assert( g_listCurTracking.back().pprof != NULL ); g_listCurTracking.back().pprof->listpChild.push_back(new DVPROFSTRUCT()); @@ -1008,8 +1008,8 @@ u64 DVProfWriteStruct(FILE* f, DVPROFSTRUCT* p, int ident) while(ittime != p->listTimes.end() ) { utime += (u32)ittime->dwTime; - - if( ittime->dwUserData ) + + if( ittime->dwUserData ) fprintf(f, "time: %d, user: 0x%8.8x", (u32)ittime->dwTime, ittime->dwUserData); else fprintf(f, "time: %d", (u32)ittime->dwTime); diff --git a/plugins/zerogs/opengl/GifTransfer.cpp b/plugins/zerogs/opengl/GifTransfer.cpp index bfed0dac67..83e207ff2b 100644 --- a/plugins/zerogs/opengl/GifTransfer.cpp +++ b/plugins/zerogs/opengl/GifTransfer.cpp @@ -15,18 +15,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "GifTransfer.h" - + void GIFtag(pathInfo *path, u32 *data) { - + path->tag.nloop = data[0] & 0x7fff; path->tag.eop = (data[0] >> 15) & 0x1; u32 tagpre = (data[1] >> 14) & 0x1; u32 tagprim = (data[1] >> 15) & 0x7ff; u32 tagflg = (data[1] >> 26) & 0x3; path->tag.nreg = (data[1] >> 28)<<2; - + if (path->tag.nreg == 0) path->tag.nreg = 64; gs.q = 1; @@ -108,7 +108,7 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) while(size > 0) { //LOG(_T("Transfer(%08x, %d) START\n"), pMem, size); - if (path->tag.nloop == 0) + if (path->tag.nloop == 0) { GIFtag(path, pMem); pMem+= 4; @@ -117,13 +117,13 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) if ((g_GameSettings & GAME_PATH3HACK) && path == &gs.path3 && gs.path3.tag.eop) nPath3Hack = 1; - if (path == &gs.path1) + if (path == &gs.path1) { // if too much data, just ignore - if (path->tag.nloop * (path->tag.nreg / 4) > (int)size * (path->mode==2?2:1)) + if (path->tag.nloop * (path->tag.nreg / 4) > (int)size * (path->mode==2?2:1)) { static int lasttime = 0; - if( timeGetTime() - lasttime > 5000 ) + if( timeGetTime() - lasttime > 5000 ) { ERROR_LOG("VU1 too much data, ignore if gfx are fine\n"); lasttime = timeGetTime(); @@ -132,15 +132,15 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) return; } - if (path->mode == 1) + if (path->mode == 1) { // check if 0xb is in any reg, if yes, exit (kh2) for(int i = 0; i < path->tag.nreg; i += 4) { - if (((path->regs >> i)&0xf) == 11) + if (((path->regs >> i)&0xf) == 11) { static int lasttime = 0; - if( timeGetTime() - lasttime > 5000 ) + if( timeGetTime() - lasttime > 5000 ) { ERROR_LOG("Invalid unpack type\n"); lasttime = timeGetTime(); @@ -152,12 +152,12 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) } } - if(path->tag.nloop == 0 ) + if(path->tag.nloop == 0 ) { - if( path == &gs.path1 ) + if( path == &gs.path1 ) { // ffx hack - /*if( g_GameSettings & GAME_FFXHACK ) + /*if( g_GameSettings & GAME_FFXHACK ) {*/ if( path->tag.eop ) return; @@ -167,7 +167,7 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) return; } - if( !path->tag.eop ) + if( !path->tag.eop ) { //DEBUG_LOG("continuing from eop\n"); continue; @@ -184,14 +184,14 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) for(; size > 0; size--, pMem += 4) { int reg = (int)((path->regs >> path->regn) & 0xf); - + g_GIFPackedRegHandlers[reg](pMem); path->regn += 4; - if (path->tag.nreg == path->regn) + if (path->tag.nreg == path->regn) { path->regn = 0; - if( path->tag.nloop-- <= 1 ) + if( path->tag.nloop-- <= 1 ) { size--; pMem += 4; @@ -211,10 +211,10 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) int reg = (int)((path->regs >> path->regn) & 0xf); g_GIFRegHandlers[reg](pMem); path->regn += 4; - if (path->tag.nreg == path->regn) + if (path->tag.nreg == path->regn) { path->regn = 0; - if( path->tag.nloop-- <= 1 ) + if( path->tag.nloop-- <= 1 ) { size--; pMem += 2; @@ -234,11 +234,11 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) { int process = min((int)size, path->tag.nloop); - if( process > 0 ) + if( process > 0 ) { - if ( gs.imageTransfer ) + if ( gs.imageTransfer ) ZeroGS::TransferLocalHost(pMem, process); - else + else ZeroGS::TransferHostLocal(pMem, process*4); path->tag.nloop -= process; @@ -248,7 +248,7 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) } break; } - else + else { // simulate int process = min((int)size, path->tag.nloop); @@ -273,7 +273,7 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) void CALLBACK GSgifTransfer2(u32 *pMem, u32 size) { //GS_LOG("GSgifTransfer2 size = %lx (mode %d, gs.path2.tag.nloop = %d)\n", size, gs.path2.mode, gs.path2.tag.nloop); - + _GSgifTransfer(&gs.path2, pMem, size); } @@ -289,9 +289,9 @@ static int count = 0; void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr) { pathInfo *path = &gs.path1; - + //GS_LOG("GSgifTransfer1 0x%x (mode %d)\n", addr, path->mode); - + addr &= 0x3fff; #ifdef _DEBUG diff --git a/plugins/zerogs/opengl/GifTransfer.h b/plugins/zerogs/opengl/GifTransfer.h index 28b43a79d0..f8a30cd12f 100644 --- a/plugins/zerogs/opengl/GifTransfer.h +++ b/plugins/zerogs/opengl/GifTransfer.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - + + #include "GS.h" #include "Mem.h" #include "Regs.h" @@ -26,6 +26,6 @@ void GIFtag(pathInfo *path, u32 *data); void _GSgifPacket(pathInfo *path, u32 *pMem); void _GSgifRegList(pathInfo *path, u32 *pMem); void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size); - + extern GIFRegHandler g_GIFPackedRegHandlers[]; -extern GIFRegHandler g_GIFRegHandlers[]; \ No newline at end of file +extern GIFRegHandler g_GIFRegHandlers[]; diff --git a/plugins/zerogs/opengl/Linux/Conf.cpp b/plugins/zerogs/opengl/Linux/Conf.cpp index fec278b35a..769cf01239 100644 --- a/plugins/zerogs/opengl/Linux/Conf.cpp +++ b/plugins/zerogs/opengl/Linux/Conf.cpp @@ -24,17 +24,17 @@ #include #include "GS.h" -void SaveConfig() +void SaveConfig() { const std::string iniFile( s_strIniPath + "zerogs.ini" ); FILE* f = fopen(iniFile.c_str(),"w"); - if (f == NULL) + if (f == NULL) { printf("failed to open %s\n", iniFile.c_str()); return; } - + fprintf(f, "interlace = %hhx\n", conf.interlace); fprintf(f, "mrtdepth = %hhx\n", conf.mrtdepth); fprintf(f, "options = %x\n", conf.options); //u32 @@ -44,7 +44,7 @@ void SaveConfig() fclose(f); } -void LoadConfig() +void LoadConfig() { char cfg[255]; @@ -59,7 +59,7 @@ void LoadConfig() const std::string iniFile( s_strIniPath + "zerogs.ini" ); FILE* f = fopen(iniFile.c_str(), "r"); - if (f == NULL) + if (f == NULL) { printf("failed to open %s\n", iniFile.c_str()); SaveConfig();//save and return @@ -76,7 +76,7 @@ void LoadConfig() // filter bad files if ((conf.aa < 0) || (conf.aa > 4)) conf.aa = 0; - switch(conf.options & GSOPTION_WINDIMS) + switch(conf.options & GSOPTION_WINDIMS) { case GSOPTION_WIN640: conf.width = 640; @@ -100,7 +100,7 @@ void LoadConfig() conf.options &= ~(GSOPTION_FULLSCREEN | GSOPTION_WIREFRAME | GSOPTION_CAPTUREAVI); conf.options |= GSOPTION_LOADED; - if( conf.width <= 0 || conf.height <= 0 ) + if( conf.width <= 0 || conf.height <= 0 ) { conf.width = 640; conf.height = 480; diff --git a/plugins/zerogs/opengl/Linux/Linux.cpp b/plugins/zerogs/opengl/Linux/Linux.cpp index 0443facd3c..4cfdb9ef1f 100644 --- a/plugins/zerogs/opengl/Linux/Linux.cpp +++ b/plugins/zerogs/opengl/Linux/Linux.cpp @@ -57,7 +57,7 @@ void CALLBACK GSkeyEvent(keyEvent *ev) { //static bool bShift = false; static bool bAlt = false; - + switch(ev->evt) { case KEYPRESS: switch(ev->key) { @@ -129,10 +129,10 @@ void OnConf_Ok(GtkButton *button, gpointer user_data) conf.options |= is_checked(Conf, "checkWireframe") ? GSOPTION_WIREFRAME : 0; conf.options |= is_checked(Conf, "checkfullscreen") ? GSOPTION_FULLSCREEN : 0; conf.options |= is_checked(Conf, "checkTGA") ? GSOPTION_TGASNAP : 0; - + if is_checked(Conf, "radiointerlace0") conf.interlace = 0; - else if is_checked(Conf, "radiointerlace1") + else if is_checked(Conf, "radiointerlace1") conf.interlace = 1; else conf.interlace = 2; @@ -143,16 +143,16 @@ void OnConf_Ok(GtkButton *button, gpointer user_data) gtk_tree_model_get_iter_first(treemodel, &treeiter); conf.gamesettings = 0; - for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) + for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) { treeoptval = FALSE; gtk_tree_model_get(treemodel, &treeiter, 0, &treeoptval, -1); - + if(treeoptval) conf.gamesettings |= it->second.value; - - gtk_tree_model_iter_next(treemodel,&treeiter); + + gtk_tree_model_iter_next(treemodel,&treeiter); } - + GSsetGameCRC(0, conf.gamesettings); //---------- done getting advanced options ---------// @@ -171,7 +171,7 @@ void OnConf_Ok(GtkButton *button, gpointer user_data) gtk_main_quit(); } -void OnConf_Cancel(GtkButton *button, gpointer user_data) +void OnConf_Cancel(GtkButton *button, gpointer user_data) { gtk_widget_destroy(Conf); gtk_main_quit(); @@ -191,10 +191,10 @@ void CALLBACK GSconfigure() char strcurdir[256]; getcwd(strcurdir, 256); - + if (!(conf.options & GSOPTION_LOADED)) LoadConfig(); Conf = create_Config(); - + // fixme; Need to check "checkInterlace" as well. if (conf.interlace == 0) set_checked(Conf, "radiointerlace0", true); @@ -202,7 +202,7 @@ void CALLBACK GSconfigure() set_checked(Conf, "radiointerlace1", true); else set_checked(Conf, "radionointerlace", true); - + set_checked(Conf, "checkBilinear", !!conf.bilinear); //set_checked(Conf, "checkbutton6", conf.mrtdepth); set_checked(Conf, "radioAANone", (conf.aa==0)); @@ -236,7 +236,7 @@ void CALLBACK GSconfigure() gtk_tree_view_column_add_attribute(treecol, treerend, "active", 0);//link 'active' attrib to first column of model g_object_set(treerend, "activatable", TRUE, NULL);//set 'activatable' attrib true by default for all rows regardless of model. g_signal_connect(treerend, "toggled", (GCallback) OnToggle_advopts, treestore);//set a global callback, we also pass a reference to our treestore. - + //COLUMN 1 is the text descriptions treecol = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(treecol, "Description"); @@ -310,7 +310,7 @@ void CALLBACK GSconfigure() confOpts.value = 0x00200000; confOpts.desc = "32 bit render targets - 00200000"; mapConfOpts["00200000"] = confOpts; - + confOpts.value = 0x00400000; confOpts.desc = "Path 3 Hack - 00400000"; mapConfOpts["00400000"] = confOpts; @@ -321,7 +321,7 @@ void CALLBACK GSconfigure() confOpts.desc = "Specular Highlights - 01000000\nMakes xenosaga graphics faster by removing highlights"; mapConfOpts["01000000"] = confOpts; - for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) + for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) { gtk_list_store_append(treestore, &treeiter);//new row itval = (conf.gamesettings&it->second.value)?TRUE:FALSE; @@ -331,7 +331,7 @@ void CALLBACK GSconfigure() gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(treestore));//NB: store is cast as tree model. g_object_unref(treestore);//allow model to be destroyed when the tree is destroyed. - + //don't select/highlight rows gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), GTK_SELECTION_NONE); //------treeview done -------// @@ -350,16 +350,16 @@ void OnToggle_advopts(GtkCellRendererToggle *cell, gchar *path, gpointer user_da gtk_tree_model_get(GTK_TREE_MODEL(user_data), &treeiter, 0, &val, -1); val = !val; gtk_list_store_set(GTK_LIST_STORE(user_data), &treeiter, 0, val, -1); - + } -void OnAbout_Ok(GtkButton *button, gpointer user_data) +void OnAbout_Ok(GtkButton *button, gpointer user_data) { gtk_widget_destroy(About); gtk_main_quit(); } -void CALLBACK GSabout() +void CALLBACK GSabout() { About = create_About(); @@ -367,20 +367,20 @@ void CALLBACK GSabout() gtk_main(); } -s32 CALLBACK GStest() +s32 CALLBACK GStest() { return 0; } GtkWidget *MsgDlg; -void OnMsg_Ok() +void OnMsg_Ok() { gtk_widget_destroy(MsgDlg); gtk_main_quit(); } -void SysMessage(char *fmt, ...) +void SysMessage(char *fmt, ...) { GtkWidget *Ok,*Txt; GtkWidget *Box,*Box1; @@ -403,7 +403,7 @@ void SysMessage(char *fmt, ...) gtk_widget_show(Box); Txt = gtk_label_new(msg); - + gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5); gtk_widget_show(Txt); @@ -417,29 +417,29 @@ void SysMessage(char *fmt, ...) GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT); gtk_widget_show(Ok); - gtk_widget_show(MsgDlg); + gtk_widget_show(MsgDlg); gtk_main(); } -void *SysLoadLibrary(char *lib) +void *SysLoadLibrary(char *lib) { return dlopen(lib, RTLD_NOW | RTLD_GLOBAL); } -void *SysLoadSym(void *lib, char *sym) +void *SysLoadSym(void *lib, char *sym) { void *ret = dlsym(lib, sym); if (ret == NULL) printf("null: %s\n", sym); return dlsym(lib, sym); } -char *SysLibError() +char *SysLibError() { return dlerror(); } -void SysCloseLibrary(void *lib) +void SysCloseLibrary(void *lib) { dlclose(lib); } diff --git a/plugins/zerogs/opengl/Linux/Linux.h b/plugins/zerogs/opengl/Linux/Linux.h index cfead3b7ee..fc104937e6 100644 --- a/plugins/zerogs/opengl/Linux/Linux.h +++ b/plugins/zerogs/opengl/Linux/Linux.h @@ -22,5 +22,5 @@ void OnToggle_advopts(GtkCellRendererToggle *cell, gchar *path, gpointer user_data); -#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) +#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) #define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state) diff --git a/plugins/zerogs/opengl/Mem.cpp b/plugins/zerogs/opengl/Mem.cpp index 8b63efb1bf..4088ee0ec3 100644 --- a/plugins/zerogs/opengl/Mem.cpp +++ b/plugins/zerogs/opengl/Mem.cpp @@ -110,9 +110,9 @@ u32 g_columnTable32[8][8] = { }; u32 g_columnTable16[8][16] = { - { 0, 2, 8, 10, 16, 18, 24, 26, + { 0, 2, 8, 10, 16, 18, 24, 26, 1, 3, 9, 11, 17, 19, 25, 27 }, - { 4, 6, 12, 14, 20, 22, 28, 30, + { 4, 6, 12, 14, 20, 22, 28, 30, 5, 7, 13, 15, 21, 23, 29, 31 }, { 32, 34, 40, 42, 48, 50, 56, 58, 33, 35, 41, 43, 49, 51, 57, 59 }, @@ -139,7 +139,7 @@ u32 g_columnTable8[16][16] = { 43, 47, 59, 63, 11, 15, 27, 31 }, { 96, 100, 112, 116, 64, 68, 80, 84, // column 1 98, 102, 114, 118, 66, 70, 82, 86 }, - { 104, 108, 120, 124, 72, 76, 88, 92, + { 104, 108, 120, 124, 72, 76, 88, 92, 106, 110, 122, 126, 74, 78, 90, 94 }, { 65, 69, 81, 85, 97, 101, 113, 117, 67, 71, 83, 87, 99, 103, 115, 119 }, @@ -174,7 +174,7 @@ u32 g_columnTable4[16][32] = { 22, 30, 54, 62, 86, 94, 118, 126 }, { 65, 73, 97, 105, 1, 9, 33, 41, 67, 75, 99, 107, 3, 11, 35, 43, - 69, 77, 101, 109, 5, 13, 37, 45, + 69, 77, 101, 109, 5, 13, 37, 45, 71, 79, 103, 111, 7, 15, 39, 47 }, { 81, 89, 113, 121, 17, 25, 49, 57, 83, 91, 115, 123, 19, 27, 51, 59, @@ -190,7 +190,7 @@ u32 g_columnTable4[16][32] = { 214, 222, 246, 254, 150, 158, 182, 190 }, { 129, 137, 161, 169, 193, 201, 225, 233, 131, 139, 163, 171, 195, 203, 227, 235, - 133, 141, 165, 173, 197, 205, 229, 237, + 133, 141, 165, 173, 197, 205, 229, 237, 135, 143, 167, 175, 199, 207, 231, 239 }, { 145, 153, 177, 185, 209, 217, 241, 249, 147, 155, 179, 187, 211, 219, 243, 251, @@ -206,7 +206,7 @@ u32 g_columnTable4[16][32] = { 278, 286, 310, 318, 342, 350, 374, 382 }, { 321, 329, 353, 361, 257, 265, 289, 297, 323, 331, 355, 363, 259, 267, 291, 299, - 325, 333, 357, 365, 261, 269, 293, 301, + 325, 333, 357, 365, 261, 269, 293, 301, 327, 335, 359, 367, 263, 271, 295, 303 }, { 337, 345, 369, 377, 273, 281, 305, 313, 339, 347, 371, 379, 275, 283, 307, 315, @@ -222,7 +222,7 @@ u32 g_columnTable4[16][32] = { 470, 478, 502, 510, 406, 414, 438, 446 }, { 385, 393, 417, 425, 449, 457, 481, 489, 387, 395, 419, 427, 451, 459, 483, 491, - 389, 397, 421, 429, 453, 461, 485, 493, + 389, 397, 421, 429, 453, 461, 485, 493, 391, 399, 423, 431, 455, 463, 487, 495 }, { 401, 409, 433, 441, 465, 473, 497, 505, 403, 411, 435, 443, 467, 475, 499, 507, @@ -624,16 +624,16 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); //void TransferHostLocal4(const void* pbyMem, u32 nQWordSize) //{ // START_HOSTLOCAL(); -// +// // const T* pbuf = (const T*)pbyMem; // u32 nSize = nQWordSize*16*2/TRANSMIT_PITCH_4(2, T); // nSize = min(nSize, gs.imageWnew * gs.imageHnew); -// +// // int endY = ROUND_UPPOW2(i, blockheight); // int alignedY = ROUND_DOWNPOW2(gs.imageEndY, blockheight); // int alignedX = ROUND_DOWNPOW2(gs.imageEndX, blockwidth); // bool bCanAlign = MOD_POW2(gs.trxpos.dx, blockwidth) == 0 && (j == gs.trxpos.dx) && (alignedY > endY) && alignedX > gs.trxpos.dx; -// +// // if( (gs.imageEndX-gs.trxpos.dx)%widthlimit ) { // /* hack */ // if( abs((int)nSize - (gs.imageEndY-i)*(gs.imageEndX-gs.trxpos.dx)+(j-gs.trxpos.dx)) <= widthlimit ) { @@ -643,15 +643,15 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); // } // bCanAlign = false; // } -// +// // /* first align on block boundary */ // if( MOD_POW2(i, blockheight) || !bCanAlign ) { -// +// // if( !bCanAlign ) // endY = gs.imageEndY; /* transfer the whole image */ // else // assert( endY < gs.imageEndY); /* part of alignment condition */ -// +// // if( (DSTPSM == 0x13 || DSTPSM == 0x14) && ((gs.imageEndX-gs.trxpos.dx)%widthlimit) ) { // /* transmit with a width of 1 */ // TRANSMIT_HOSTLOCAL_Y_4(4, T, (1+(DSTPSM == 0x14)), endY); @@ -659,24 +659,24 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); // else { // TRANSMIT_HOSTLOCAL_Y_4(4, T, widthlimit, endY); // } -// +// // if( nSize == 0 || i == gs.imageEndY ) // goto End; // } -// +// // assert( MOD_POW2(i, blockheight) == 0 && j == gs.trxpos.dx); -// +// // /* can align! */ // int pitch = gs.imageEndX-gs.trxpos.dx; // u32 area = pitch*blockheight; // int fracX = gs.imageEndX-alignedX; -// +// // /* on top of checking whether pbuf is alinged, make sure that the width is at least aligned to its limits (due to bugs in pcsx2) */ // bool bAligned = !((u32)pbuf & 0xf) && (TRANSMIT_PITCH_4(pitch, T)&0xf) == 0; -// +// // /* transfer aligning to blocks */ // for(; i < alignedY && nSize >= area; i += blockheight, nSize -= area) { -// +// // if( bAligned || ((DSTPSM==PSMCT24) || (DSTPSM==PSMT8H) || (DSTPSM==PSMT4HH) || (DSTPSM==PSMT4HL)) ) { // for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH_4(blockwidth, T)/sizeof(T)) { // SwizzleBlock4(pstart + getPixelAddress4_0(tempj, i, gs.dstbuf.bw)*blockbits/8, @@ -689,7 +689,7 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); // (u8*)pbuf, TRANSMIT_PITCH_4(pitch, T)); // } // } -// +// // /* transfer the rest */ // if( alignedX < gs.imageEndX ) { // TRANSMIT_HOSTLOCAL_X_4(4, T, widthlimit, blockheight, alignedX); @@ -698,13 +698,13 @@ DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); // else pbuf += (blockheight-1)*TRANSMIT_PITCH_4(pitch, T)/sizeof(T); // j = 0; // } -// +// // if( TRANSMIT_PITCH_4(nSize, T)/4 > 0 ) { // TRANSMIT_HOSTLOCAL_Y_4(4, T, widthlimit, gs.imageEndY); // /* sometimes wrong sizes are sent (tekken tag) */ // assert( gs.imageTransfer == -1 || TRANSMIT_PITCH_4(nSize,T)/4 <= 2 ); // } -// +// // END_HOSTLOCAL(); //} diff --git a/plugins/zerogs/opengl/Regs.cpp b/plugins/zerogs/opengl/Regs.cpp index cf923dbf68..08c50cd1c3 100644 --- a/plugins/zerogs/opengl/Regs.cpp +++ b/plugins/zerogs/opengl/Regs.cpp @@ -80,7 +80,7 @@ void __fastcall GIFPackedRegHandlerNull(u32* data) void __fastcall GIFPackedRegHandlerRGBA(u32* data) { - gs.rgba = (data[0] & 0xff) | + gs.rgba = (data[0] & 0xff) | ((data[1] & 0xff) << 8) | ((data[2] & 0xff) << 16) | ((data[3] & 0xff) << 24); @@ -98,32 +98,32 @@ void __fastcall GIFPackedRegHandlerSTQ(u32* data) void __fastcall GIFPackedRegHandlerUV(u32* data) { gs.vertexregs.u = data[0] & 0x3fff; - gs.vertexregs.v = data[1] & 0x3fff; + gs.vertexregs.v = data[1] & 0x3fff; } -void __forceinline KICK_VERTEX2() -{ - if (++gs.primC >= (int)g_primmult[prim->prim]) - { - if (!(g_GameSettings&GAME_XENOSPECHACK) || !ZeroGS::vb[prim->ctxt].zbuf.zmsk) - (*ZeroGS::drawfn[prim->prim])(); - gs.primC -= g_primsub[prim->prim]; - } -} +void __forceinline KICK_VERTEX2() +{ + if (++gs.primC >= (int)g_primmult[prim->prim]) + { + if (!(g_GameSettings&GAME_XENOSPECHACK) || !ZeroGS::vb[prim->ctxt].zbuf.zmsk) + (*ZeroGS::drawfn[prim->prim])(); + gs.primC -= g_primsub[prim->prim]; + } +} -void __forceinline KICK_VERTEX3() -{ - if (++gs.primC >= (int)g_primmult[prim->prim]) - { - gs.primC -= g_primsub[prim->prim]; - if (prim->prim == 5) - { - /* tri fans need special processing */ - if (gs.nTriFanVert == gs.primIndex) - gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex); - } - } -} +void __forceinline KICK_VERTEX3() +{ + if (++gs.primC >= (int)g_primmult[prim->prim]) + { + gs.primC -= g_primsub[prim->prim]; + if (prim->prim == 5) + { + /* tri fans need special processing */ + if (gs.nTriFanVert == gs.primIndex) + gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex); + } + } +} void __fastcall GIFPackedRegHandlerXYZF2(u32* data) { @@ -138,7 +138,7 @@ void __fastcall GIFPackedRegHandlerXYZF2(u32* data) KICK_VERTEX3(); } else { - KICK_VERTEX2(); + KICK_VERTEX2(); } } @@ -154,7 +154,7 @@ void __fastcall GIFPackedRegHandlerXYZ2(u32* data) KICK_VERTEX3(); } else { - KICK_VERTEX2(); + KICK_VERTEX2(); } } @@ -218,11 +218,11 @@ void tex2Write(int i, u32 *data) // don't update unless necessary if( (s_uTex0Data[0]&0x03f00000) == (data[0]&0x03f00000) ) { // psm is the same - + if( PSMT_ISCLUT(psm) ) { // have to write the CLUT again if changed if( (s_uTex0Data[1]&0x1fffffe0) == (data[1]&0x1fffffe0) ) { - + if( data[1]&0xe0000000 ) { tex0.cld = (data[1]>>29)&7; ZeroGS::texClutWrite(i); @@ -262,7 +262,7 @@ void tex2Write(int i, u32 *data) ZeroGS::Flush(i); ZeroGS::vb[i].bVarsTexSync = FALSE; ZeroGS::vb[i].bTexConstsSync = FALSE; - + s_uTex0Data[0] = (s_uTex0Data[0]&~0x03f00000)|(psm<<20); s_uTex0Data[1] = (s_uTex0Data[1]&0x1f)|(data[1]&~0x1f); @@ -272,7 +272,7 @@ void tex2Write(int i, u32 *data) tex0.cbp = (data[1] >> 5) & 0x3fff; tex0.cpsm = (data[1] >> 19) & 0xe; tex0.csm = (data[1] >> 23) & 0x1; - + if( tex0.cpsm <= 1 ) tex0.csa = (data[1] >> 24) & 0xf; else tex0.csa = (data[1] >> 24) & 0x1f; @@ -343,7 +343,7 @@ __forceinline void clampWrite(int i, u32 *data) clampInfo& clamp = ZeroGS::vb[i].clamp; if( s_uClampData[i] != data[0] || ((clamp.minv>>8)|(clamp.maxv<<2)) != (data[1]&0x0fff) ) { - + // if( ZeroGS::vb[i].bNeedTexCheck ) // ZeroGS::vb[i].FlushTexData(); @@ -384,9 +384,9 @@ void __fastcall GIFRegHandlerPRIM(u32 *data) gs.primC = 0; prim->prim = (data[0]) & 0x7; gs._prim[0].prim = (data[0]) & 0x7; - gs._prim[1].prim = (data[0]) & 0x7; + gs._prim[1].prim = (data[0]) & 0x7; gs._prim[1]._val = (data[0]>>3)&0xff; - + ZeroGS::Prim(); } @@ -506,7 +506,7 @@ void tex1Write(int i, u32* data) ZeroGS::Flush(i); ZeroGS::vb[i].bVarsTexSync = FALSE; } - tex1.lcm = (data[0] ) & 0x1; + tex1.lcm = (data[0] ) & 0x1; tex1.mxl = (data[0] >> 2) & 0x7; tex1.mmag = (data[0] >> 5) & 0x1; tex1.mmin = (data[0] >> 6) & 0x7; @@ -686,7 +686,7 @@ void __fastcall GIFRegHandlerSCISSOR_1(u32* data) newscissor.y0 = ((data[1] ) & 0x7ff) << 3; newscissor.y1 = ((data[1] >> 16) & 0x7ff) << 3; - if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || + if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0 ) { ZeroGS::Flush(0); @@ -707,7 +707,7 @@ void __fastcall GIFRegHandlerSCISSOR_2(u32* data) newscissor.y0 = ((data[1] ) & 0x7ff) << 3; newscissor.y1 = ((data[1] >> 16) & 0x7ff) << 3; - if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || + if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0 ) { ZeroGS::Flush(1); @@ -817,7 +817,7 @@ void __fastcall GIFRegHandlerZBUF_1(u32* data) zbufInfo& zbuf = ZeroGS::vb[0].zbuf; int psm = (0x30|((data[0] >> 24) & 0xf)); - if( zbuf.zbp == (data[0] & 0x1ff) * 32 && + if( zbuf.zbp == (data[0] & 0x1ff) * 32 && zbuf.psm == psm && zbuf.zmsk == (data[1] & 0x1) ) { return; @@ -845,7 +845,7 @@ void __fastcall GIFRegHandlerZBUF_2(u32* data) zbufInfo& zbuf = ZeroGS::vb[1].zbuf; int psm = (0x30|((data[0] >> 24) & 0xf)); - if( zbuf.zbp == (data[0] & 0x1ff) * 32 && + if( zbuf.zbp == (data[0] & 0x1ff) * 32 && zbuf.psm == psm && zbuf.zmsk == (data[1] & 0x1) ) { return; @@ -919,7 +919,7 @@ void __fastcall GIFRegHandlerTRXDIR(u32* data) case 0: // host->loc ZeroGS::InitTransferHostLocal(); break; - + case 1: // loc->host ZeroGS::InitTransferLocalHost(); @@ -946,7 +946,7 @@ void __fastcall GIFRegHandlerTRXDIR(u32* data) static u32 oldhw[4]; void __fastcall GIFRegHandlerHWREG(u32* data) -{ +{ if( gs.imageTransfer == 0 ) { ZeroGS::TransferHostLocal(data, 2); } @@ -982,16 +982,16 @@ void __fastcall GIFRegHandlerFINISH(u32* data) { if(!g_GSMultiThreaded) { - if (gs.CSRw & 0x2) + if (gs.CSRw & 0x2) CSR->FINISH = 1; if (!IMR->FINISHMSK && GSirq) GSirq(); - + // if( gs.CSRw & 2 ) { // //gs.CSRw &= ~2; // //CSR->FINISH = 0; // -// +// // } // CSR->FINISH = 1; // diff --git a/plugins/zerogs/opengl/Win32/Conf.cpp b/plugins/zerogs/opengl/Win32/Conf.cpp index 024b92a605..3c88c38f7e 100644 --- a/plugins/zerogs/opengl/Win32/Conf.cpp +++ b/plugins/zerogs/opengl/Win32/Conf.cpp @@ -76,7 +76,7 @@ void LoadConfig() { conf.height = 960; break; } - + // turn off all hacks by defaultof conf.options &= ~(GSOPTION_FULLSCREEN|GSOPTION_WIREFRAME|GSOPTION_CAPTUREAVI); conf.options |= GSOPTION_LOADED; diff --git a/plugins/zerogs/opengl/Win32/Win32.cpp b/plugins/zerogs/opengl/Win32/Win32.cpp index 7a516d2bbf..81b82a5bdf 100644 --- a/plugins/zerogs/opengl/Win32/Win32.cpp +++ b/plugins/zerogs/opengl/Win32/Win32.cpp @@ -113,7 +113,7 @@ void OnInitDialog(HWND hW) } void OnOK(HWND hW) { - + u32 newinterlace = IsDlgButtonChecked(hW, IDC_CONFIG_INTERLACE); if( !conf.interlace ) conf.interlace = newinterlace; @@ -211,12 +211,12 @@ s32 CALLBACK GStest() { void CALLBACK GSabout() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)AboutDlgProc); } BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT - DWORD dwReason, + DWORD dwReason, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; return TRUE; // very quick :) diff --git a/plugins/zerogs/opengl/Win32/aviUtil.h b/plugins/zerogs/opengl/Win32/aviUtil.h index 866271fe04..5df0cadd5c 100644 --- a/plugins/zerogs/opengl/Win32/aviUtil.h +++ b/plugins/zerogs/opengl/Win32/aviUtil.h @@ -72,21 +72,21 @@ BOOL AVI_CreateStream(PAVIFILE pfile, PAVISTREAM * ps, int rate, // sample/secon //strhdr.fccHandler = mmioFOURCC('M','S','V','C'); // Microsoft video 1 //strhdr.fccHandler = mmioFOURCC('I','V','5','0'); // Intel video 5.0 //strhdr.dwFlags = AVISTREAMINFO_DISABLED; - //strhdr.dwCaps = - //strhdr.wPriority = - //strhdr.wLanguage = + //strhdr.dwCaps = + //strhdr.wPriority = + //strhdr.wLanguage = strhdr.dwScale = 1; strhdr.dwRate = rate; // rate fps - //strhdr.dwStart = - //strhdr.dwLength = - //strhdr.dwInitialFrames = + //strhdr.dwStart = + //strhdr.dwLength = + //strhdr.dwInitialFrames = strhdr.dwSuggestedBufferSize = buffersize; strhdr.dwQuality = -1; // use the default - //strhdr.dwSampleSize = + //strhdr.dwSampleSize = SetRect(&strhdr.rcFrame, 0, 0, // rectangle for stream (int) rectwidth, (int) rectheight); - //strhdr.dwEditCount = + //strhdr.dwEditCount = //strhdr.dwFormatChangeCount = //strcpy(strhdr.szName, "Full Frames (Uncompressed)"); @@ -152,7 +152,7 @@ string dumpAVICOMPRESSOPTIONS(AVICOMPRESSOPTIONS opts) _snprintf(tmp, 255, "LPVOID lpParms = %d\n", (int)opts.lpParms); returnValue += tmp; - _snprintf(tmp, 255, "DWORD cbParms = %d\n", opts.cbParms); + _snprintf(tmp, 255, "DWORD cbParms = %d\n", opts.cbParms); returnValue += tmp; _snprintf(tmp, 255, "DWORD dwInterleaveEvery = %d\n", opts.dwInterleaveEvery); @@ -164,7 +164,7 @@ string dumpAVICOMPRESSOPTIONS(AVICOMPRESSOPTIONS opts) BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEADER lpbi, const char* _compressor) { - + AVICOMPRESSOPTIONS opts; AVICOMPRESSOPTIONS FAR * aopts[1] = {&opts}; @@ -181,10 +181,10 @@ BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEAD //opts.dwQuality //opts.dwBytesPerSecond //opts.dwFlags = AVICOMPRESSF_KEYFRAMES; - //opts.lpFormat + //opts.lpFormat //opts.cbFormat //opts.lpParms - //opts.cbParms + //opts.cbParms //opts.dwInterleaveEvery /* display the compression options dialog box if specified compressor is unknown */ @@ -197,7 +197,7 @@ BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEAD //printf("%s", dumpAVICOMPRESSOPTIONS(opts)); //MessageBox(NULL, dumpAVICOMPRESSOPTIONS(opts).c_str(), "AVICOMPRESSOPTIONS", MB_OK); - } + } HRESULT hr = AVIMakeCompressedStream(psCompressed, *ps, &opts, NULL); if (hr != AVIERR_OK) { @@ -274,7 +274,7 @@ BOOL AVI_AddFrame(PAVISTREAM psCompressed, int time, LPBITMAPINFOHEADER lpbi) MessageBox(NULL, strMsg, "", MB_OK); return FALSE; } - + return TRUE; } @@ -316,7 +316,7 @@ BOOL AVI_CloseFile(PAVIFILE pfile) { if (pfile) AVIFileClose(pfile); - + return TRUE; } @@ -345,13 +345,13 @@ BOOL AVI_Exit() /* Here are the additional functions we need! */ -static PAVIFILE pfile = NULL; +static PAVIFILE pfile = NULL; static PAVISTREAM ps = NULL; -static PAVISTREAM psCompressed = NULL; +static PAVISTREAM psCompressed = NULL; static int count = 0; -// Initialization... +// Initialization... bool START_AVI(const char* file_name) { if(! AVI_Init()) @@ -368,19 +368,19 @@ bool START_AVI(const char* file_name) return true; } - + bool ADD_FRAME_FROM_DIB_TO_AVI(const char* _compressor, int _frameRate, int width, int height, int bits, void* pdata) { if(count == 0) { - if(! AVI_CreateStream(pfile, &ps, _frameRate, - width*height/bits, + if(! AVI_CreateStream(pfile, &ps, _frameRate, + width*height/bits, width, height, _compressor)) { //printf("Error - AVI_CreateStream()\n"); return false; - } + } BITMAPINFOHEADER bi; memset(&bi, 0, sizeof(bi)); @@ -412,7 +412,7 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(const char* _compressor, int _frameRate, int widt MessageBox(NULL, strMsg, "", MB_OK); return FALSE; } - + count++; return true; } @@ -424,16 +424,16 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRa LPBITMAPINFOHEADER lpbi; if(count == 0) { - lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); - if(! AVI_CreateStream(pfile, &ps, _frameRate, - (unsigned long) lpbi->biSizeImage, - (int) lpbi->biWidth, + lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); + if(! AVI_CreateStream(pfile, &ps, _frameRate, + (unsigned long) lpbi->biSizeImage, + (int) lpbi->biWidth, (int) lpbi->biHeight, _compressor)) { //printf("Error - AVI_CreateStream()\n"); GlobalUnlock(lpbi); return false; - } + } if(! AVI_SetOptions(&ps, &psCompressed, lpbi, _compressor)) { @@ -445,7 +445,7 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRa GlobalUnlock(lpbi); } - lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); + lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); if(! AVI_AddFrame(psCompressed, count * 1, lpbi)) { //printf("Error - AVI_AddFrame()\n"); @@ -453,12 +453,12 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRa return false; } - GlobalUnlock(lpbi); + GlobalUnlock(lpbi); count++; return true; } -// The end... +// The end... bool STOP_AVI() { if(! AVI_CloseStream(ps, psCompressed, NULL)) @@ -472,7 +472,7 @@ bool STOP_AVI() //printf("Error - AVI_CloseFile()\n"); return false; } - + if(! AVI_Exit()) { //printf("Error - AVI_Exit()\n"); @@ -480,5 +480,5 @@ bool STOP_AVI() } return true; -} +} diff --git a/plugins/zerogs/opengl/Win32/jpeglib.h b/plugins/zerogs/opengl/Win32/jpeglib.h index c1d119199a..a92e9f1c60 100644 --- a/plugins/zerogs/opengl/Win32/jpeglib.h +++ b/plugins/zerogs/opengl/Win32/jpeglib.h @@ -131,9 +131,9 @@ typedef struct { /* The decompressor output side may not use these variables. */ int dc_tbl_no; /* DC entropy table selector (0..3) */ int ac_tbl_no; /* AC entropy table selector (0..3) */ - + /* Remaining fields should be treated as private by applications. */ - + /* These values are computed during compression or decompression startup: */ /* Component's size in DCT blocks. * Any dummy blocks added to complete an MCU are not counted; therefore @@ -301,14 +301,14 @@ struct jpeg_compress_struct { jpeg_component_info * comp_info; /* comp_info[i] describes component that appears i'th in SOF */ - + JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; /* ptrs to coefficient quantization tables, or NULL if not defined */ - + JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; /* ptrs to Huffman coding tables, or NULL if not defined */ - + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ @@ -348,7 +348,7 @@ struct jpeg_compress_struct { UINT16 X_density; /* Horizontal pixel density */ UINT16 Y_density; /* Vertical pixel density */ boolean write_Adobe_marker; /* should an Adobe marker be written? */ - + /* State variable: index of next scanline to be written to * jpeg_write_scanlines(). Application may use this to control its * processing loop, e.g., "while (next_scanline < image_height)". @@ -373,7 +373,7 @@ struct jpeg_compress_struct { * There are v_samp_factor * DCTSIZE sample rows of each component in an * "iMCU" (interleaved MCU) row. */ - + /* * These fields are valid during any one scan. * They describe the components and MCUs actually appearing in the scan. @@ -381,10 +381,10 @@ struct jpeg_compress_struct { int comps_in_scan; /* # of JPEG components in this scan */ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; /* *cur_comp_info[i] describes component that appears i'th in SOS */ - + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ - + int blocks_in_MCU; /* # of DCT blocks per MCU */ int MCU_membership[C_MAX_BLOCKS_IN_MCU]; /* MCU_membership[i] is index in cur_comp_info of component owning */ @@ -655,7 +655,7 @@ struct jpeg_error_mgr { #define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ /* Reset error state variables at start of a new image */ JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); - + /* The message ID code and any parameters are saved here. * A message can have one string parameter or up to 8 int parameters. */ @@ -665,11 +665,11 @@ struct jpeg_error_mgr { int i[8]; char s[JMSG_STR_PARM_MAX]; } msg_parm; - + /* Standard state variables for error facility */ - + int trace_level; /* max msg_level that will be displayed */ - + /* For recoverable corrupt-data errors, we emit a warning message, * but keep going unless emit_message chooses to abort. emit_message * should count warnings in num_warnings. The surrounding application @@ -827,7 +827,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); /* Short forms of external names for systems with brain-damaged linkers. * We shorten external names to be unique in the first six letters, which * is good enough for all known systems. - * (If your compiler itself needs names to be unique in less than 15 + * (If your compiler itself needs names to be unique in less than 15 * characters, you are out of luck. Get a better compiler.) */ diff --git a/plugins/zerogs/opengl/Win32/resource.h b/plugins/zerogs/opengl/Win32/resource.h index 13bbdd0ce2..cece1dbb0e 100644 --- a/plugins/zerogs/opengl/Win32/resource.h +++ b/plugins/zerogs/opengl/Win32/resource.h @@ -34,7 +34,7 @@ #define IDC_FILTERS 1014 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 112 diff --git a/plugins/zerogs/opengl/Win32/resrc1.h b/plugins/zerogs/opengl/Win32/resrc1.h index ef58a2ca0f..b0fd0e1495 100644 --- a/plugins/zerogs/opengl/Win32/resrc1.h +++ b/plugins/zerogs/opengl/Win32/resrc1.h @@ -68,7 +68,7 @@ #define IDC_CONFIG_AA16 2004 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 113 diff --git a/plugins/zerogs/opengl/Win32/vsprops/svnrev_unknown.h b/plugins/zerogs/opengl/Win32/vsprops/svnrev_unknown.h index 4872e23b20..684d5f9240 100644 --- a/plugins/zerogs/opengl/Win32/vsprops/svnrev_unknown.h +++ b/plugins/zerogs/opengl/Win32/vsprops/svnrev_unknown.h @@ -3,7 +3,7 @@ // 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). @@ -20,4 +20,4 @@ // doesn't check for the SVN_REV_UNKNOWN define. #define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file +#define SVN_MODS "" diff --git a/plugins/zerogs/opengl/ZeroGSShaders/zerogsshaders.cpp b/plugins/zerogs/opengl/ZeroGSShaders/zerogsshaders.cpp index 080f044936..84d1487818 100644 --- a/plugins/zerogs/opengl/ZeroGSShaders/zerogsshaders.cpp +++ b/plugins/zerogs/opengl/ZeroGSShaders/zerogsshaders.cpp @@ -59,7 +59,7 @@ void LoadShader(int index, const char* pshader, CGprofile prof, vector buffer; buffer.reserve(10000000); // 10mb buffer.resize(sizeof(SHADERHEADER)*num); - i = 0; + i = 0; for(map::iterator it = mapShaders.begin(); it != mapShaders.end(); ++it, ++i) { SHADERHEADER h; h.index = it->first | it->second.type; diff --git a/plugins/zerogs/opengl/ZeroGSShaders/zpipe.cpp b/plugins/zerogs/opengl/ZeroGSShaders/zpipe.cpp index c259407e32..d830f864c7 100644 --- a/plugins/zerogs/opengl/ZeroGSShaders/zpipe.cpp +++ b/plugins/zerogs/opengl/ZeroGSShaders/zpipe.cpp @@ -34,10 +34,10 @@ int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed strm.next_in = (Bytef *)src ; strm.next_out = (Bytef *)dst ; - ret = deflate(&strm, Z_FINISH) ; + ret = deflate(&strm, Z_FINISH) ; have = bytes_to_compress - strm.avail_out ; *bytes_after_compressed = have ; - + assert(ret == Z_STREAM_END); /* stream will be complete */ /* clean up and return */ @@ -45,7 +45,7 @@ int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed return Z_OK; } -int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes) +int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes) { z_stream strm; @@ -78,7 +78,7 @@ int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompr (void)inflateEnd(&strm); return ret; } - + assert(strm.avail_in == 0); /* all input will be used */ if( outbytes != NULL ) diff --git a/plugins/zerogs/opengl/common.h b/plugins/zerogs/opengl/common.h index 698c45c5b9..cd0bac0a97 100644 --- a/plugins/zerogs/opengl/common.h +++ b/plugins/zerogs/opengl/common.h @@ -217,7 +217,7 @@ extern const uint32_t inverse[256]; #else # define FASTDIV(a,b) ((a)/(b)) #endif - + #ifdef ARCH_X86 // avoid +32 for shift optimization (gcc should do that ...) static inline int32_t NEG_SSR32( int32_t a, int8_t s){ @@ -257,7 +257,7 @@ typedef struct PutBitContext { int64_t data_out_size; /* in bytes */ } PutBitContext; -void init_put_bits(PutBitContext *s, +void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size, void *opaque, void (*write_data)(void *, uint8_t *, int)); @@ -340,7 +340,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) #endif // DEBUG_LOG("put_bits=%d %x\n", n, value); assert(n == 32 || value < (1U << n)); - + bit_buf = s->bit_buf; bit_left = s->bit_left; @@ -398,9 +398,9 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) # else int index= s->index; uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5); - - value<<= 32-n; - + + value<<= 32-n; + ptr[0] |= be2me_32(value>>(index&31)); ptr[1] = be2me_32(value<<(32-(index&31))); //if(n>24) DEBUG_LOG("%d %d\n", n, value); @@ -428,7 +428,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) # else int index= s->index; uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3)); - + ptr[0] |= be2me_32(value<<(32-n-(index&7) )); ptr[1] = 0; //if(n>24) DEBUG_LOG("%d %d\n", n, value); @@ -677,9 +677,9 @@ static inline int get_bits_count(GetBitContext *s){ /** * read mpeg1 dc style vlc (sign bit + mantisse with no MSB). - * if MSB not set it is negative + * if MSB not set it is negative * @param n length in bits - * @author BERO + * @author BERO */ static inline int get_xbits(GetBitContext *s, int n){ register int tmp; @@ -845,11 +845,11 @@ static inline int get_vlc(GetBitContext *s, VLC *vlc) { int code; VLC_TYPE (*table)[2]= vlc->table; - + OPEN_READER(re, s) UPDATE_CACHE(re, s) - GET_VLC(code, re, s, table, vlc->bits, 3) + GET_VLC(code, re, s, table, vlc->bits, 3) CLOSE_READER(re, s) return code; @@ -857,17 +857,17 @@ static inline int get_vlc(GetBitContext *s, VLC *vlc) /** * parses a vlc code, faster then get_vlc() - * @param bits is the number of bits which will be read at once, must be + * @param bits is the number of bits which will be read at once, must be * identical to nb_bits in init_vlc() * @param max_depth is the number of times bits bits must be readed to completly - * read the longest vlc code + * read the longest vlc code * = (max_vlc_length + bits - 1) / bits */ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth) { int code; - + OPEN_READER(re, s) UPDATE_CACHE(re, s) @@ -883,7 +883,7 @@ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], static inline void print_bin(int bits, int n){ int i; - + for(i=n-1; i>=0; i--){ DEBUG_LOG("%d", (bits>>i)&1); } @@ -893,7 +893,7 @@ static inline void print_bin(int bits, int n){ static inline int get_bits_trace(GetBitContext *s, int n, char *file, char *func, int line){ int r= get_bits(s, n); - + print_bin(r, n); DEBUG_LOG("%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line); return r; @@ -904,16 +904,16 @@ static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits int r= get_vlc2(s, table, bits, max_depth); int len= get_bits_count(s) - pos; int bits2= show>>(24-len); - + print_bin(bits2, len); - + DEBUG_LOG("%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line); return r; } static inline int get_xbits_trace(GetBitContext *s, int n, char *file, char *func, int line){ int show= show_bits(s, n); int r= get_xbits(s, n); - + print_bin(show, n); DEBUG_LOG("%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line); return r; @@ -1029,9 +1029,9 @@ static inline int ff_sqrt(int a) int ret=0; int s; int ret_sq=0; - + if(a<128) return ff_sqrt_tab[a]; - + for(s=15; s>=0; s--){ int b= ret_sq + (1<<(s*2)) + (ret<second->fbw == fbw ); - int offset = (fbp-ittarg->second->fbp)*64/fbw; - + int offset = (fbp-ittarg->second->fbp)*64/fbw; + // 16 bit if (psm & 2) offset *= 2; @@ -391,7 +391,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth) } SETVERTEXSHADER(pvsBitBlt.prog); - + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // fill stencil buf only @@ -417,14 +417,14 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth) status = TS_Resolved; // reset since settings changed - vb[0].bVarsTexSync = 0; + vb[0].bVarsTexSync = 0; ZeroGS::ResetAlphaVariables(); } void ZeroGS::CRenderTarget::ConvertTo32() { u32 ptexConv; - + // create new target glGenTextures(1, &ptexConv); glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptexConv); @@ -491,7 +491,7 @@ void ZeroGS::CRenderTarget::ConvertTo32() glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_NV, ptexConv, 0 ); ZeroGS::ResetRenderTarget(1); assert( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT ); - + glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptex); // to SAMP_FINAL glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -533,23 +533,23 @@ void ZeroGS::CRenderTarget::ConvertTo32() glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptex); glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - + glEnable(GL_SCISSOR_TEST); status = TS_Resolved; // TODO, reset depth? if( ZeroGS::icurctx >= 0 ) { // reset since settings changed - vb[icurctx].bVarsTexSync = 0; + vb[icurctx].bVarsTexSync = 0; vb[icurctx].bVarsSetTarg = 0; } - vb[0].bVarsTexSync = 0; + vb[0].bVarsTexSync = 0; } void ZeroGS::CRenderTarget::ConvertTo16() { u32 ptexConv; - + // create new target glGenTextures(1, &ptexConv); glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptexConv); @@ -616,7 +616,7 @@ void ZeroGS::CRenderTarget::ConvertTo16() glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_NV, ptexConv, 0 ); ZeroGS::ResetRenderTarget(1); assert( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT ); - + glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptex); // to SAMP_FINAL glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -677,7 +677,7 @@ void ZeroGS::CRenderTarget::ConvertTo16() glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptex); glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - + glEnable(GL_SCISSOR_TEST); status = TS_Resolved; @@ -685,7 +685,7 @@ void ZeroGS::CRenderTarget::ConvertTo16() // TODO, reset depth? if( ZeroGS::icurctx >= 0 ) { // reset since settings changed - vb[icurctx].bVarsTexSync = 0; + vb[icurctx].bVarsTexSync = 0; vb[icurctx].bVarsSetTarg = 0; } vb[0].bVarsTexSync = 0; @@ -717,7 +717,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback() glDepthMask(0); glDisable(GL_STENCIL_TEST); glColorMask(1,1,1,1); - + // assume depth already set ResetRenderTarget(1); @@ -769,7 +769,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback() // TODO, reset depth? if( ZeroGS::icurctx >= 0 ) { // reset since settings changed - vb[icurctx].bVarsTexSync = 0; + vb[icurctx].bVarsTexSync = 0; } assert( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT ); @@ -834,22 +834,22 @@ void ZeroGS::CDepthTarget::Destroy() glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0 ); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0 ); GL_REPORT_ERRORD(); - + if( pstencil != 0 ) { if( pstencil != pdepth ) glDeleteRenderbuffersEXT( 1, &pstencil ); pstencil = 0; } - + if( pdepth != 0 ) { glDeleteRenderbuffersEXT( 1, &pdepth ); pdepth = 0; } GL_REPORT_ERRORD(); } - + CRenderTarget::Destroy(); - + } @@ -864,7 +864,7 @@ void ZeroGS::CDepthTarget::Resolve() if( vb[0].prndr == this || vb[0].pdepth == this ) Flush(0); if( vb[1].prndr == this || vb[1].pdepth == this ) Flush(1); - if( !(status & TS_Virtual) ) + if( !(status & TS_Virtual) ) status |= TS_Resolved; } @@ -881,7 +881,7 @@ void ZeroGS::CDepthTarget::Resolve(int startrange, int endrange) if( vb[0].prndr == this || vb[0].pdepth == this ) Flush(0); if( vb[1].prndr == this || vb[1].pdepth == this ) Flush(1); - if( !(status & TS_Virtual) ) + if( !(status & TS_Virtual) ) status |= TS_Resolved; } @@ -913,7 +913,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr) glDepthMask(1); glDisable(GL_STENCIL_TEST); glDepthFunc(GL_ALWAYS); - + // write color and zero out stencil buf, always 0 context! SetTexVariablesInt(0, 0, texframe, pmemtarg, &ppsBitBltDepth, 1); cgGLSetTextureParameter(ppsBitBltDepth.sMemory, pmemtarg->ptex->tex); @@ -1017,16 +1017,16 @@ void ZeroGS::CRenderTargetMngr::DestroyAllTargs(int start, int end, int fbw) if( !it->second->IsDepth() ) { // only resolve if the widths are the same or it->second has bit outside the range // shadow of colossus swaps between fbw=256,fbh=256 and fbw=512,fbh=448. This kills the game if doing || it->second->end > end - + // kh hack, sometimes kh movies do this to clear the target, so have a static count that periodically checks end static int count = 0; - + if( it->second->fbw == fbw || (it->second->fbw != fbw && (it->second->start < start || ((count++&0xf)?0:it->second->end > end) )) ) it->second->Resolve(); else { if( vb[0].prndr == it->second || vb[0].pdepth == it->second ) Flush(0); if( vb[1].prndr == it->second || vb[1].pdepth == it->second ) Flush(1); - + it->second->status |= CRenderTarget::TS_Resolved; } } @@ -1036,16 +1036,16 @@ void ZeroGS::CRenderTargetMngr::DestroyAllTargs(int start, int end, int fbw) else { if( vb[0].prndr == it->second || vb[0].pdepth == it->second ) Flush(0); if( vb[1].prndr == it->second || vb[1].pdepth == it->second ) Flush(1); - + it->second->status |= CRenderTarget::TS_Resolved; } } - + for(int i = 0; i < 2; ++i) { if( it->second == vb[i].prndr ) { vb[i].prndr = NULL; vb[i].bNeedFrameCheck = 1; } if( it->second == vb[i].pdepth ) { vb[i].pdepth = NULL; vb[i].bNeedZCheck = 1; } } - + u32 dummykey = (it->second->fbw<<16)|it->second->fbh; if( mapDummyTargs.find(dummykey) == mapDummyTargs.end() ) { mapDummyTargs[dummykey] = it->second; @@ -1064,33 +1064,33 @@ void ZeroGS::CRenderTargetMngr::DestroyTarg(CRenderTarget* ptarg) if( ptarg == vb[i].prndr ) { vb[i].prndr = NULL; vb[i].bNeedFrameCheck = 1; } if( ptarg == vb[i].pdepth ) { vb[i].pdepth = NULL; vb[i].bNeedZCheck = 1; } } - + delete ptarg; } void ZeroGS::CRenderTargetMngr::DestroyIntersecting(CRenderTarget* prndr) { assert( prndr != NULL ); - + int start, end; GetRectMemAddress(start, end, prndr->psm, 0, 0, prndr->fbw, prndr->fbh, prndr->fbp, prndr->fbw); - + for(MAPTARGETS::iterator it = mapTargets.begin(); it != mapTargets.end();) { if( it->second != prndr && it->second->start < end && start < it->second->end ) { it->second->Resolve(); - + for(int i = 0; i < 2; ++i) { if( it->second == vb[i].prndr ) { vb[i].prndr = NULL; vb[i].bNeedFrameCheck = 1; } if( it->second == vb[i].pdepth ) { vb[i].pdepth = NULL; vb[i].bNeedZCheck = 1; } } - + u32 dummykey = (it->second->fbw<<16)|it->second->fbh; if( mapDummyTargs.find(dummykey) == mapDummyTargs.end() ) { mapDummyTargs[dummykey] = it->second; } else delete it->second; - + mapTargets.erase(it++); } else ++it; @@ -1172,12 +1172,12 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op it->second->lastused = timeGetTime(); return Promote(it->first&~TARGET_VIRTUAL_KEY); } - + // check if there exists a more recent target that this target could update from for(MAPTARGETS::iterator itnew = mapTargets.begin(); itnew != mapTargets.end(); ++itnew) { if( itnew->second != it->second && itnew->second->start <= it->second->start && itnew->second->end >= it->second->end && itnew->second->lastused > it->second->lastused && !(itnew->second->status & CRenderTarget::TS_NeedUpdate) ) { - + it->second->status |= CRenderTarget::TS_NeedUpdate; it->second->nUpdateTarg = itnew->first; break; @@ -1316,7 +1316,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op cur = !cur; } } - + if( (opts & CRenderTargetMngr::TO_Virtual) ) { ptarg->status = CRenderTarget::TS_Virtual; key |= TARGET_VIRTUAL_KEY; @@ -1462,7 +1462,7 @@ bool ZeroGS::CMemoryTarget::ValidateTex(const tex0Info& tex0, int starttex, int // lock and compare assert( ptex != NULL && ptex->memptr != NULL); - + int result = memcmp_mmx(ptex->memptr + (checkstarty-realy)*4*GPU_TEXWIDTH, g_pbyGSMemory+checkstarty*4*GPU_TEXWIDTH, (checkendy-checkstarty)*4*GPU_TEXWIDTH); if( result == 0 || !bDeleteBadTex ) { @@ -1594,7 +1594,7 @@ inline list::iterator ZeroGS::CMemoryTargetMngr::DestroyTargetIte // find the target and destroy list::iterator itprev = it; ++it; listClearedTargets.splice(listClearedTargets.end(), listTargets, itprev); - + if( listClearedTargets.size() > TEXDESTROY_THRESH ) { listClearedTargets.pop_front(); } @@ -1650,7 +1650,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info if( PSMT_ISCLUT(tex0.psm) ) { assert( it->clut.size() > 0 ); - + if( it->psm != tex0.psm || it->cpsm != tex0.cpsm || it->clut.size() != clutsize ) { // wrong clut if( it->validatecount++ > VALIDATE_THRESH ) { @@ -1705,7 +1705,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info it->usedstamp = curstamp; it->validatecount = 0; - + return &(*it); } #ifdef SORT_TARGETS @@ -1725,7 +1725,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info if( (PSMT_ISCLUT(tex0.psm) && tex0.cpsm > 1) || tex0.psm == PSMCT16 || tex0.psm == PSMCT16S) { fmt = GL_UNSIGNED_SHORT_1_5_5_5_REV; } - + int widthmult = 1; if( g_MaxTexHeight < 4096 ) { if( end-start > g_MaxTexHeight ) @@ -1787,7 +1787,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info targ->cpsm = tex0.cpsm; targ->clut.reserve(256*4); // no matter what targ->clut.resize(clutsize); - + if( tex0.cpsm <= 1 ) { // 32 bit memcpy_amd(&targ->clut[0], g_pbyGSClut+nClutOffset, clutsize); } @@ -1838,7 +1838,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info targ->cpsm = tex0.cpsm; targ->widthmult = widthmult; targ->channels = channels; - + // alloc the mem targ->ptex = new CMemoryTarget::TEXTURE(); targ->ptex->ref = 1; @@ -1847,7 +1847,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info #ifdef ZEROGS_DEVBUILD g_TransferredToGPU += GPU_TEXWIDTH * channels * 4 * targ->height; #endif - + // fill with data if( targ->ptex->memptr == NULL ) { targ->ptex->memptr = (u8*)_aligned_malloc(4 * GPU_TEXWIDTH * targ->realheight, 16); @@ -1857,7 +1857,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info memcpy_amd(targ->ptex->memptr, g_pbyGSMemory + 4 * GPU_TEXWIDTH * targ->realy, 4 * GPU_TEXWIDTH * targ->height); vector texdata; u8* ptexdata = NULL; - + if( PSMT_ISCLUT(tex0.psm) ) { texdata.resize( (tex0.cpsm <= 1?4:2) *GPU_TEXWIDTH*channels*widthmult*(targ->realheight+widthmult-1)/widthmult); @@ -1874,14 +1874,14 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info else { u16* pclut = (u16*)&targ->clut[0]; u16* pdst = (u16*)ptexdata; - + BUILDCLUT(); } } else { if( tex0.psm == PSMT16Z || tex0.psm == PSMT16SZ ) { -#if defined(ZEROGS_SSE2) - // reserve additional elements for alignment if SSE2 used. +#if defined(ZEROGS_SSE2) + // reserve additional elements for alignment if SSE2 used. texdata.resize(4 * GPU_TEXWIDTH * channels * widthmult * (targ->realheight + widthmult - 1) / widthmult + 15); #else texdata.resize(4 * GPU_TEXWIDTH * channels * widthmult * (targ->realheight + widthmult - 1) / widthmult); @@ -1890,7 +1890,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info // needs to be 8 bit, use xmm for unpacking u16* dst = (u16*)ptexdata; u16* src = (u16*)(g_pbyGSMemory + 4 * GPU_TEXWIDTH * targ->realy); - + #if defined(ZEROGS_SSE2) if (((u32)(uptr)dst) % 16 != 0) { // This is not an unusual situation, when vector does not align 16bit, it is destructive for SSE2 @@ -1900,17 +1900,17 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info // FIXME. As I see, texdata used only once here, it does not have any impact on other code. // Probably, usage of _aligned_maloc() would be preferable. // -- Zeydlitz - - int disalignment = 16 - ((u32)(uptr)dst)%16 ; // This is value of shift. It could be 0 < disalignment <= 15 + + int disalignment = 16 - ((u32)(uptr)dst)%16 ; // This is value of shift. It could be 0 < disalignment <= 15 ptexdata = &texdata[disalignment]; // Set pointer to aligned element - dst = (u16*)ptexdata; - GS_LOG("Made alignment for texdata, 0x%x\n", dst ); + dst = (u16*)ptexdata; + GS_LOG("Made alignment for texdata, 0x%x\n", dst ); assert( ((u32)(uptr)dst)%16 == 0 ); // Assert, because at future could be vectors with uncontigious spaces } int iters = targ->height*GPU_TEXWIDTH/16; -#if defined(_MSC_VER) - +#if defined(_MSC_VER) + __asm { mov edx, iters pxor xmm7, xmm7 @@ -1963,44 +1963,44 @@ Z16Loop: __asm__(".intel_syntax\n" "pxor %%xmm7, %%xmm7\n" - + "Z16Loop:\n" // unpack 64 bytes at a time "movdqa %%xmm0, [%0]\n" "movdqa %%xmm2, [%0+16]\n" "movdqa %%xmm4, [%0+32]\n" "movdqa %%xmm6, [%0+48]\n" - + "movdqa %%xmm1, %%xmm0\n" "movdqa %%xmm3, %%xmm2\n" "movdqa %%xmm5, %%xmm4\n" - + "punpcklwd %%xmm0, %%xmm7\n" "punpckhwd %%xmm1, %%xmm7\n" "punpcklwd %%xmm2, %%xmm7\n" "punpckhwd %%xmm3, %%xmm7\n" - + // start saving "movdqa [%1], %%xmm0\n" "movdqa [%1+16], %%xmm1\n" - + "punpcklwd %%xmm4, %%xmm7\n" "punpckhwd %%xmm5, %%xmm7\n" - + "movdqa [%1+32], %%xmm2\n" "movdqa [%1+48], %%xmm3\n" - + "movdqa %%xmm0, %%xmm6\n" "punpcklwd %%xmm6, %%xmm7\n" - + "movdqa [%1+64], %%xmm4\n" "movdqa [%1+80], %%xmm5\n" "punpckhwd %%xmm0, %%xmm7\n" - + "movdqa [%1+96], %%xmm6\n" "movdqa [%1+112], %%xmm0\n" - + "add %0, 64\n" "add %1, 128\n" "sub %2, 1\n" @@ -2030,12 +2030,12 @@ Z16Loop: if( targ->ptex->tex == 0 ) glGenTextures(1, &targ->ptex->tex); glBindTexture(GL_TEXTURE_RECTANGLE_NV, targ->ptex->tex); - glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, fmt==GL_UNSIGNED_BYTE?4:GL_RGB5_A1, GPU_TEXWIDTH*channels*widthmult, + glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, fmt==GL_UNSIGNED_BYTE?4:GL_RGB5_A1, GPU_TEXWIDTH*channels*widthmult, (targ->realheight+widthmult-1)/widthmult, 0, GL_RGBA, fmt, ptexdata); int realheight = targ->realheight; while( glGetError() != GL_NO_ERROR ) { - + // release resources until can create if( listClearedTargets.size() > 0 ) listClearedTargets.pop_front(); @@ -2120,7 +2120,7 @@ void ZeroGS::CMemoryTargetMngr::ClearRange(int nbStartY, int nbEndY) // continue; // } // } -// +// // ++it; // } // } @@ -2133,7 +2133,7 @@ void ZeroGS::CMemoryTargetMngr::DestroyCleared() it = listClearedTargets.erase(it); continue; } - + ++it; } @@ -2159,7 +2159,7 @@ void ZeroGS::CMemoryTargetMngr::DestroyOldest() list::iterator it, itbest; it = itbest = listTargets.begin(); - + while(it != listTargets.end()) { if( it->usedstamp < itbest->usedstamp ) itbest = it; @@ -2218,7 +2218,7 @@ u32 ZeroGS::CBitwiseTextureMngr::GetTexInt(u32 bitvalue, u32 ptexDoNotDelete) void ZeroGS::CRangeManager::Insert(int start, int end) { int imin = 0, imax = (int)ranges.size(), imid; - + #ifdef _DEBUG // sanity check for(int i = 0; i < (int)ranges.size()-1; ++i) assert( ranges[i].end < ranges[i+1].start ); @@ -2328,7 +2328,7 @@ void ZeroGS::CRangeManager::Insert(int start, int end) assert( end >= ranges.front().start ); if( start < ranges.front().start ) ranges.front().start = start; if( end > ranges.front().end ) ranges.front().end = end; - + #ifdef _DEBUG // sanity check for(int i = 0; i < (int)ranges.size()-1; ++i) assert( ranges[i].end < ranges[i+1].start ); @@ -2435,7 +2435,7 @@ void FlushTransferRanges(const tex0Info* ptex) if( !(g_GameSettings & GAME_NOQUICKRESOLVE) ) { if( ptarg->fbp != vb[0].gsfb.fbp ) {//&& (vb[0].prndr == NULL || ptarg->fbp != vb[0].prndr->fbp) ) { - + if( ptarg->fbp != vb[1].gsfb.fbp ) { //&& (vb[1].prndr == NULL || ptarg->fbp != vb[1].prndr->fbp) ) { // this render target currently isn't used and is not in the texture's way, so can safely ignore // resolving it. Also the range has to be big enough compared to the target to really call it resolved @@ -2490,7 +2490,7 @@ void FlushTransferRanges(const tex0Info* ptex) } } } - + ptarg->status |= CRenderTarget::TS_Resolved; if( !ptarg->IsDepth() || (!(g_GameSettings & GAME_NODEPTHUPDATE) || end-start > 0x1000) ) ptarg->status |= CRenderTarget::TS_NeedUpdate; @@ -2523,7 +2523,7 @@ void InitTransferHostLocal() gs.imageEndX = gs.imageX + gs.imageWnew; gs.imageEndY = gs.imageY + gs.imageHnew; - assert( gs.imageEndX < 2048 && gs.imageEndY < 2048 ); + assert( gs.imageEndX < 2048 && gs.imageEndY < 2048 ); // hack! viewful joe if( gs.dstbuf.psm == 63 ) @@ -2660,7 +2660,7 @@ void TransferHostLocal(const void* pbyMem, u32 nQWordSize) //{ // assert( gs.imageTransfer == 0 ); // u8* pstart = g_pbyGSMemory + gs.dstbuf.bp*256; -// +// // const u8* pendbuf = (const u8*)pbyMem + nQWordSize*4; // int i = gs.imageY, j = gs.imageX; // @@ -2859,7 +2859,7 @@ void TransferLocalHost(void* pbyMem, u32 nQWordSize) } } -// dir depends on trxpos.dir +// dir depends on trxpos.dir void TransferLocalLocal() { assert( gs.imageTransfer == 2 ); @@ -2872,7 +2872,7 @@ void TransferLocalLocal() WARN_LOG("Transfer error, dst width exceeds\n"); int srcstart, srcend, dststart, dstend; - + GetRectMemAddress(srcstart, srcend, gs.srcbuf.psm, gs.trxpos.sx, gs.trxpos.sy, gs.imageWnew, gs.imageHnew, gs.srcbuf.bp, gs.srcbuf.bw); GetRectMemAddress(dststart, dstend, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw); @@ -2996,15 +2996,15 @@ void TransferLocalLocal() case PSMT8: if( gs.dstbuf.psm == PSMT8 ) { - TRANSFERLOCALLOCAL(8, 8, 4); + TRANSFERLOCALLOCAL(8, 8, 4); } else { - TRANSFERLOCALLOCAL(8, 8H, 4); + TRANSFERLOCALLOCAL(8, 8H, 4); } break; case PSMT4: - + switch(gs.dstbuf.psm ) { case PSMT4: TRANSFERLOCALLOCAL_4(4, 4); break; case PSMT4HL: TRANSFERLOCALLOCAL_4(4, 4HL); break; @@ -3014,10 +3014,10 @@ void TransferLocalLocal() case PSMT8H: if( gs.dstbuf.psm == PSMT8 ) { - TRANSFERLOCALLOCAL(8H, 8, 4); + TRANSFERLOCALLOCAL(8H, 8, 4); } else { - TRANSFERLOCALLOCAL(8H, 8H, 4); + TRANSFERLOCALLOCAL(8H, 8H, 4); } break; @@ -3176,7 +3176,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) } } int Pitch; - + #define RESOLVE_32BIT(psm, T, Tsrc, blockbits, blockwidth, blockheight, convfn, frame, aax, aay) \ { \ Tsrc* src = (Tsrc*)psrc; \ @@ -3243,7 +3243,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(16S, u16, u32, 16, 16, 8, RGBA32to16, Frame, 0, 0); } - + break; case PSMT32Z: case PSMT24Z: @@ -3256,7 +3256,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(32Z, u32, u32, 32, 8, 8, (u32), Frame, 0, 0); } - + break; case PSMT16Z: if( s_AAy ) { @@ -3268,7 +3268,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(16Z, u16, u32, 16, 16, 8, (u16), Frame, 0, 0); } - + break; case PSMT16SZ: if( s_AAy ) { @@ -3280,7 +3280,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(16SZ, u16, u32, 16, 16, 8, (u16), Frame, 0, 0); } - + break; } } @@ -3300,7 +3300,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(32, u32, Vector_16F, 32, 8, 8, Float16ToARGB, Frame16, 0, 0); } - + break; case PSMCT16: if( s_AAy ) { @@ -3312,7 +3312,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(16, u16, Vector_16F, 16, 16, 8, Float16ToARGB16, Frame16, 0, 0); } - + break; case PSMCT16S: if( s_AAy ) { @@ -3324,7 +3324,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(16S, u16, Vector_16F, 16, 16, 8, Float16ToARGB16, Frame16, 0, 0); } - + break; case PSMT32Z: case PSMT24Z: @@ -3337,7 +3337,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(32Z, u32, Vector_16F, 32Z, 8, 8, Float16ToARGB_Z, Frame16, 0, 0); } - + break; case PSMT16Z: if( s_AAy ) { @@ -3349,7 +3349,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(16Z, u16, Vector_16F, 16Z, 16, 8, Float16ToARGB16_Z, Frame16, 0, 0); } - + break; case PSMT16SZ: if( s_AAy ) { @@ -3361,7 +3361,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm) else { RESOLVE_32BIT(16SZ, u16, Vector_16F, 16Z, 16, 8, Float16ToARGB16_Z, Frame16, 0, 0); } - + break; } } @@ -3377,7 +3377,7 @@ void SaveTex(tex0Info* ptex, int usevid) { vector data(ptex->tw*ptex->th); vector srcdata; - + u32* dst = &data[0]; u8* psrc = g_pbyGSMemory; @@ -3387,7 +3387,7 @@ void SaveTex(tex0Info* ptex, int usevid) pmemtarg = g_MemTargs.GetMemoryTarget(*ptex, 0); assert( pmemtarg != NULL ); - + glBindTexture(GL_TEXTURE_RECTANGLE_NV, pmemtarg->ptex->tex); srcdata.resize(pmemtarg->realheight*GPU_TEXWIDTH*pmemtarg->widthmult*4*8); // max of 8 cannels @@ -3428,7 +3428,7 @@ void SaveTex(tex0Info* ptex, int usevid) u = RGBA16to32(u); } else u = 0; - + break; case PSMCT16S: addr = getPixelAddress16(j, i, ptex->tbp0, ptex->tbw); diff --git a/plugins/zerogs/opengl/targets.h b/plugins/zerogs/opengl/targets.h index 22bf4020d9..1d1d9f73bd 100644 --- a/plugins/zerogs/opengl/targets.h +++ b/plugins/zerogs/opengl/targets.h @@ -25,51 +25,51 @@ namespace ZeroGS { { public: typedef map MAPTARGETS; - + enum TargetOptions { TO_DepthBuffer = 1, TO_StrictHeight = 2, // height returned has to be the same as requested TO_Virtual = 4 }; - + ~CRenderTargetMngr() { Destroy(); } - + void Destroy(); static MAPTARGETS::iterator GetOldestTarg(MAPTARGETS& m); - + CRenderTarget* GetTarg(const frameInfo& frame, u32 Options, int maxposheight); inline CRenderTarget* GetTarg(int fbp, int fbw) { MAPTARGETS::iterator it = mapTargets.find(fbp|(fbw<<16)); return it != mapTargets.end() ? it->second : NULL; } - + // gets all targets with a range void GetTargs(int start, int end, list& listTargets) const; - + // resolves all targets within a range __forceinline void Resolve(int start, int end); __forceinline void ResolveAll() { for(MAPTARGETS::iterator it = mapTargets.begin(); it != mapTargets.end(); ++it ) it->second->Resolve(); } - + void DestroyAllTargs(int start, int end, int fbw); void DestroyIntersecting(CRenderTarget* prndr); - + // promotes a target from virtual to real inline CRenderTarget* Promote(u32 key) { assert( !(key & TARGET_VIRTUAL_KEY) ); - + // promote to regular targ CRenderTargetMngr::MAPTARGETS::iterator it = mapTargets.find(key|TARGET_VIRTUAL_KEY); assert( it != mapTargets.end() ); - + CRenderTarget* ptarg = it->second; mapTargets.erase(it); - + DestroyIntersecting(ptarg); - + it = mapTargets.find(key); if( it != mapTargets.end() ) { DestroyTarg(it->second); @@ -77,16 +77,16 @@ namespace ZeroGS { } else mapTargets[key] = ptarg; - + if( g_GameSettings & GAME_RESOLVEPROMOTED ) ptarg->status = CRenderTarget::TS_Resolved; else ptarg->status = CRenderTarget::TS_NeedUpdate; return ptarg; } - + static void DestroyTarg(CRenderTarget* ptarg); - + MAPTARGETS mapTargets, mapDummyTargs; }; @@ -150,7 +150,7 @@ namespace ZeroGS { // works in semi logN void Insert(int start, int end); inline void Clear() { ranges.resize(0); } - + vector ranges; // organized in ascending order, non-intersecting }; diff --git a/plugins/zerogs/opengl/x86.cpp b/plugins/zerogs/opengl/x86.cpp index 712eacd9d4..b895fa51dd 100644 --- a/plugins/zerogs/opengl/x86.cpp +++ b/plugins/zerogs/opengl/x86.cpp @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -471,11 +471,11 @@ End: void __fastcall WriteCLUT_T16_I8_CSM1_c(u32* _vm, u32* _clut) { - const static u32 map[] = + const static u32 map[] = { 0, 2, 8, 10, 16, 18, 24, 26, 4, 6, 12, 14, 20, 22, 28, 30, - 1, 3, 9, 11, 17, 19, 25, 27, + 1, 3, 9, 11, 17, 19, 25, 27, 5, 7, 13, 15, 21, 23, 29, 31 }; @@ -484,7 +484,7 @@ void __fastcall WriteCLUT_T16_I8_CSM1_c(u32* _vm, u32* _clut) int left = ((u32)(uptr)clut&2) ? 512 : 512-(((u32)(uptr)clut)&0x3ff)/2; - for(int j = 0; j < 8; j++, vm += 32, clut += 64, left -= 32) + for(int j = 0; j < 8; j++, vm += 32, clut += 64, left -= 32) { if(left == 32) { assert( left == 32 ); @@ -514,7 +514,7 @@ void __fastcall WriteCLUT_T32_I8_CSM1_c(u32* vm, u32* clut) u64* dst = (u64*)clut; for(int j = 0; j < 2; j++, src += 32) { - for(int i = 0; i < 4; i++, dst+=16, src+=8) + for(int i = 0; i < 4; i++, dst+=16, src+=8) { dst[0] = src[0]; dst[1] = src[2]; diff --git a/plugins/zerogs/opengl/x86.h b/plugins/zerogs/opengl/x86.h index 6cefbc0779..e000a106eb 100644 --- a/plugins/zerogs/opengl/x86.h +++ b/plugins/zerogs/opengl/x86.h @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/zerogs/opengl/zerogs.cpp b/plugins/zerogs/opengl/zerogs.cpp index f28cc3ab09..f52655810d 100644 --- a/plugins/zerogs/opengl/zerogs.cpp +++ b/plugins/zerogs/opengl/zerogs.cpp @@ -118,7 +118,7 @@ char EFFECT_NAME[255] = "~/pcsx2/plugins/gs/zerogs/opengl/ps2hw.fx"; #endif -BOOL g_bUpdateStencil = 1; // only needed for dest alpha test (unfortunately, it has to be on all the time) +BOOL g_bUpdateStencil = 1; // only needed for dest alpha test (unfortunately, it has to be on all the time) #define DRAW() glDrawArrays(primtype[curvb.curprim.prim], 0, curvb.nCount) @@ -292,7 +292,7 @@ static BOOL s_bDestAlphaTest = FALSE; static int s_nLastResolveReset = 0; static int s_nResolveCounts[30] = {0}; // resolve counts for last 30 frames static int s_nCurResolveIndex = 0; -int s_nResolved = 0; // number of targets resolved this frame +int s_nResolved = 0; // number of targets resolved this frame int g_nDepthUsed = 0; // ffx2 pal movies static int s_nWriteDepthCount = 0; static int s_nWireframeCount = 0; @@ -300,7 +300,7 @@ static int s_nWriteDestAlphaTest = 0; //////////////////// // State parameters -static float fiRendWidth, fiRendHeight; +static float fiRendWidth, fiRendHeight; static Vector vAlphaBlendColor; // used for GPU_COLOR @@ -363,7 +363,7 @@ namespace ZeroGS RenderFormatType GetRenderFormat() { return g_RenderFormatType; } GLenum GetRenderTargetFormat() { return GetRenderFormat()==RFT_byte8?4:g_internalRGBAFloat16Fmt; } - // returns the first and last addresses aligned to a page that cover + // returns the first and last addresses aligned to a page that cover void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw); bool LoadEffects(); @@ -463,7 +463,7 @@ ZeroGS::VB::~VB() void ZeroGS::VB::Destroy() { _aligned_free(pBufferData); pBufferData = NULL; nNumVertices = 0; - + prndr = NULL; pdepth = NULL; } @@ -555,7 +555,7 @@ void ZeroGS::VB::CheckFrame(int tbp) ResetAlphaVariables(); } } - + int fbh = (scissor.y1>>MINMAX_SHIFT)+1; if( fbh > 2 && (fbh&1) ) fbh -= 1; @@ -588,14 +588,14 @@ void ZeroGS::VB::CheckFrame(int tbp) frame.fbh = considerheight; else if( frame.fbh <= 32 ) frame.fbh = considerheight; - + if( frame.fbh == considerheight ) { // stops bad resolves (mgs3) if( !curprim.abe && (!test.ate || test.atst == 0) ) s_nResolved |= 0x100; } }*/ - + // ffxii hack to stop resolving if( !(frame.psm&2) || !(g_GameSettings&GAME_FULL16BITRES) ) { if( frame.fbp >= 0x3000 && fbh >= 0x1a0 ) { @@ -650,9 +650,9 @@ void ZeroGS::VB::CheckFrame(int tbp) tempfb.fbp = zbuf.zbp; tempfb.psm = zbuf.psm; tempfb.fbh = prndr->fbh; - if( zbuf.psm == 0x31 ) + if( zbuf.psm == 0x31 ) tempfb.fbm = 0xff000000; - else + else tempfb.fbm = 0; // check if there is a target that exactly aligns with zbuf (zbuf can be cleared this way, gunbird 2) @@ -706,7 +706,7 @@ void ZeroGS::VB::CheckFrame(int tbp) f.fbw = prndr->fbw; f.fbh = prndr->fbh; f.psm = zbuf.psm; - + if( zbuf.psm == PSMT24Z ) f.fbm = 0xff000000; else f.fbm = 0; CDepthTarget* pnewdepth = (CDepthTarget*)s_DepthRTs.GetTarg(f, CRenderTargetMngr::TO_DepthBuffer|CRenderTargetMngr::TO_StrictHeight| @@ -721,7 +721,7 @@ void ZeroGS::VB::CheckFrame(int tbp) pdepth = pnewdepth; } } - + if( prndr != NULL ) SetContextTarget(ictx); } @@ -738,7 +738,7 @@ void ZeroGS::VB::FlushTexData() if( uCurTex0Data[0] == uNextTex0Data[0] && (uCurTex0Data[1]&0x1f) == (uNextTex0Data[1]&0x1f) ) { if( PSMT_ISCLUT(psm) ) { - + // have to write the CLUT again if changed if( (uCurTex0Data[1]&0x1fffffe0) == (uNextTex0Data[1]&0x1fffffe0) ) { @@ -879,7 +879,7 @@ void ZeroGS::HandleGLError() // check the error status of this framebuffer */ GLenum error = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - // if error != GL_FRAMEBUFFER_COMPLETE_EXT, there's an error of some sort + // if error != GL_FRAMEBUFFER_COMPLETE_EXT, there's an error of some sort if( error != 0 ) { int w, h; GLint fmt; @@ -945,7 +945,7 @@ bool ZeroGS::Create(int _width, int _height) int i; Destroy(1); - GSStateReset(); + GSStateReset(); cgSetErrorHandler(HandleCgError, NULL); g_RenderFormatType = RFT_float16; @@ -962,7 +962,7 @@ bool ZeroGS::Create(int _width, int _height) RECT rcdesktop; GetWindowRect(GetDesktopWindow(), &rcdesktop); - + if (conf.options & GSOPTION_FULLSCREEN) { nBackbufferWidth = rcdesktop.right - rcdesktop.left; nBackbufferHeight = rcdesktop.bottom - rcdesktop.top; @@ -1022,19 +1022,19 @@ bool ZeroGS::Create(int _width, int _height) 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored - 24, // 24Bit Z-Buffer (Depth Buffer) + 24, // 24Bit Z-Buffer (Depth Buffer) 8, // 8bit Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; - + if (!(hDC=GetDC(GShwnd))) { MessageBox(NULL,"(1) Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; } - + if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) { MessageBox(NULL,"(2) Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; @@ -1130,7 +1130,7 @@ bool ZeroGS::Create(int _width, int _height) if( !bSuccess ) return false; - + if( g_GameSettings & GAME_32BITTARGS ) { g_RenderFormatType = RFT_byte8; ERROR_LOG("Setting 32 bit render target\n"); @@ -1198,7 +1198,7 @@ bool ZeroGS::Create(int _width, int _height) char tempstr[255]; char curwd[255]; getcwd(curwd, ARRAY_SIZE(curwd)); - + strcpy(tempstr, "../plugins/zerogs/opengl/"); sprintf(EFFECT_NAME, "%sps2hw.fx", tempstr); FILE* f = fopen(EFFECT_NAME, "r"); @@ -1260,7 +1260,7 @@ bool ZeroGS::Create(int _width, int _height) glDrawBuffers = (PFNGLDRAWBUFFERSPROC)wglGetProcAddress("glDrawBuffersATI"); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); - + GL_REPORT_ERROR(); if( err != GL_NO_ERROR ) bSuccess = false; @@ -1315,7 +1315,7 @@ bool ZeroGS::Create(int _width, int _height) glDisable(GL_LIGHTING); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations - + glGenTextures(1, &ptexLogo); glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptexLogo); @@ -1412,7 +1412,7 @@ bool ZeroGS::Create(int _width, int _height) // fill a simple rect glGenBuffers(1, &vboRect); glBindBuffer(GL_ARRAY_BUFFER, vboRect); - + vector verts(4); VertexGPU* pvert = &verts[0]; pvert->x = -0x7fff; pvert->y = 0x7fff; pvert->z = 0; pvert->s = 0; pvert->t = 0; pvert++; @@ -1476,7 +1476,7 @@ bool ZeroGS::Create(int _width, int _height) if( err != GL_NO_ERROR ) bSuccess = false; g_cgcontext = cgCreateContext(); - + cgvProf = CG_PROFILE_ARBVP1; cgfProf = CG_PROFILE_ARBFP1; cgGLEnableProfile(cgvProf); @@ -1535,7 +1535,7 @@ bool ZeroGS::Create(int _width, int _height) GL_BLEND_ALPHA(GL_ONE, GL_ZERO); glBlendColorEXT(0, 0, 0, 0.5f); - + glDisable(GL_CULL_FACE); // points @@ -1671,9 +1671,9 @@ void ZeroGS::DrawText(const char* pstr, int left, int top, u32 color) { cgGLDisableProfile(cgvProf); cgGLDisableProfile(cgfProf); - + glColor3f(((color>>16)&0xff)/255.0f, ((color>>8)&0xff)/255.0f, (color&0xff)/255.0f); - + font_p->printString(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight,0); cgGLEnableProfile(cgvProf); cgGLEnableProfile(cgfProf); @@ -1707,7 +1707,7 @@ void ZeroGS::Reset() { s_RTs.ResolveAll(); s_DepthRTs.ResolveAll(); - + vb[0].nCount = 0; vb[1].nCount = 0; @@ -1774,15 +1774,15 @@ void ZeroGS::ChangeDeviceSize(int nNewWidth, int nNewHeight) void ZeroGS::SetAA(int mode) { float f; - + // need to flush all targets s_RTs.ResolveAll(); s_RTs.Destroy(); s_DepthRTs.ResolveAll(); s_DepthRTs.Destroy(); - + s_AAx = s_AAy = 0; // This is code for x0, x2, x4, x8 and x16 anti-aliasing. - if (mode > 0) + if (mode > 0) { s_AAx = (mode+1) / 2; // ( 1, 0 ) ; ( 1, 1 ) ; ( 2, 1 ) ; ( 2, 2 ) -- it's used as binary shift, so x >> s_AAx, y >> s_AAy s_AAy = mode / 2; @@ -1793,7 +1793,7 @@ void ZeroGS::SetAA(int mode) vb[0].prndr = NULL; vb[0].pdepth = NULL; vb[0].bNeedFrameCheck = 1; vb[0].bNeedZCheck = 1; vb[1].prndr = NULL; vb[1].pdepth = NULL; vb[1].bNeedFrameCheck = 1; vb[1].bNeedZCheck = 1; - + f = mode > 0 ? 2.0f : 1.0f; glPointSize(f); } @@ -2029,7 +2029,7 @@ bool ZeroGS::LoadExtraEffects() // pvs[2*i+8] = pvs[2*i+8+1] = NULL; // } } - + LOAD_VS(SH_BITBLTVS, pvsBitBlt.prog); pvsBitBlt.sBitBltPos = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltPos"); pvsBitBlt.sBitBltTex = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltTex"); @@ -2056,7 +2056,7 @@ bool ZeroGS::LoadExtraEffects() LOAD_PS(SH_BITBLTDEPTHPS, ppsBitBltDepth); LOAD_PS(SH_CRTCTARGPS, ppsCRTCTarg[0]); LOAD_PS(SH_CRTCTARGINTERPS, ppsCRTCTarg[1]); - + g_bCRTCBilinear = TRUE; LOAD_PS(SH_CRTCPS, ppsCRTC[0]); if( !bLoadSuccess ) { @@ -2071,7 +2071,7 @@ bool ZeroGS::LoadExtraEffects() if( !bLoadSuccess ) ERROR_LOG("Failed to create CRTC shaders\n"); - + LOAD_PS(SH_CRTC24PS, ppsCRTC24[0]); LOAD_PS(SH_CRTC24INTERPS, ppsCRTC24[1]); LOAD_PS(SH_ZEROPS, ppsOne); @@ -2105,13 +2105,13 @@ FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int te texwrap = TEXWRAP_REPEAT_CLAMP; int index = GET_SHADER_INDEX(type, texfilter, texwrap, fog, s_bWriteDepth, testaem, exactcolor, context, 0); - + assert( index < ARRAY_SIZE(ppsTexture) ); FRAGMENTSHADER* pf = ppsTexture+index; - + if( pbFailed != NULL ) *pbFailed = false; - if( pf->prog != NULL ) + if( pf->prog != NULL ) return pf; if( (g_nPixelShaderVer & SHADER_ACCURATE) && mapShaderResources.find(index+NUM_SHADERS*SHADER_ACCURATE) != mapShaderResources.end() ) @@ -2144,7 +2144,7 @@ FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int te return NULL; } - + #else // ZEROGS_DEVBUILD #define LOAD_VS(name, prog, shaderver) { \ @@ -2254,7 +2254,7 @@ bool ZeroGS::LoadExtraEffects() LOAD_PS("BitBltDepthPS", ppsBitBltDepth, cgfProf); LOAD_PS("CRTCTargPS", ppsCRTCTarg[0], cgfProf); LOAD_PS("CRTCTargInterPS", ppsCRTCTarg[1], cgfProf); - + g_bCRTCBilinear = TRUE; LOAD_PS("CRTCPS", ppsCRTC[0], cgfProf); if( !bLoadSuccess ) { @@ -2269,7 +2269,7 @@ bool ZeroGS::LoadExtraEffects() if( !bLoadSuccess ) ERROR_LOG("Failed to create CRTC shaders\n"); - + LOAD_PS("CRTC24PS", ppsCRTC24[0], cgfProf); LOAD_PS("CRTC24InterPS", ppsCRTC24[1], cgfProf); LOAD_PS("ZeroPS", ppsOne, cgfProf); LOAD_PS("BaseTexturePS", ppsBaseTexture, cgfProf); @@ -2287,7 +2287,7 @@ bool ZeroGS::LoadExtraEffects() FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int testaem, int exactcolor, const clampInfo& clamp, int context, bool* pbFailed) { int texwrap; - + assert( texfilter < NUM_FILTERS ); //assert( g_nPixelShaderVer == SHADER_30 ); if( clamp.wms == clamp.wmt ) { @@ -2310,9 +2310,9 @@ FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int te FRAGMENTSHADER* pf = ppsTexture+index; - if( pf->prog != NULL ) + if( pf->prog != NULL ) return pf; - + pf->prog = LoadShaderFromType(EFFECT_DIR, EFFECT_NAME, type, texfilter, texwrap, fog, s_bWriteDepth, testaem, exactcolor, g_nPixelShaderVer, context); if( pf->prog != NULL ) { @@ -2456,13 +2456,13 @@ void ZeroGS::Flush(int context) PRIM_LOG("test: ate:%d, atst: %s, aref: %d, afail: %s, date: %d, datm: %d, zte: %d, ztst: %s, fba: %d\n", curvb.test.ate, patst[curvb.test.atst], curvb.test.aref, pafail[curvb.test.afail], curvb.test.date, curvb.test.datm, curvb.test.zte, pztst[curvb.test.ztst], curvb.fba.fba); PRIM_LOG("alpha: A%d B%d C%d D%d FIX:%d pabe: %d; aem: %d, ta0: %d, ta1: %d\n", curvb.alpha.a, curvb.alpha.b, curvb.alpha.c, curvb.alpha.d, curvb.alpha.fix, gs.pabe, gs.texa.aem, gs.texa.ta[0], gs.texa.ta[1]); - PRIM_LOG("tex0: tbp0=0x%x, tbw=%d, psm=0x%x, tw=%d, th=%d, tcc=%d, tfx=%d, cbp=0x%x, cpsm=0x%x, csm=%d, csa=%d, cld=%d\n", - curvb.tex0.tbp0, curvb.tex0.tbw, curvb.tex0.psm, curvb.tex0.tw, + PRIM_LOG("tex0: tbp0=0x%x, tbw=%d, psm=0x%x, tw=%d, th=%d, tcc=%d, tfx=%d, cbp=0x%x, cpsm=0x%x, csm=%d, csa=%d, cld=%d\n", + curvb.tex0.tbp0, curvb.tex0.tbw, curvb.tex0.psm, curvb.tex0.tw, curvb.tex0.th, curvb.tex0.tcc, curvb.tex0.tfx, curvb.tex0.cbp, curvb.tex0.cpsm, curvb.tex0.csm, curvb.tex0.csa, curvb.tex0.cld); PRIM_LOG("frame: %d\n\n", g_SaveFrameNum); #endif - + GL_REPORT_ERRORD(); CRenderTarget* ptextarg = NULL; @@ -2496,12 +2496,12 @@ void ZeroGS::Flush(int context) ptextarg = curvb.prndr; } } - + if( ptextarg != NULL && !(ptextarg->status&CRenderTarget::TS_NeedUpdate) ) { if( PSMT_ISCLUT(tpsm) && tpsm != PSMT8H ) { // handle 8h cluts // don't support clut targets, read from mem // 4hl - kh2 check - from dx version -- arcum42 - if( tpsm != PSMT4HL && tpsm != PSMT4HH && s_ClutResolve <= 1 ) + if( tpsm != PSMT4HL && tpsm != PSMT4HH && s_ClutResolve <= 1 ) { // xenosaga requires 2 resolves u32 prevcount = curvb.nCount; curvb.nCount = 0; @@ -2545,9 +2545,9 @@ void ZeroGS::Flush(int context) SetContextTarget(context); else { assert( curvb.pdepth != NULL ); - + if( curvb.pdepth->status & CRenderTarget::TS_Virtual) { - + if( !curvb.zbuf.zmsk ) { CRenderTarget* ptemp = s_DepthRTs.Promote(curvb.pdepth->fbp|(curvb.pdepth->fbw<<16)); assert( ptemp == curvb.pdepth ); @@ -2574,7 +2574,7 @@ void ZeroGS::Flush(int context) assert( !(curvb.prndr->status&CRenderTarget::TS_NeedUpdate) ); curvb.prndr->status = 0; - + if( curvb.pdepth != NULL ) { assert( !(curvb.pdepth->status&CRenderTarget::TS_NeedUpdate) ); if( !curvb.zbuf.zmsk ) { @@ -2636,7 +2636,7 @@ void ZeroGS::Flush(int context) glGenTextures(1, &ptexclut); glBindTexture(GL_TEXTURE_2D, ptexclut); vector data((curvb.tex0.cpsm&2) ? 512 : 1024); - + if( ptexclut != 0 ) { // fill the buffer by decoding the clut @@ -2680,7 +2680,7 @@ void ZeroGS::Flush(int context) glTexImage2D(GL_TEXTURE_2D, 0, 4, 256, 1, 0, GL_RGBA, (curvb.tex0.cpsm&2)?GL_UNSIGNED_SHORT_5_5_5_1:GL_UNSIGNED_BYTE, &data[0]); s_vecTempTextures.push_back(ptexclut); - + if( g_bSaveTex ) SaveTexture("clut.tga", GL_TEXTURE_2D, ptexclut, 256, 1); @@ -2752,14 +2752,14 @@ void ZeroGS::Flush(int context) glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); dwFilterOpts |= 1; } - + if( !curvb.tex1.mmin ) { if( curvb.tex1.mmag ) glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptexset); glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); dwFilterOpts |= 2; } - + Vector vTexDims; vTexDims.x = curvb.tex0.tw << s_AAx ; vTexDims.y = curvb.tex0.th << s_AAy ; @@ -2780,7 +2780,7 @@ void ZeroGS::Flush(int context) } if( shadertype == 4 ) vTexDims.z += 8.0f; - + cgGLSetParameter4fv(pfragment->fTexDims, vTexDims); @@ -2846,7 +2846,7 @@ void ZeroGS::Flush(int context) else { pfragment = &ppsRegular[curvb.curprim.fge+2*s_bWriteDepth]; } - + assert(pfragment != 0 ); if( curvb.curprim.tme ) { // have to enable the texture parameters @@ -3035,7 +3035,7 @@ void ZeroGS::Flush(int context) glAlphaFunc(g_dwReverseAlphaCmp[curtest.atst], b2XAlphaTest ? min(1.0f,(float)curtest.aref * (1/ 127.5f)) : curtest.aref*(1/255.0f)); if( curtest.afail & 1 ) { // front buffer update only - + if( curtest.afail == 3 ) // disable alpha glColorMask(1,1,1,0); @@ -3046,7 +3046,7 @@ void ZeroGS::Flush(int context) } else { // zbuffer update only - glColorMask(0,0,0,0); + glColorMask(0,0,0,0); } if( gs.pabe && bCanRenderStencil ) { @@ -3074,7 +3074,7 @@ void ZeroGS::Flush(int context) // Empty the command buffer and wait until the GPU is idle. // while(S_FALSE == pOcclusionQuery->GetData( &numberOfPixelsDrawn, sizeof(u32), D3DGETDATA_FLUSH )); // SAFE_RELEASE(pOcclusionQuery); - + if( gs.pabe ) { // only render the pixels with alpha values < 0x80 glDisable(GL_BLEND); @@ -3095,7 +3095,7 @@ void ZeroGS::Flush(int context) } // restore - + if( (curtest.afail & 1) && !curvb.zbuf.zmsk ) { glDepthMask(1); @@ -3184,7 +3184,7 @@ void ZeroGS::Flush(int context) glDisable(GL_DEPTH_TEST); glDepthMask(0); glColorMask(1,1,1,0); - + if( s_bWriteDepth ) { ResetRenderTarget(1); } @@ -3202,7 +3202,7 @@ void ZeroGS::Flush(int context) GL_BLENDEQ_RGB(GL_MAX_EXT); DRAW(); } - + // bios shows white screen if( bAlphaClamping & 2 ) { // max f = 1; @@ -3256,7 +3256,7 @@ void ZeroGS::ProcessMessages() if( listMsgs.size() > 0 ) { int left = 25, top = 15; list::iterator it = listMsgs.begin(); - + while( it != listMsgs.end() ) { DrawText(it->str, left+1, top+1, 0xff000000); DrawText(it->str, left, top, 0xffffff30); @@ -3342,7 +3342,7 @@ void ZeroGS::AdjustTransToAspect(Vector& v, int dispwidth, int dispheight) float f; if( dispwidth * nBackbufferHeight > dispheight * nBackbufferWidth) { // limited by width - + // change in ratio f = ((float)nBackbufferWidth / (float)dispwidth) / ((float)nBackbufferHeight / (float)dispheight); v.y *= f; @@ -3427,7 +3427,7 @@ void ZeroGS::RenderCRTC(int interlace) if( vb[0].prndr != NULL ) { SaveTexture("frame1.tga", GL_TEXTURE_RECTANGLE_NV, vb[0].prndr->ptex, vb[0].prndr->fbw<fbh<ptex, vb[1].prndr->fbw<fbh<MAGH+1; int magv = pd->MAGV+1; - + dispinfo[i].tbp0 = pfb->FBP << 5; dispinfo[i].tbw = pfb->FBW << 6; dispinfo[i].tw = (pd->DW + 1) / magh; @@ -3536,7 +3536,7 @@ void ZeroGS::RenderCRTC(int interlace) // interlace mode interlacetex = CreateInterlaceTex(2*texframe.th); - + if( interlace == (conf.interlace&1) ) { // pass if odd valpha.z = 1.0f; @@ -3603,7 +3603,7 @@ void ZeroGS::RenderCRTC(int interlace) glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); continue; } - + // first render the current render targets, then from ptexMem if( texframe.psm == 1 ) { valpha.x = 0; @@ -3623,7 +3623,7 @@ void ZeroGS::RenderCRTC(int interlace) s_RTs.GetTargs(start, end, listTargs); for(list::iterator it = listTargs.begin(); it != listTargs.end(); ) { - + CRenderTarget* ptarg = *it; if( ptarg->fbw == texframe.tbw && !(ptarg->status&CRenderTarget::TS_NeedUpdate) && ((256/bpp)*(texframe.tbp0-ptarg->fbp))%texframe.tbw == 0 ) { @@ -3689,7 +3689,7 @@ void ZeroGS::RenderCRTC(int interlace) v.y = dh/(float)texframe.th; v.z = 0; v.w = 1-v.y; - + if( movy > 0 ) v.w -= movy/(float)texframe.th; @@ -3738,7 +3738,7 @@ void ZeroGS::RenderCRTC(int interlace) } } } - + ++it; } @@ -3773,9 +3773,9 @@ void ZeroGS::RenderCRTC(int interlace) cgGLSetParameter4fv(pvsBitBlt.sBitBltTex, Vector(texframe.tw,texframe.th,-0.5f,-0.5f)); else cgGLSetParameter4fv(pvsBitBlt.sBitBltTex, Vector(1,1,-0.5f/(float)texframe.tw,-0.5f/(float)texframe.th)); - + cgGLSetParameter4fv(pvsBitBlt.fBitBltTrans, Vector(fih * 0.5f, fih * -0.5f, fih * 0.5f, fih * 0.5f)); - + // use g_fInvTexDims to store inverse texture dims if( ppsCRTC[bInterlace].sInvTexDims ) { v.x = 1.0f / (float)texframe.tw; @@ -3784,7 +3784,7 @@ void ZeroGS::RenderCRTC(int interlace) v.w = -0.5f * fih; cgGLSetParameter4fv(ppsCRTC[bInterlace].sInvTexDims, v); } - + if( interlacetex != 0 ) { cgGLSetTextureParameter(ppsCRTC[bInterlace].sInterlace, interlacetex); cgGLEnableTextureParameter(ppsCRTC[bInterlace].sInterlace); @@ -3819,7 +3819,7 @@ void ZeroGS::RenderCRTC(int interlace) } if (glGetError() != GL_NO_ERROR) DEBUG_LOG("glerror before swap!\n"); - + #ifdef _WIN32 static u32 lastswaptime = 0; @@ -3845,13 +3845,13 @@ void ZeroGS::RenderCRTC(int interlace) } if( g_bMakeSnapshot ) { - + if( SaveRenderTarget(strSnapshot != ""?strSnapshot.c_str():"temp.jpg", nBackbufferWidth, -nBackbufferHeight, 0)) {//(conf.options&GSOPTION_TGASNAP)?0:1) ) { char str[255]; sprintf(str, "saved %s\n", strSnapshot.c_str()); AddMessage(str, 500); } - + g_bMakeSnapshot = 0; } @@ -3953,7 +3953,7 @@ void ZeroGS::RenderCRTC(int interlace) ////////////////////////// -__forceinline void MOVZ(VertexGPU *p, u32 gsz, const VB& curvb) +__forceinline void MOVZ(VertexGPU *p, u32 gsz, const VB& curvb) { p->z = curvb.zprimmask==0xffff?min((u32)0xffff, gsz):gsz; } @@ -3963,33 +3963,33 @@ __forceinline void MOVFOG(VertexGPU *p, Vertex gsf) p->f = ((s16)(gsf).f<<7)|0x7f; } -void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) -{ - int index = Index; - +void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) +{ + int index = Index; + p->x = (((int)gs.gsvertex[index].x - curvb.offset.x)>>1)&0xffff; p->y = (((int)gs.gsvertex[index].y - curvb.offset.y)>>1)&0xffff; - + /*x = ((int)gs.gsvertex[index].x - curvb.offset.x); y = ((int)gs.gsvertex[index].y - curvb.offset.y); p.x = (x&0x7fff) | (x < 0 ? 0x8000 : 0); p.y = (y&0x7fff) | (y < 0 ? 0x8000 : 0);*/ - + p->f = ((s16)gs.gsvertex[index].f<<7)|0x7f; MOVZ(p, gs.gsvertex[index].z, curvb); p->rgba = prim->iip ? gs.gsvertex[index].rgba : gs.rgba; - + if ((g_GameSettings & GAME_TEXAHACK) && !(p->rgba&0xffffff)) p->rgba = 0; - if (prim->tme ) + if (prim->tme ) { - if( prim->fst ) + if( prim->fst ) { p->s = (float)gs.gsvertex[index].u * fiTexWidth[prim->ctxt]; p->t = (float)gs.gsvertex[index].v * fiTexHeight[prim->ctxt]; p->q = 1; } - else + else { p->s = gs.gsvertex[index].s; p->t = gs.gsvertex[index].t; @@ -4119,10 +4119,10 @@ void ZeroGS::KickTriangleFan() #endif } -void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb) +void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb) { - SET_VERTEX(p, next, curvb); - MOVZ(p, v.z, curvb); + SET_VERTEX(p, next, curvb); + MOVZ(p, v.z, curvb); MOVFOG(p, v); } @@ -4130,7 +4130,7 @@ void ZeroGS::KickSprite() { assert( gs.primC >= 2 ); VB& curvb = vb[prim->ctxt]; - + if (curvb.bNeedTexCheck) curvb.FlushTexData(); if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp)) @@ -4145,7 +4145,7 @@ void ZeroGS::KickSprite() int last = (gs.primIndex+2)%ARRAY_SIZE(gs.gsvertex); // sprite is too small and AA shows lines (tek4) - if ( s_AAx ) + if ( s_AAx ) { gs.gsvertex[last].x += 4; if( s_AAy ) gs.gsvertex[last].y += 4; @@ -4156,19 +4156,19 @@ void ZeroGS::KickSprite() //return; VertexGPU* p = curvb.pBufferData+curvb.nCount; - + SetKickVertex(&p[0], gs.gsvertex[last], next, curvb); SetKickVertex(&p[3], gs.gsvertex[last], next, curvb); SetKickVertex(&p[1], gs.gsvertex[last], last, curvb); SetKickVertex(&p[4], gs.gsvertex[last], last, curvb); SetKickVertex(&p[2], gs.gsvertex[last], next, curvb); - + p[2].s = p[1].s; p[2].x = p[1].x; SetKickVertex(&p[5], gs.gsvertex[last], last, curvb); p[5].s = p[0].s; - p[5].x = p[0].x; + p[5].x = p[0].x; curvb.nCount += 6; @@ -4207,17 +4207,17 @@ __forceinline void ZeroGS::RenderFBA(const VB& curvb, CGparameter sOneColor) if( !curvb.test.ate ) glDisable(GL_ALPHA_TEST); - else + else glAlphaFunc(g_dwAlphaCmp[curvb.test.atst], b2XAlphaTest ? min(1.0f,curvb.test.aref*(1/127.5f)) : curvb.test.aref*(1/255.0f)); // reset (not necessary) GL_COLORMASK(s_dwColorWrite); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - if( !curvb.zbuf.zmsk ) + if( !curvb.zbuf.zmsk ) { glDepthMask(1); - + assert( curvb.pdepth != NULL ); if( s_bWriteDepth ) curvb.pdepth->SetRenderTarget(1); } @@ -4245,8 +4245,8 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo s_stencilfunc = GL_ALWAYS; glEnable(GL_STENCIL_TEST); - - if( !s_bDestAlphaTest ) + + if( !s_bDestAlphaTest ) { // clear everything s_stencilref = 0; @@ -4259,7 +4259,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo glEnable(GL_ALPHA_TEST); } - if( curvb.test.ate && curvb.test.atst>1 && curvb.test.aref > 0x80) + if( curvb.test.ate && curvb.test.atst>1 && curvb.test.aref > 0x80) { v.x = 1; v.y = 1; v.z = 0; v.w = 0; cgGLSetParameter4fv(sOneColor, v); @@ -4270,7 +4270,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo glStencilMask(STENCIL_SPECIAL); GL_STENCILFUNC_SET(); glDisable(GL_DEPTH_TEST); - + DRAW(); if( curvb.test.zte ) @@ -4278,7 +4278,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo GL_ALPHATEST(0); GL_COLORMASK(s_dwColorWrite); - if( !curvb.zbuf.zmsk ) + if( !curvb.zbuf.zmsk ) { glDepthMask(1); @@ -4289,7 +4289,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo __forceinline void ZeroGS::RenderStencil(const VB& curvb, u32 dwUsingSpecialTesting) { - //NOTE: This stencil hack for dest alpha testing ONLY works when + //NOTE: This stencil hack for dest alpha testing ONLY works when // the geometry in one DrawPrimitive call does not overlap // mark the stencil buffer for the new data's bits (mark 4 if alpha is >= 0xff) @@ -4365,7 +4365,7 @@ __forceinline void ZeroGS::ProcessFBA(const VB& curvb, CGparameter sOneColor) glDisable(GL_DEPTH_TEST); glDepthMask(0); glColorMask(0,0,0,1); - + if( s_bWriteDepth ) { ResetRenderTarget(1); } @@ -4432,12 +4432,12 @@ inline void ZeroGS::SetContextTarget(int context) curvb.pdepth = (CDepthTarget*)s_DepthRTs.GetTarg(f, CRenderTargetMngr::TO_DepthBuffer|CRenderTargetMngr::TO_StrictHeight| (curvb.zbuf.zmsk?CRenderTargetMngr::TO_Virtual:0), GET_MAXHEIGHT(curvb.zbuf.zbp, curvb.gsfb.fbw, 0)); } - + assert( curvb.prndr != NULL && curvb.pdepth != NULL ); assert( curvb.pdepth->fbh == curvb.prndr->fbh ); if( curvb.pdepth->status & CRenderTarget::TS_Virtual) { - + if( !curvb.zbuf.zmsk ) { CRenderTarget* ptemp = s_DepthRTs.Promote(curvb.pdepth->fbp|(curvb.pdepth->fbw<<16)); assert( ptemp == curvb.pdepth ); @@ -4455,7 +4455,7 @@ inline void ZeroGS::SetContextTarget(int context) curvb.pdepth->Update(context, curvb.prndr); bSetTarg = 0; } - + GL_REPORT_ERRORD(); if( curvb.prndr->status & CRenderTarget::TS_NeedUpdate ) { @@ -4469,15 +4469,15 @@ inline void ZeroGS::SetContextTarget(int context) curvb.prndr->Update(context, curvb.pdepth); } - else { + else { //if( (vb[0].prndr != vb[1].prndr && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg ) curvb.prndr->SetRenderTarget(0); - //if( bSetTarg && ((vb[0].pdepth != vb[1].pdepth && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg) ) + //if( bSetTarg && ((vb[0].pdepth != vb[1].pdepth && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg) ) curvb.pdepth->SetDepthStencilSurface(); - + if (conf.mrtdepth && ZeroGS::IsWriteDepth()) curvb.pdepth->SetRenderTarget(1); - + if (s_ptexCurSet[0] == curvb.prndr->ptex) s_ptexCurSet[0] = 0; if (s_ptexCurSet[1] == curvb.prndr->ptex) s_ptexCurSet[1] = 0; @@ -4507,7 +4507,7 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment, int settexi Vector v, v2; tex0Info& tex0 = vb[context].tex0; - + float fw = (float)tex0.tw; float fh = (float)tex0.th; @@ -4518,7 +4518,7 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment, int settexi // if clut, use the frame format int psm = tex0.psm; if( PSMT_ISCLUT(tex0.psm) ) psm = tex0.cpsm; - + int nNeedAlpha = (psm == 1 || psm == 2 || psm == 10); Vector vblack; @@ -4529,26 +4529,26 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment, int settexi valpha.z = 0; valpha.w = 0; valpha2.x = 0; valpha2.y = 0; valpha2.z = 2; valpha2.w = 1; - + break; case 1: valpha.z = 0; valpha.w = 1; valpha2.x = 1; valpha2.y = 0; valpha2.z = 0; valpha2.w = 0; - + break; case 2: valpha.z = 1; valpha.w = 1.0f; valpha2.x = 0; valpha2.y = tex0.tcc ? 1.0f : 0.0f; - valpha2.z = 2; valpha2.w = 0; - + valpha2.z = 2; valpha2.w = 0; + break; case 3: valpha.z = 1; valpha.w = tex0.tcc ? 0.0f : 1.0f; valpha2.x = 0; valpha2.y = tex0.tcc ? 1.0f : 0.0f; valpha2.z = 2; valpha2.w = 0; - + break; } @@ -4562,7 +4562,7 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment, int settexi } if( nNeedAlpha ) { - + if( tex0.tfx == 0 ) { // make sure alpha is mult by two when the output is Cv = Ct*Cf valpha.x = 2*gs.texa.fta[0]; @@ -4691,7 +4691,7 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment, int settexi } } else { - SetTexVariablesInt(context, GetTexFilter(vb[context].tex1), tex0, pmemtarg, pfragment, s_bForceTexFlush); + SetTexVariablesInt(context, GetTexFilter(vb[context].tex1), tex0, pmemtarg, pfragment, s_bForceTexFlush); vb[context].bVarsTexSync = TRUE; INC_TEXVARS(); @@ -4721,7 +4721,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, if (pfragment->fRealTexDims) cgGLSetParameter4fv(pfragment->fRealTexDims, v); else - cgGLSetParameter4fv(cgGetNamedParameter(pfragment->prog,"g_fRealTexDims"),v); + cgGLSetParameter4fv(cgGetNamedParameter(pfragment->prog,"g_fRealTexDims"),v); } if( m_Blocks[tex0.psm].bpp == 0 ) { @@ -4752,7 +4752,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, float fpage = tex0.tbp0*(64.0f*g_fitexwidth) + 0.05f * g_fitexwidth; float fpageint = floorf(fpage); int starttbp = (int)fpage; - + // 2048 is number of words to span one page float fblockstride = (2048.0f /(float)(g_texwidth*BLOCK_TEXWIDTH)) * b.vTexDims.x * fbw; assert( fblockstride >= 1.0f ); @@ -4777,7 +4777,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, v.y = 1;//(float)1.0f / (float)((pmemtarg->realheight+pmemtarg->widthmult-1)/pmemtarg->widthmult); v.x = (fpageint-(float)pmemtarg->realy/(float)pmemtarg->widthmult+0.5f);//*v.y; - + // v.x *= (float)texheight; // v.y *= (float)texheight; v.z = (float)texwidth; @@ -4791,8 +4791,8 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, if( force ) s_ptexCurSet[context] = pmemtarg->ptex->tex; else s_ptexNextSet[context] = pmemtarg->ptex->tex; vb[context].pmemtarg = pmemtarg; - - vb[context].bVarsTexSync = FALSE; + + vb[context].bVarsTexSync = FALSE; } #define SET_ALPHA_COLOR_FACTOR(sign) \ { \ @@ -4862,13 +4862,13 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) vAlphaBlendColor = Vector(1,2*255.0f/256.0f,0,0); u32 usec = a.c; - if( a.a == a.b ) + if( a.a == a.b ) { // just d remains - if( a.d == 0 ) + if( a.d == 0 ) { alphaenable = false; } - else + else { s_dstrgb = a.d == 1 ? GL_ONE : GL_ZERO; s_srcrgb = GL_ZERO; @@ -4877,28 +4877,28 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) goto EndSetAlpha; } - else if( a.d == 2 ) + else if( a.d == 2 ) { // zero - if( a.a == 2 ) + if( a.a == 2 ) { // zero all color s_srcrgb = GL_ZERO; s_dstrgb = GL_ZERO; goto EndSetAlpha; } - else if( a.b == 2 ) + else if( a.b == 2 ) { //b2XAlphaTest = 1; SET_ALPHA_COLOR_FACTOR(1); - if( bDestAlphaColor == 2 ) + if( bDestAlphaColor == 2 ) { s_rgbeq = GL_FUNC_ADD; s_srcrgb = a.a == 0 ? GL_ONE : GL_ZERO; s_dstrgb = a.a == 0 ? GL_ZERO : GL_ONE; } - else + else { bAlphaClamping = 2; @@ -4913,14 +4913,14 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) // nothing is zero, so must do some real blending //b2XAlphaTest = 1; bAlphaClamping = 3; - + SET_ALPHA_COLOR_FACTOR(1); - + s_rgbeq = a.a == 0 ? GL_FUNC_SUBTRACT : GL_FUNC_REVERSE_SUBTRACT; s_srcrgb = bDestAlphaColor == 2 ? GL_ONE : blendalpha[usec]; s_dstrgb = bDestAlphaColor == 2 ? GL_ONE : blendalpha[usec]; } - else if( a.a == 2 ) + else if( a.a == 2 ) { // zero //b2XAlphaTest = 1; @@ -4928,32 +4928,32 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) SET_ALPHA_COLOR_FACTOR(1); - if( a.b == a.d ) + if( a.b == a.d ) { // can get away with 1-A s_rgbeq = GL_FUNC_ADD; s_srcrgb = (a.b == 0 && bDestAlphaColor != 2) ? blendinvalpha[usec] : GL_ZERO; s_dstrgb = (a.b == 0 || bDestAlphaColor == 2) ? GL_ZERO : blendinvalpha[usec]; } - else + else { s_rgbeq = a.b==0 ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_SUBTRACT; s_srcrgb = (a.b == 0 && bDestAlphaColor != 2) ? blendalpha[usec] : GL_ONE; s_dstrgb = (a.b == 0 || bDestAlphaColor == 2 ) ? GL_ONE : blendalpha[usec]; } } - else if( a.b == 2 ) + else if( a.b == 2 ) { bAlphaClamping = 2; // max testing SET_ALPHA_COLOR_FACTOR(a.a!=a.d); - if( a.a == a.d ) + if( a.a == a.d ) { // can get away with 1+A, but need to set alpha to negative s_rgbeq = GL_FUNC_ADD; - if( bDestAlphaColor == 2 ) + if( bDestAlphaColor == 2 ) { assert(usec==1); @@ -4965,13 +4965,13 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_srcrgb = (a.a == 0) ? GL_ONE_MINUS_SRC_ALPHA : GL_ZERO; s_dstrgb = (a.a == 0) ? GL_ZERO : GL_ONE_MINUS_SRC_ALPHA; } - else + else { s_srcrgb = a.a == 0 ? blendinvalpha[usec] : GL_ZERO; s_dstrgb = a.a == 0 ? GL_ZERO : blendinvalpha[usec]; } } - else + else { //b2XAlphaTest = 1; s_rgbeq = GL_FUNC_ADD; @@ -4979,18 +4979,18 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_dstrgb = (a.a == 0 || bDestAlphaColor == 2) ? GL_ONE : blendalpha[usec]; } } - else + else { // all 3 components are valid! bAlphaClamping = 3; // all testing SET_ALPHA_COLOR_FACTOR(a.a!=a.d); - if( a.a == a.d ) + if( a.a == a.d ) { // can get away with 1+A, but need to set alpha to negative s_rgbeq = GL_FUNC_ADD; - if( bDestAlphaColor == 2 ) + if( bDestAlphaColor == 2 ) { assert(usec==1); @@ -5001,7 +5001,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_srcrgb = a.a == 0 ? GL_ONE_MINUS_SRC_ALPHA : GL_SRC_ALPHA; s_dstrgb = a.a == 0 ? GL_SRC_ALPHA : GL_ONE_MINUS_SRC_ALPHA; } - else + else { s_srcrgb = a.a == 0 ? blendinvalpha[usec] : blendalpha[usec]; s_dstrgb = a.a == 0 ? blendalpha[usec] : blendinvalpha[usec]; @@ -5012,7 +5012,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) assert(a.b == a.d); s_rgbeq = GL_FUNC_ADD; - if( bDestAlphaColor == 2 ) + if( bDestAlphaColor == 2 ) { assert(usec==1); @@ -5023,7 +5023,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_srcrgb = a.a != 0 ? GL_ONE_MINUS_SRC_ALPHA : GL_SRC_ALPHA; s_dstrgb = a.a != 0 ? GL_SRC_ALPHA : GL_ONE_MINUS_SRC_ALPHA; } - else + else { //b2XAlphaTest = 1; s_srcrgb = a.a != 0 ? blendinvalpha[usec] : blendalpha[usec]; @@ -5037,9 +5037,9 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) GL_BLEND_SET(); zgsBlendEquationSeparateEXT(s_rgbeq, s_alphaeq); - if( alphaenable ) + if( alphaenable ) glEnable(GL_BLEND); // always set - else + else glDisable(GL_BLEND); INC_ALPHAVARS(); @@ -5113,7 +5113,7 @@ bool ZeroGS::CheckChangeInClut(u32 highdword, u32 psm) { int cld = (highdword >> 29) & 0x7; int cbp = ((highdword >> 5) & 0x3fff); - + // processing the CLUT after tex0/2 are written switch(cld) { case 0: return false; @@ -5128,7 +5128,7 @@ bool ZeroGS::CheckChangeInClut(u32 highdword, u32 psm) int cpsm = (highdword >> 19) & 0xe; int csm = (highdword >> 23) & 0x1; - + if( cpsm > 1 || csm ) // don't support 16bit for now return true; @@ -5176,7 +5176,7 @@ Start: movq mm7, [edx+56] pcmpeqd mm6, [ecx+40] pcmpeqd mm7, [ecx+56] - + pand mm0, mm4 pand mm6, mm7 pand mm0, mm6 @@ -5193,11 +5193,11 @@ Continue: test ebx, 0x10 jz AddEcx - sub ecx, 448 // go back and down one column, + sub ecx, 448 // go back and down one column, AddEcx: add ecx, 256 // go to the right block - + jne Continue1 add ecx, 256 // skip whole block Continue1: @@ -5303,7 +5303,7 @@ void ZeroGS::texClutWrite(int ctx) int entries = (tex0.psm & 3)==3 ? 256 : 16; - if (tex0.csm) + if (tex0.csm) { switch (tex0.cpsm) { @@ -5314,33 +5314,33 @@ void ZeroGS::texClutWrite(int ctx) u16* src = (u16*)g_pbyGSMemory + tex0.cbp*128; u16 *dst = (u16*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0)); - for (int i = 0; i < entries; ++i) + for (int i = 0; i < entries; ++i) { *dst = src[getPixelAddress16_0(gs.clut.cou+i, gs.clut.cov, gs.clut.cbw)]; dst += 2; - + // check for wrapping if (((u32)(uptr)dst & 0x3ff) == 0) dst = (u16*)(g_pbyGSClut+2); } break; } - + case PSMCT16S: { u16* src = (u16*)g_pbyGSMemory + tex0.cbp*128; u16 *dst = (u16*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0)); - for (int i = 0; i < entries; ++i) + for (int i = 0; i < entries; ++i) { *dst = src[getPixelAddress16S_0(gs.clut.cou+i, gs.clut.cov, gs.clut.cbw)]; dst += 2; - + // check for wrapping if (((u32)(uptr)dst & 0x3ff) == 0) dst = (u16*)(g_pbyGSClut+2); } break; } - + case PSMCT32: case PSMCT24: { @@ -5348,17 +5348,17 @@ void ZeroGS::texClutWrite(int ctx) u32 *dst = (u32*)(g_pbyGSClut+64*tex0.csa); // check if address exceeds src - if( src+getPixelAddress32_0(gs.clut.cou+entries-1, gs.clut.cov, gs.clut.cbw) >= (u32*)g_pbyGSMemory + 0x00100000 ) + if( src+getPixelAddress32_0(gs.clut.cou+entries-1, gs.clut.cov, gs.clut.cbw) >= (u32*)g_pbyGSMemory + 0x00100000 ) ERROR_LOG("texClutWrite out of bounds\n"); - else - for(int i = 0; i < entries; ++i) + else + for(int i = 0; i < entries; ++i) { *dst = src[getPixelAddress32_0(gs.clut.cou+i, gs.clut.cov, gs.clut.cbw)]; dst++; } break; } - + default: { #ifdef ZEROGS_DEVBUILD @@ -5368,7 +5368,7 @@ void ZeroGS::texClutWrite(int ctx) } } } - else + else { switch (tex0.cpsm) { @@ -5376,17 +5376,17 @@ void ZeroGS::texClutWrite(int ctx) case PSMCT32: if( entries == 16 ) WriteCLUT_T32_I4_CSM1((u32*)(g_pbyGSMemory + tex0.cbp*256), (u32*)(g_pbyGSClut+64*tex0.csa)); - else + else WriteCLUT_T32_I8_CSM1((u32*)(g_pbyGSMemory + tex0.cbp*256), (u32*)(g_pbyGSClut+64*tex0.csa)); break; - + default: if( entries == 16 ) WriteCLUT_T16_I4_CSM1((u32*)(g_pbyGSMemory + 256 * tex0.cbp), (u32*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0))); else // sse2 for 256 is more complicated, so use regular WriteCLUT_T16_I8_CSM1_c((u32*)(g_pbyGSMemory + 256 * tex0.cbp), (u32*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0))); break; - + } } } @@ -5400,7 +5400,7 @@ void ZeroGS::SetTexFlush() // if( PSMT_ISCLUT(vb[1].tex0.psm) ) // texClutWrite(1); - if( !s_bForceTexFlush ) + if( !s_bForceTexFlush ) { if (s_ptexCurSet[0] != s_ptexNextSet[0]) s_ptexCurSet[0] = s_ptexNextSet[0]; if (s_ptexCurSet[1] != s_ptexNextSet[1]) s_ptexCurSet[1] = s_ptexNextSet[1]; @@ -5414,7 +5414,7 @@ int ZeroGS::Save(char* pbydata) s_RTs.ResolveAll(); s_DepthRTs.ResolveAll(); - + strcpy(pbydata, libraryName); *(u32*)(pbydata+16) = ZEROGS_SAVEVER; pbydata += 32; @@ -5462,7 +5462,7 @@ bool ZeroGS::Load(char* pbydata) int context = *(int*)pbydata; pbydata += 4; u32 savelimit = VBSAVELIMIT; - + savelimit = *(u32*)pbydata; pbydata += 4; memcpy(g_pbyGSMemory, pbydata, 0x00400000); @@ -5498,13 +5498,13 @@ bool ZeroGS::Load(char* pbydata) for(int i = 0; i < 2; ++i) { vb[i].Init(VB_BUFFERSIZE); vb[i].bNeedZCheck = vb[i].bNeedFrameCheck = 1; - + vb[i].bSyncVars = 0; vb[i].bNeedTexCheck = 1; memset(vb[i].uCurTex0Data, 0, sizeof(vb[i].uCurTex0Data)); } icurctx = -1; - + glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, s_uFramebuffer ); // switch to the backbuffer SetFogColor(gs.fogcol); @@ -5541,7 +5541,7 @@ bool ZeroGS::SaveRenderTarget(const char* filename, int width, int height, int j } if( jpeg ) return SaveJPEG(filename, width, height, &data[0], 70); - + return SaveTGA(filename, width, height, &data[0]); } @@ -5571,7 +5571,7 @@ bool ZeroGS::SaveJPEG(const char* filename, int image_width, int image_height, c { u8* image_buffer = new u8[image_width * image_height * 3]; u8* psrc = (u8*)pdata; - + // input data is rgba format, so convert to rgb u8* p = image_buffer; for(int i = 0; i < image_height; ++i) { @@ -5711,9 +5711,9 @@ struct TGA_HEADER s16 height; // image height in pixels u8 bits; // image bits per pixel 8,16,24,32 u8 descriptor; // image descriptor bits (vh flip bits) - + // pixel data follows header - + #if defined(_MSC_VER) }; #pragma pack(pop) @@ -5729,7 +5729,7 @@ bool ZeroGS::SaveTGA(const char* filename, int width, int height, void* pdata) return false; assert( sizeof(TGA_HEADER) == 18 && sizeof(hdr) == 18 ); - + memset(&hdr, 0, sizeof(hdr)); hdr.imagetype = 2; hdr.bits = 32; diff --git a/plugins/zerogs/opengl/zerogs.h b/plugins/zerogs/opengl/zerogs.h index c7f369a2bc..d208ef0c21 100644 --- a/plugins/zerogs/opengl/zerogs.h +++ b/plugins/zerogs/opengl/zerogs.h @@ -119,7 +119,7 @@ static __forceinline const char *error_name(int err) ERROR_LOG("%s:%d: gl error %s\n", __FILE__, (int)__LINE__, error_name(myGLerror)); \ } \ }\ - + #define GL_REPORT_ERROR() \ { \ err = glGetError(); \ @@ -129,7 +129,7 @@ static __forceinline const char *error_name(int err) ZeroGS::HandleGLError(); \ } \ } - + #ifdef _DEBUG #define GL_REPORT_ERRORD() \ { \ @@ -183,7 +183,7 @@ struct FRAGMENTSHADER FRAGMENTSHADER() : prog(0), sMemory(0), sFinal(0), sBitwiseANDX(0), sBitwiseANDY(0), sInterlace(0), sCLUT(0), sOneColor(0), sBitBltZ(0), fTexAlpha2(0), fTexOffset(0), fTexDims(0), fTexBlock(0), fClampExts(0), fTexWrapMode(0), fRealTexDims(0), fTestBlack(0), fPageOffset(0), fTexAlpha(0) {} - + CGprogram prog; CGparameter sMemory, sFinal, sBitwiseANDX, sBitwiseANDY, sCLUT, sInterlace; CGparameter sOneColor, sBitBltZ, sInvTexDims; @@ -237,64 +237,64 @@ extern u8* g_pbyGSClut; // the temporary clut buffer extern CGparameter g_vparamPosXY[2], g_fparamFogColor; namespace ZeroGS { - + typedef void (*DrawFn)(); - + enum RenderFormatType { RFT_byte8 = 0, // A8R8G8B8 RFT_float16 = 1, // A32R32B32G32 }; - + // managers render-to-texture targets class CRenderTarget { public: CRenderTarget(); virtual ~CRenderTarget(); - + virtual bool Create(const frameInfo& frame); virtual void Destroy(); - + // set the GPU_POSXY variable, scissor rect, and current render target void SetTarget(int fbplocal, const Rect2& scissor, int context); void SetViewport(); - + // copies/creates the feedback contents inline void CreateFeedback() { if( ptexFeedback == 0 || !(status&TS_FeedbackReady) ) _CreateFeedback(); } - + virtual void Resolve(); virtual void Resolve(int startrange, int endrange); // resolves only in the allowed range virtual void Update(int context, CRenderTarget* pdepth); virtual void ConvertTo32(); // converts a psm==2 target, to a psm==0 virtual void ConvertTo16(); // converts a psm==0 target, to a psm==2 - + virtual bool IsDepth() { return false; } void SetRenderTarget(int targ); - + void* psys; // system data used for comparison u32 ptex; - + int fbp, fbw, fbh; // if fbp is negative, virtual target (not mapped to any real addr) int start, end; // in bytes u32 lastused; // time stamp since last used Vector vposxy; - + u32 fbm; u16 status; u8 psm; u8 resv0; Rect scissorrect; - + //int startresolve, endresolve; u32 nUpdateTarg; // use this target to update the texture if non 0 (one time only) - + // this is optionally used when feedback effects are used (render target is used as a texture when rendering to itself) u32 ptexFeedback; - + enum TargetStatus { TS_Resolved = 1, TS_NeedUpdate = 2, @@ -303,34 +303,34 @@ namespace ZeroGS { TS_NeedConvert32 = 16, TS_NeedConvert16 = 32, }; - + private: void _CreateFeedback(); }; - + // manages zbuffers class CDepthTarget : public CRenderTarget { public: CDepthTarget(); virtual ~CDepthTarget(); - + virtual bool Create(const frameInfo& frame); virtual void Destroy(); - + virtual void Resolve(); virtual void Resolve(int startrange, int endrange); // resolves only in the allowed range virtual void Update(int context, CRenderTarget* prndr); - + virtual bool IsDepth() { return true; } - + void SetDepthStencilSurface(); - + u32 pdepth; // 24 bit, will contain the stencil buffer if possible u32 pstencil; // if not 0, contains the stencil buffer int icount; // internal counter }; - + // manages contiguous chunks of memory (width is always 1024) class CMemoryTarget { @@ -343,9 +343,9 @@ namespace ZeroGS { int ref; u8* memptr; // GPU memory used for comparison }; - + inline CMemoryTarget() : ptex(NULL), starty(0), height(0), realy(0), realheight(0), usedstamp(0), psm(0), channels(0),cpsm(0), clearminy(0), clearmaxy(0), validatecount(0) {} - + inline CMemoryTarget(const CMemoryTarget& r) { ptex = r.ptex; if( ptex != NULL ) ptex->ref++; @@ -364,25 +364,25 @@ namespace ZeroGS { validatecount = r.validatecount; fmt = r.fmt; } - + ~CMemoryTarget() { Destroy(); } - + inline void Destroy() { if( ptex != NULL && ptex->ref > 0 ) { if( --ptex->ref <= 0 ) delete ptex; } - + ptex = NULL; } - + // returns true if clut data is synced bool ValidateClut(const tex0Info& tex0); // returns true if tex data is synced bool ValidateTex(const tex0Info& tex0, int starttex, int endtex, bool bDeleteBadTex); - + int clearminy, clearmaxy; // when maxy > 0, need to check for clearing - + // realy is offset in pixels from start of valid region // so texture in memory is [realy,starty+height] // valid texture is [starty,starty+height] @@ -392,27 +392,27 @@ namespace ZeroGS { u32 usedstamp; TEXTURE* ptex; // can be 16bit u32 fmt; - + int widthmult; int channels; - + int validatecount; // count how many times has been validated, if too many, destroy - + vector clut; // if nonzero, texture uses CLUT u8 psm, cpsm; // texture and clut format. For psm, only 16bit/32bit differentiation matters }; - - + + struct VB { VB(); ~VB(); - + void Destroy(); - + __forceinline bool CheckPrim(); void CheckFrame(int tbp); - + // context specific state Point offset; Rect2 scissor; @@ -425,10 +425,10 @@ namespace ZeroGS { clampInfo clamp; pixTest test; u32 ptexClamp[2]; // textures for x and y dir region clamping - + public: void FlushTexData(); - + // notify VB that nVerts need to be written to pbuf inline void NotifyWrite(int nVerts) { assert( pBufferData != NULL && nCount <= nNumVertices && nVerts > 0 ); @@ -444,7 +444,7 @@ namespace ZeroGS { } } - void Init(int nVerts) { + void Init(int nVerts) { if( pBufferData == NULL && nVerts > 0 ) { pBufferData = (VertexGPU*)_aligned_malloc(sizeof(VertexGPU)*nVerts, 256); nNumVertices = nVerts; @@ -457,7 +457,7 @@ namespace ZeroGS { u8 bNeedZCheck; u8 bNeedTexCheck; u8 dummy0; - + union { struct { u8 bTexConstsSync; // only pixel shader constants that context owns @@ -467,21 +467,21 @@ namespace ZeroGS { }; u32 bSyncVars; }; - + int ictx; VertexGPU* pBufferData; // current allocated data int nNumVertices; // size of pBufferData in terms of VertexGPU objects int nCount; primInfo curprim; // the previous prim the current buffers are set to - + zbufInfo zbuf; frameInfo gsfb; // the real info set by FRAME cmd frameInfo frame; int zprimmask; // zmask for incoming points u32 uCurTex0Data[2]; // current tex0 data - u32 uNextTex0Data[2]; // tex0 data that has to be applied if bNeedTexCheck is 1 + u32 uNextTex0Data[2]; // tex0 data that has to be applied if bNeedTexCheck is 1 //int nFrameHeights[8]; // frame heights for the past frame changes int nNextFrameHeight; @@ -492,7 +492,7 @@ namespace ZeroGS { }; // visible members - extern DrawFn drawfn[8]; + extern DrawFn drawfn[8]; extern VB vb[2]; extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height @@ -570,7 +570,7 @@ namespace ZeroGS { void FlushSysMem(const RECT* prc); void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm); - // returns the first and last addresses aligned to a page that cover + // returns the first and last addresses aligned to a page that cover void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw); // inits the smallest rectangle in ptexMem that covers this region in ptexMem diff --git a/plugins/zerogs/opengl/zerogsmath.h b/plugins/zerogs/opengl/zerogsmath.h index 83481ffb5b..dbfef2085b 100644 --- a/plugins/zerogs/opengl/zerogsmath.h +++ b/plugins/zerogs/opengl/zerogsmath.h @@ -76,7 +76,7 @@ public: inline Vector& operator += (const Vector& r) { x += r.x; y += r.y; z += r.z; w += r.w; return *this; } inline Vector& operator -= (const Vector& r) { x -= r.x; y -= r.y; z -= r.z; w -= r.w; return *this; } inline Vector& operator *= (const Vector& r) { x *= r.x; y *= r.y; z *= r.z; w *= r.w; return *this; } - + inline Vector& operator *= (const dReal k) { x *= k; y *= k; z *= k; w *= k; return *this; } inline Vector& operator /= (const dReal _k) { dReal k=1/_k; x *= k; y *= k; z *= k; w *= k; return *this; } @@ -115,7 +115,7 @@ struct TRIANGLE const Vector& operator[](int i) const { return (&v1)[i]; } Vector& operator[](int i) { return (&v1)[i]; } - /// assumes CCW ordering of vertices + /// assumes CCW ordering of vertices inline Vector ComputeNormal() { Vector normal; cross3(normal, v2-v1, v3-v1); @@ -200,7 +200,7 @@ inline T* multtrans(T* pf1, R* pf2, int r1, int c1, int c2, S* pfres, bool badd template inline T* multtrans_to2(T* pf1, R* pf2, int r1, int c1, int r2, S* pfres, bool badd = false); -// multiplies rxc matrix pf1 and cxc matrix pf2 and stores the result in pf1, +// multiplies rxc matrix pf1 and cxc matrix pf2 and stores the result in pf1, // the function needs a temporary buffer the size of c doubles, if pftemp == NULL, // the function will allocate the necessary memory, otherwise pftemp should be big // enough to store all the entries @@ -242,7 +242,7 @@ bool eig2(const dReal* pfmat, dReal* peigs, dReal& fv1x, dReal& fv1y, dReal& fv2 fv2x = -fv1y; fv2y = fv1x; return true; } - + // two roots d = sqrtf(d); a = -0.5f * (b + d); @@ -290,7 +290,7 @@ template inline T* _mult3(T* pfres, const T* pf1, const T* pf2) inline dReal* mult3(dReal* pfres, const dReal* pf1, const dReal* pf2) { return _mult3(pfres, pf1, pf2); } inline double* mult3(double* pfres, const double* pf1, const double* pf2) { return _mult3(pfres, pf1, pf2); } -template +template inline T* _mult4(T* pfres, const T* p1, const T* p2) { assert( pfres != NULL && p1 != NULL && p2 != NULL ); @@ -326,7 +326,7 @@ inline T* _mult4(T* pfres, const T* p1, const T* p2) inline dReal* mult4(dReal* pfres, const dReal* pf1, const dReal* pf2) { return _mult4(pfres, pf1, pf2); } inline double* mult4(double* pfres, const double* pf1, const double* pf2) { return _mult4(pfres, pf1, pf2); } -template +template inline T* _multtrans3(T* pfres, const T* pf1, const T* pf2) { T* pfres2; @@ -350,7 +350,7 @@ inline T* _multtrans3(T* pfres, const T* pf1, const T* pf2) return pfres; } -template +template inline T* _multtrans4(T* pfres, const T* pf1, const T* pf2) { T* pfres2; @@ -737,7 +737,7 @@ template inline T* multto1(T* pf1, T* pf2, int r, int c, T* pftemp) int j, k; bool bdel = false; - + if( pftemp == NULL ) { pftemp = new T[c]; bdel = true; @@ -748,7 +748,7 @@ template inline T* multto1(T* pf1, T* pf2, int r, int c, T* pftemp) j = 0; while(j < c) { - + pftemp[j] = 0.0; k = 0; @@ -774,7 +774,7 @@ template inline T* multto2(T* pf1, S* pf2, int r2, int c2, S* int i, j, k; bool bdel = false; - + if( pftemp == NULL ) { pftemp = new S[r2]; bdel = true; @@ -785,7 +785,7 @@ template inline T* multto2(T* pf1, S* pf2, int r2, int c2, S* while(j < c2) { i = 0; while(i < r2) { - + pftemp[i] = 0.0; k = 0; diff --git a/plugins/zerogs/opengl/zpipe.cpp b/plugins/zerogs/opengl/zpipe.cpp index 703ab487b8..15eb93f16a 100644 --- a/plugins/zerogs/opengl/zpipe.cpp +++ b/plugins/zerogs/opengl/zpipe.cpp @@ -34,10 +34,10 @@ int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed strm.next_in = (Bytef *)src ; strm.next_out = (Bytef *)dst ; - ret = deflate(&strm, Z_FINISH) ; + ret = deflate(&strm, Z_FINISH) ; have = bytes_to_compress - strm.avail_out ; *bytes_after_compressed = have ; - + assert(ret == Z_STREAM_END); /* stream will be complete */ /* clean up and return */ @@ -45,7 +45,7 @@ int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed return Z_OK; } -int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes) +int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes) { z_stream strm; @@ -78,7 +78,7 @@ int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompr (void)inflateEnd(&strm); return ret; } - + assert(strm.avail_in == 0); /* all input will be used */ if( outbytes != NULL ) diff --git a/plugins/zeropad/Linux/gui.cpp b/plugins/zeropad/Linux/gui.cpp index b7b6bccfb2..ad063f869d 100644 --- a/plugins/zeropad/Linux/gui.cpp +++ b/plugins/zeropad/Linux/gui.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include #include #include @@ -134,55 +134,55 @@ void on_joydevicescombo_changed(GtkComboBox *combobox, gpointer user_data) void on_checkbutton_reverselx_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTLX << (16 * s_selectedpad); - + if (gtk_toggle_button_get_active(togglebutton)) conf.options |= mask; - else + else conf.options &= ~mask; } void on_checkbutton_reversely_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTLY << (16 * s_selectedpad); - + if (gtk_toggle_button_get_active(togglebutton)) conf.options |= mask; - else + else conf.options &= ~mask; } void on_checkbutton_reverserx_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTRX << (16 * s_selectedpad); - if (gtk_toggle_button_get_active(togglebutton)) + if (gtk_toggle_button_get_active(togglebutton)) conf.options |= mask; - else + else conf.options &= ~mask; } void on_checkbutton_reversery_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTRY << (16 * s_selectedpad); - - if (gtk_toggle_button_get_active(togglebutton)) + + if (gtk_toggle_button_get_active(togglebutton)) conf.options |= mask; - else + else conf.options &= ~mask; } void on_forcefeedback_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTLX << (16 * s_selectedpad); - + if (gtk_toggle_button_get_active(togglebutton)) { conf.options |= mask; int joyid = gtk_combo_box_get_active(GTK_COMBO_BOX(s_devicecombo)); - + if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) s_vjoysticks[joyid]->TestForce(); } - else + else { conf.options &= ~mask; } @@ -284,4 +284,4 @@ void CALLBACK PADabout() s32 CALLBACK PADtest() { return 0; -} \ No newline at end of file +} diff --git a/plugins/zeropad/Linux/linux.cpp b/plugins/zeropad/Linux/linux.cpp index 1cbe3ab0d6..bef5c72d40 100644 --- a/plugins/zeropad/Linux/linux.cpp +++ b/plugins/zeropad/Linux/linux.cpp @@ -20,8 +20,8 @@ Display *GSdsp; -static const char* s_pGuiKeyMap[] = -{ +static const char* s_pGuiKeyMap[] = +{ "L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square", "Select", "L3", "R3", "Start", @@ -51,14 +51,14 @@ void _PADclose() SetAutoRepeat(true); vector::iterator it = s_vjoysticks.begin(); - + // Delete everything in the vector vjoysticks. while (it != s_vjoysticks.end()) { delete *it; it ++; } - + s_vjoysticks.clear(); } @@ -66,13 +66,13 @@ int _GetJoystickIdFromPAD(int pad) { // select the right joystick id int joyid = -1; - + for (int p = 0; p < PADSUBKEYS; p++) { for (int i = 0; i < PADKEYS; ++i) { u32 temp = conf.keys[(PadEnum[pad][p])][i]; - + if (IS_JOYSTICK( temp) || IS_JOYBUTTONS(temp)) { joyid = PAD_GETJOYID(temp); @@ -80,7 +80,7 @@ int _GetJoystickIdFromPAD(int pad) } } } - + if (!JoystickIdWithinBounds(joyid)) { // get first unused joystick @@ -89,7 +89,7 @@ int _GetJoystickIdFromPAD(int pad) if (s_vjoysticks[joyid]->GetPAD() < 0) break; } } - + return joyid; } @@ -100,20 +100,20 @@ void CALLBACK PADupdate(int pad) // joystick info SDL_JoystickUpdate(); - + for (int i = 0; i < PADKEYS; i++) { int key = conf.keys[PadEnum[pad][0]][i]; - + if (JoystickIdWithinBounds(PAD_GETJOYID(key))) - { + { JoystickInfo* pjoy = s_vjoysticks[PAD_GETJOYID(key)]; int pad = (pjoy)->GetPAD(); - + if (IS_JOYBUTTONS(key)) { int value = SDL_JoystickGetButton((pjoy)->GetJoy(), PAD_GETJOYBUTTON(key)); - + if (value) clear_bit(status[pad], i); // released else @@ -122,7 +122,7 @@ void CALLBACK PADupdate(int pad) else if (IS_JOYSTICK(key)) { int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), PAD_GETJOYSTICK_AXIS(key)); - + switch (i) { case PAD_LX: @@ -131,7 +131,7 @@ void CALLBACK PADupdate(int pad) case PAD_RY: if (abs(value) > (pjoy)->GetDeadzone(value)) Analog::ConfigurePad(i, pad, value); - else + else Analog::ResetPad(i, pad); break; } @@ -140,7 +140,7 @@ void CALLBACK PADupdate(int pad) else if (IS_HAT(key)) { int value = SDL_JoystickGetHat((pjoy)->GetJoy(), PAD_GETJOYSTICK_AXIS(key)); - + //PAD_LOG("Hat = %d for key %d\n", PAD_GETPOVDIR(key), key); if ((value != SDL_HAT_CENTERED) && (PAD_GETHATDIR(key) == value)) { @@ -163,7 +163,7 @@ void CALLBACK PADupdate(int pad) else if (IS_POV(key)) { int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), PAD_GETJOYSTICK_AXIS(key)); - + if (PAD_GETPOVSIGN(key) && (value < -2048)) clear_bit(status[pad], i); else if (!PAD_GETPOVSIGN(key) && (value > 2048)) @@ -194,7 +194,7 @@ void UpdateConf(int pad) PAD_LOG("ZeroPAD: cannot find key %s\n", s_pGuiKeyMap[i]); continue; } - + if (IS_KEYBOARD(conf.keys[pad][i])) { char* pstr = KeysymToChar(PAD_GETKEY(conf.keys[pad][i])); @@ -204,14 +204,14 @@ void UpdateConf(int pad) { int button = PAD_GETJOYBUTTON(conf.keys[pad][i]); tmp.resize(28); - + sprintf(&tmp[0], "JBut %d", button); } else if (IS_JOYSTICK(conf.keys[pad][i])) { int axis = PAD_GETJOYSTICK_AXIS(conf.keys[pad][i]); tmp.resize(28); - + sprintf(&tmp[0], "JAxis %d", axis); } #ifdef EXPERIMENTAL_POV_CODE @@ -219,21 +219,21 @@ void UpdateConf(int pad) { int axis = PAD_GETJOYSTICK_AXIS(conf.keys[pad][i]); tmp.resize(28); - + switch(PAD_GETHATDIR(conf.keys[pad][i])) { case SDL_HAT_UP: sprintf(&tmp[0], "JPOVU-%d", axis); break; - + case SDL_HAT_RIGHT: sprintf(&tmp[0], "JPOVR-%d", axis); break; - + case SDL_HAT_DOWN: sprintf(&tmp[0], "JPOVD-%d", axis); break; - + case SDL_HAT_LEFT: sprintf(&tmp[0], "JPOVL-%d", axis); break; @@ -261,11 +261,11 @@ void UpdateConf(int pad) if (JoystickIdWithinBounds(joyid)) gtk_combo_box_set_active(GTK_COMBO_BOX(s_devicecombo), joyid); // select the combo - else + else gtk_combo_box_set_active(GTK_COMBO_BOX(s_devicecombo), s_vjoysticks.size()); // no gamepad int padopts = conf.options >> (16 * pad); - + set_checked(Conf, "checkbutton_reverselx", padopts & PADOPTION_REVERTLX); set_checked(Conf, "checkbutton_reversely", padopts & PADOPTION_REVERTLY); set_checked(Conf, "checkbutton_reverserx", padopts & PADOPTION_REVERTRX); @@ -288,7 +288,7 @@ int GetLabelId(GtkWidget *label) return -1; } - return (int)(uptr)gtk_object_get_user_data(GTK_OBJECT(label)); + return (int)(uptr)gtk_object_get_user_data(GTK_OBJECT(label)); } void OnConf_Key(GtkButton *button, gpointer user_data) @@ -297,37 +297,37 @@ void OnConf_Key(GtkButton *button, gpointer user_data) bool captured = false; char str[32]; int id = GetLabelId(label); - + if (id == -1) return; - + int pad = id / PADKEYS; int key = id % PADKEYS; // save the joystick states UpdateJoysticks(); - + while (!captured) { vector::iterator itjoy; char *tmp; - - if (PollX11Keyboard(tmp, conf.keys[pad][key])) + + if (PollX11Keyboard(tmp, conf.keys[pad][key])) { strcpy(str, tmp); captured = true; break; } - + SDL_JoystickUpdate(); - + itjoy = s_vjoysticks.begin(); while ((itjoy != s_vjoysticks.end()) && (!captured)) { int jbutton, direction; - + if ((*itjoy)->PollButtons(jbutton, conf.keys[pad][key])) { - + sprintf(str, "JBut %d", jbutton); captured = true; break; @@ -335,7 +335,7 @@ void OnConf_Key(GtkButton *button, gpointer user_data) bool negative = false; bool pov = (!((key == PAD_RY) || (key == PAD_LY) || (key == PAD_RX) || (key == PAD_LX))); - + if ((*itjoy)->PollAxes(pov, jbutton, negative, conf.keys[pad][key])) { if (pov) @@ -345,7 +345,7 @@ void OnConf_Key(GtkButton *button, gpointer user_data) captured = true; break; } - + #ifdef EXPERIMENTAL_POV_CODE if ((*itjoy)->PollHats(jbutton, direction, conf.keys[pad][key])) { @@ -354,7 +354,7 @@ void OnConf_Key(GtkButton *button, gpointer user_data) case SDL_HAT_UP: sprintf(str, "JPOVU-%d", jbutton); break; case SDL_HAT_RIGHT: sprintf(str, "JPOVR-%d", jbutton); break; case SDL_HAT_DOWN: sprintf(str, "JPOVD-%d", jbutton); break; - case SDL_HAT_LEFT: sprintf(str, "JPOVL-%d", jbutton); break; + case SDL_HAT_LEFT: sprintf(str, "JPOVL-%d", jbutton); break; } captured = true; break; @@ -363,7 +363,7 @@ void OnConf_Key(GtkButton *button, gpointer user_data) itjoy++; } } - + gtk_entry_set_text(GTK_ENTRY(label), str); } @@ -386,7 +386,7 @@ void CALLBACK PADconfigure() // fill the combo char str[255]; vector::iterator it = s_vjoysticks.begin(); - + // Delete everything in the vector vjoysticks. while (it != s_vjoysticks.end()) { @@ -395,7 +395,7 @@ void CALLBACK PADconfigure() gtk_combo_box_append_text(GTK_COMBO_BOX(s_devicecombo), str); it++; } - + gtk_combo_box_append_text(GTK_COMBO_BOX(s_devicecombo), "No Gamepad"); UpdateConf(0); diff --git a/plugins/zeropad/Linux/linux.h b/plugins/zeropad/Linux/linux.h index 26de22f1b6..0b196d7e6b 100644 --- a/plugins/zeropad/Linux/linux.h +++ b/plugins/zeropad/Linux/linux.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "joystick.h" #include "keyboard.h" #include "zeropad.h" diff --git a/plugins/zeropad/Windows/gui.cpp b/plugins/zeropad/Windows/gui.cpp index a2a6a07fcf..e051ab37cc 100644 --- a/plugins/zeropad/Windows/gui.cpp +++ b/plugins/zeropad/Windows/gui.cpp @@ -15,9 +15,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "win.h" - + void SaveConfig() { char *szTemp; @@ -107,4 +107,4 @@ void SysMessage(char *fmt, ...) vsprintf(tmp, fmt, list); va_end(list); MessageBox(0, tmp, "PADwinKeyb Msg", 0); -} \ No newline at end of file +} diff --git a/plugins/zeropad/Windows/win.cpp b/plugins/zeropad/Windows/win.cpp index b396b11270..8ee4f33892 100644 --- a/plugins/zeropad/Windows/win.cpp +++ b/plugins/zeropad/Windows/win.cpp @@ -75,7 +75,7 @@ string GetKeyLabel(const int pad, const int index) { if (key >= 0x60 && key <= 0x69) sprintf(buff, "NumPad %c", '0' + key - 0x60); - else + else sprintf(buff, "%c", key); } } @@ -87,7 +87,7 @@ string GetKeyLabel(const int pad, const int index) { static const char name[][4] = { "MIN", "MAX" }; const int axis = (key & 0xff); - + sprintf(buff, "J%d_AXIS%d_%s", (key & 0xfff) / 0x100, axis / 2, name[axis % 2]); if (index >= 17 && index <= 20) buff[strlen(buff) -4] = '\0'; } @@ -95,7 +95,7 @@ string GetKeyLabel(const int pad, const int index) { static const char name[][8] = { "FORWARD", "RIGHT", "BACK", "LEFT" }; const int pov = (key & 0xff); - + sprintf(buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov / 4, name[pov % 4]); } @@ -160,7 +160,7 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) } else { - // Get rid of the expired timer, try to configure the keys, fail horribly, + // Get rid of the expired timer, try to configure the keys, fail horribly, // and either crash or don't register a keypress. KillTimer(hW, 0x80); hWC = GetDlgItem(hW, disabled); @@ -196,12 +196,12 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) KillTimer(hW, 0x80); EndDialog(hW, TRUE); return TRUE; - + case IDOK: KillTimer(hW, 0x80); if (IsDlgButtonChecked(hW, IDC_LOG)) conf.log = 1; - else + else conf.log = 0; SaveConfig(); EndDialog(hW, FALSE); @@ -251,7 +251,7 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) void CALLBACK PADconfigure() { INT_PTR ret; - + ret = DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_DIALOG1),GetActiveWindow(),(DLGPROC)ConfigureDlgProc,1); } diff --git a/plugins/zeropad/Windows/win.h b/plugins/zeropad/Windows/win.h index 7e6c72225f..4148d88a96 100644 --- a/plugins/zeropad/Windows/win.h +++ b/plugins/zeropad/Windows/win.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include #include #include diff --git a/plugins/zeropad/analog.cpp b/plugins/zeropad/analog.cpp index 1abc378a90..b0814ba16d 100644 --- a/plugins/zeropad/analog.cpp +++ b/plugins/zeropad/analog.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "analog.h" PADAnalog g_lanalog[NUM_OF_PADS], g_ranalog[NUM_OF_PADS]; @@ -29,25 +29,25 @@ namespace Analog case PAD_LX: return g_lanalog[i].x; break; - + case PAD_RX: return g_ranalog[i].x; break; - + case PAD_LY: return g_lanalog[i].y; break; - + case PAD_RY: return g_ranalog[i].y; break; - + default: return 0; break; } } - + void SetPad(int padvalue, u8 i, u8 value) { switch (padvalue) @@ -55,34 +55,34 @@ namespace Analog case PAD_LX: g_lanalog[i].x = value; break; - + case PAD_RX: g_ranalog[i].x = value; break; - + case PAD_LY: g_lanalog[i].y = value; break; - + case PAD_RY: g_ranalog[i].y = value; break; - + default: break; } } - + void InvertPad(int padvalue, u8 i) { SetPad(padvalue, i, -Pad(padvalue, i)); } - + void ResetPad(int padvalue, u8 i) { SetPad(padvalue, i, 0x80); } - + void Init() { for (int i = 0; i < 2; ++i) @@ -93,7 +93,7 @@ namespace Analog ResetPad(PAD_RY, i); } } - + bool RevertPad(u8 padvalue) { switch (padvalue) @@ -101,32 +101,32 @@ namespace Analog case PAD_LX: return ((conf.options & PADOPTION_REVERTLX) != 0); break; - + case PAD_RX: return ((conf.options & PADOPTION_REVERTRX) != 0); break; - + case PAD_LY: return ((conf.options & PADOPTION_REVERTLY) != 0); break; - + case PAD_RY: return ((conf.options & PADOPTION_REVERTRY) != 0); break; - + default: return false; break; } } - + void ConfigurePad(int padvalue, u8 i, int value) { int temp = Pad(padvalue, i); SetPad(padvalue, i, value / 256); if (RevertPad(padvalue)) InvertPad(padvalue, i); SetPad(padvalue, i, Pad(padvalue, i) + 0x80); - + //PAD_LOG("Setting pad[%d]@%d to %d from %d\n", padvalue, i, value, temp); } int AnalogToPad(int padvalue) diff --git a/plugins/zeropad/analog.h b/plugins/zeropad/analog.h index 9f941540e4..dcb47b3548 100644 --- a/plugins/zeropad/analog.h +++ b/plugins/zeropad/analog.h @@ -17,9 +17,9 @@ */ #pragma once - + #define NUM_OF_PADS 2 - + #include "zeropad.h" namespace Analog @@ -33,4 +33,4 @@ namespace Analog extern void ConfigurePad(int padvalue, u8 i, int value); extern int KeypadToPad(u8 keypress); extern int AnalogToPad(int padvalue); -} \ No newline at end of file +} diff --git a/plugins/zeropad/bitwise.h b/plugins/zeropad/bitwise.h index 1a6c5ec648..56b561c36e 100644 --- a/plugins/zeropad/bitwise.h +++ b/plugins/zeropad/bitwise.h @@ -15,27 +15,27 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + template static void __forceinline set_bit(T &value, int bit) { value |= (1 << bit); } - + template static void __forceinline clear_bit(T &value, int bit) { value &= ~(1 << bit); } - + template static void __forceinline toggle_bit(T &value, int bit) { value ^= (1 << bit); } - + template static bool __forceinline test_bit(T &value, int bit) { return (value & (1 << bit)); - } \ No newline at end of file + } diff --git a/plugins/zeropad/joystick.cpp b/plugins/zeropad/joystick.cpp index 1b3822d1cb..1e31df5eb0 100644 --- a/plugins/zeropad/joystick.cpp +++ b/plugins/zeropad/joystick.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "joystick.h" ////////////////////////// @@ -31,7 +31,7 @@ void UpdateJoysticks() vector::iterator itjoy = s_vjoysticks.begin(); SDL_JoystickUpdate(); - + // Save everything in the vector s_vjoysticks. while (itjoy != s_vjoysticks.end()) { @@ -62,10 +62,10 @@ const char *HatName(int value) return "SDL_HAT_LEFTUP"; case SDL_HAT_LEFTDOWN: return "SDL_HAT_LEFTDOWN"; - default: + default: return "Unknown"; } - + return "Unknown"; } @@ -83,18 +83,18 @@ void JoystickInfo::EnumerateJoysticks(vector& vjoysticks) SDL_JoystickEventState(SDL_QUERY); s_bSDLInit = true; } - + vector::iterator it = vjoysticks.begin(); - + // Delete everything in the vector vjoysticks. while (it != vjoysticks.end()) { delete *it; it ++; } - + vjoysticks.resize(SDL_NumJoysticks()); - + for (int i = 0; i < (int)vjoysticks.size(); ++i) { vjoysticks[i] = new JoystickInfo(); @@ -106,7 +106,7 @@ void JoystickInfo::EnumerateJoysticks(vector& vjoysticks) { // select the right joystick id int joyid = -1; - + for (int i = 0; i < PADKEYS; ++i) { if (IS_JOYSTICK(conf.keys[pad][i]) || IS_JOYBUTTONS(conf.keys[pad][i])) @@ -124,7 +124,7 @@ void JoystickInfo::EnumerateJoysticks(vector& vjoysticks) JoystickInfo::JoystickInfo() { joy = NULL; - + _id = -1; pad = -1; axisrange = 0x7fff; @@ -156,7 +156,7 @@ bool JoystickInfo::Init(int id, bool bStartThread) numbuttons = SDL_JoystickNumButtons(joy); numhats = SDL_JoystickNumHats(joy); devname = SDL_JoystickName(id); - + vaxisstate.resize(numaxes); vbuttonstate.resize(numbuttons); vhatstate.resize(numhats); @@ -207,7 +207,7 @@ bool JoystickInfo::PollButtons(int &jbutton, u32 &pkey) for (int i = 0; i < GetNumButtons(); ++i) { int but = SDL_JoystickGetButton(GetJoy(), i); - + if (but != GetButtonState(i)) { if (!but) // released, we don't really want this @@ -221,8 +221,8 @@ bool JoystickInfo::PollButtons(int &jbutton, u32 &pkey) return true; } } - - return false; + + return false; } bool JoystickInfo::PollAxes(bool pov, int &jbutton, bool &negative, u32 &pkey) @@ -245,7 +245,7 @@ bool JoystickInfo::PollAxes(bool pov, int &jbutton, bool &negative, u32 &pkey) if (abs(value) > 0x3fff) { jbutton = i; - + if (pov) { negative = (value < 0); diff --git a/plugins/zeropad/joystick.h b/plugins/zeropad/joystick.h index 26cb230fcc..130ec7fd0a 100644 --- a/plugins/zeropad/joystick.h +++ b/plugins/zeropad/joystick.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef __JOYSTICK_H__ #define __JOYSTICK_H__ @@ -47,80 +47,80 @@ class JoystickInfo void TestForce(); bool PollButtons(int &jbutton, u32 &pkey); - + bool PollAxes(bool pov, int &jbutton, bool &negative, u32 &pkey); - + bool PollHats(int &jbutton, int &dir, u32 &pkey); - + const string& GetName() { return devname; } - + int GetNumButtons() { return numbuttons; } - + int GetNumAxes() { return numaxes; } - + int GetNumHats() { return numhats; } - + int GetId() { return _id; } - + int GetPAD() { return pad; } - + int GetDeadzone(int axis) { return deadzone; } void SaveState(); - + int GetButtonState(int i) { return vbuttonstate[i]; } - + int GetAxisState(int i) { return vaxisstate[i]; } - + int GetHatState(int i) { //PAD_LOG("Getting POV State of %d.\n", i); return vhatstate[i]; } - + void SetButtonState(int i, int state) { vbuttonstate[i] = state; } - + void SetAxisState(int i, int value) { vaxisstate[i] = value; } - + void SetHatState(int i, int value) { //PAD_LOG("We should set %d to %d.\n", i, value); vhatstate[i] = value; } - + SDL_Joystick* GetJoy() { return joy; diff --git a/plugins/zeropad/keyboard.cpp b/plugins/zeropad/keyboard.cpp index 2384b927a1..02535fb6ae 100644 --- a/plugins/zeropad/keyboard.cpp +++ b/plugins/zeropad/keyboard.cpp @@ -15,14 +15,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + /* * Theoretically, this header is for anything to do with keyboard input. * Pragmatically, event handing's going in here too. */ - + #include "keyboard.h" - + __forceinline int FindKey(int key, int pad) { for (int p = 0; p < PADSUBKEYS; p++) @@ -71,7 +71,7 @@ void PollForX11KeyboardInput(int pad) KeySym key; int keyPress = 0, keyRelease = 0; int i; - + // keyboard input while (XPending(GSdsp) > 0) { @@ -82,7 +82,7 @@ void PollForX11KeyboardInput(int pad) key = XLookupKeysym((XKeyEvent *) & E, 0); i = FindKey(key, pad); - + // Analog controls. if ((i > PAD_RY) && (i <= PAD_R_LEFT)) { @@ -103,10 +103,10 @@ void PollForX11KeyboardInput(int pad) } i += 0xff00; } - - if (i != -1) + + if (i != -1) { - clear_bit(keyRelease, i); + clear_bit(keyRelease, i); set_bit(keyPress, i); } //PAD_LOG("Key pressed:%d\n", i); @@ -114,22 +114,22 @@ void PollForX11KeyboardInput(int pad) event.evt = KEYPRESS; event.key = key; break; - + case KeyRelease: key = XLookupKeysym((XKeyEvent *) & E, 0); i = FindKey(key, pad); - + // Analog Controls. if ((i > PAD_RY) && (i <= PAD_R_LEFT)) { Analog::ResetPad(Analog::AnalogToPad(i), pad); i += 0xff00; } - - if (i != -1) + + if (i != -1) { - clear_bit(keyPress, i); + clear_bit(keyPress, i); set_bit(keyRelease, i); } @@ -153,13 +153,13 @@ void PollForX11KeyboardInput(int pad) bool PollX11Keyboard(char* &temp, u32 &pkey) { GdkEvent *ev = gdk_event_get(); - + if (ev != NULL) { if (ev->type == GDK_KEY_PRESS) { - - if (ev->key.keyval == GDK_Escape) + + if (ev->key.keyval == GDK_Escape) { temp = "Unknown"; pkey = NULL; @@ -169,11 +169,11 @@ bool PollX11Keyboard(char* &temp, u32 &pkey) temp = KeysymToChar(ev->key.keyval); pkey = ev->key.keyval; } - + return true; } } - + return false; } #else diff --git a/plugins/zeropad/keyboard.h b/plugins/zeropad/keyboard.h index 1a61fe86c8..c39cc5f2fa 100644 --- a/plugins/zeropad/keyboard.h +++ b/plugins/zeropad/keyboard.h @@ -15,16 +15,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef __KEYBOARD_H__ #define __KEYBOARD_H__ - + #include "zeropad.h" - + #ifdef __LINUX__ #include "Linux/linux.h" - + extern Display *GSdsp; extern void PollForX11KeyboardInput(int pad); extern bool PollX11Keyboard(char* &temp, u32 &pkey); @@ -35,10 +35,10 @@ extern WNDPROC GSwndProc; extern HWND GShwnd; #endif - + extern char* KeysymToChar(int keysym); extern void PollForKeyboardInput(int pad); extern void SetAutoRepeat(bool autorep); extern __forceinline int FindKey(int key, int pad); - #endif \ No newline at end of file + #endif diff --git a/plugins/zeropad/zeropad.cpp b/plugins/zeropad/zeropad.cpp index d71ed9e260..50183ca07b 100644 --- a/plugins/zeropad/zeropad.cpp +++ b/plugins/zeropad/zeropad.cpp @@ -49,7 +49,7 @@ const u32 build = 3; // increase that with each version int PadEnum[2][2] = {{0, 2}, {1, 3}}; u32 pads = 0; -u8 stdpar[2][20] = { +u8 stdpar[2][20] = { {0xff, 0x5a, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, @@ -77,23 +77,23 @@ u8 unk4c[2][8] = { {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; -u8 unk4d[2][8] = { +u8 unk4d[2][8] = { {0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, {0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; -u8 cmd4f[2][8] = { +u8 cmd4f[2][8] = { {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a}, {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a} }; -u8 stdcfg[2][8] = { +u8 stdcfg[2][8] = { {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; // 2 & 3 = 0 -u8 stdmode[2][8] = { +u8 stdmode[2][8] = { {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0xff, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; -u8 stdmodel[2][8] = { +u8 stdmodel[2][8] = { {0xff, 0x5a, 0x03, // 03 - dualshock2, 01 - dualshock @@ -102,7 +102,7 @@ u8 stdmodel[2][8] = { 0x02, 0x01, 0x00}, - {0xff, + {0xff, 0x5a, 0x03, // 03 - dualshock2, 01 - dualshock 0x02, // number of modes @@ -188,7 +188,7 @@ u32 CALLBACK PS2EgetLibVersion2(u32 type) return (version << 16) | (revision << 8) | build; } -void __Log(const char *fmt, ...) +void __Log(const char *fmt, ...) { va_list list; @@ -199,7 +199,7 @@ void __Log(const char *fmt, ...) va_end(list); } -void __LogToConsole(const char *fmt, ...) +void __LogToConsole(const char *fmt, ...) { va_list list; @@ -268,7 +268,7 @@ s32 CALLBACK PADopen(void *pDsp) pthread_spin_init(&s_mutexStatus, PTHREAD_PROCESS_PRIVATE); s_keyPress[0] = s_keyPress[1] = 0; s_keyRelease[0] = s_keyRelease[1] = 0; - + #ifdef __LINUX__ JoystickInfo::EnumerateJoysticks(s_vjoysticks); #endif @@ -295,7 +295,7 @@ void UpdateKeys(int pad, int keyPress, int keyRelease) { pthread_spin_lock(&s_mutexStatus); s_keyPress[pad] |= keyPress; - s_keyPress[pad] &= ~keyRelease; + s_keyPress[pad] &= ~keyRelease; s_keyRelease[pad] |= keyRelease; s_keyRelease[pad] &= ~keyPress; pthread_spin_unlock(&s_mutexStatus); @@ -341,7 +341,7 @@ void PADsetMode(int pad, int mode) u8 CALLBACK PADstartPoll(int pad) { //PAD_LOG("PADstartPoll: %d\n", pad); - + curPad = pad - 1; curByte = 0; @@ -355,7 +355,7 @@ u8 _PADpoll(u8 value) if (curByte == 0) { curByte++; - + //PAD_LOG("PADpoll: cmd: %x\n", value); curCmd = value; @@ -381,12 +381,12 @@ u8 _PADpoll(u8 value) stdpar[curPad][5] = Analog::Pad(PAD_RY, curPad); stdpar[curPad][6] = Analog::Pad(PAD_LX, curPad); stdpar[curPad][7] = Analog::Pad(PAD_LY, curPad); - - if (padMode[curPad] == 1) + + if (padMode[curPad] == 1) cmdLen = 20; - else + else cmdLen = 4; - + button_check2 = stdpar[curPad][2] >> 4; switch (stdpar[curPad][3]) { @@ -454,7 +454,7 @@ u8 _PADpoll(u8 value) buf = stdcfg[curPad]; if (stdcfg[curPad][3] == 0xff) return 0xf3; - else + else return padID[curPad]; case CMD_SET_MODE_AND_LOCK: // SET_MODE_AND_LOCK @@ -570,7 +570,7 @@ u8 _PADpoll(u8 value) u8 CALLBACK PADpoll(u8 value) { u8 ret; - + ret = _PADpoll(value); //PAD_LOG("PADpoll: %x (%d: %x)\n", value, curByte, ret); return ret; diff --git a/plugins/zeropad/zeropad.h b/plugins/zeropad/zeropad.h index 947bdb4da9..ab86e7b647 100644 --- a/plugins/zeropad/zeropad.h +++ b/plugins/zeropad/zeropad.h @@ -126,7 +126,7 @@ enum PadCommands CMD_SET_DS2_NATIVE_MODE = 0x4F // SET_DS2_NATIVE_MODE }; -enum gamePadValues +enum gamePadValues { PAD_R_LEFT = 27, PAD_R_DOWN = 26, diff --git a/plugins/zerospu2/Linux/Linux.cpp b/plugins/zerospu2/Linux/Linux.cpp index 7db94bf911..374ac1fc80 100644 --- a/plugins/zerospu2/Linux/Linux.cpp +++ b/plugins/zerospu2/Linux/Linux.cpp @@ -15,12 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + // Modified by arcum42@gmail.com #include -extern "C" +extern "C" { #include "interface.h" #include "support.h" @@ -34,13 +34,13 @@ extern char *libraryName; GtkWidget *MsgDlg, *ConfDlg; -void OnMsg_Ok() +void OnMsg_Ok() { gtk_widget_destroy(MsgDlg); gtk_main_quit(); } -void SysMessage(char *fmt, ...) +void SysMessage(char *fmt, ...) { GtkWidget *Ok,*Txt; GtkWidget *Box,*Box1; @@ -52,7 +52,7 @@ void SysMessage(char *fmt, ...) va_end(list); if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0; - + MsgDlg = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(MsgDlg), GTK_WIN_POS_CENTER); gtk_window_set_title(GTK_WINDOW(MsgDlg), "SPU2null Msg"); @@ -63,7 +63,7 @@ void SysMessage(char *fmt, ...) gtk_widget_show(Box); Txt = gtk_label_new(msg); - + gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5); gtk_widget_show(Txt); @@ -77,12 +77,12 @@ void SysMessage(char *fmt, ...) GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT); gtk_widget_show(Ok); - gtk_widget_show(MsgDlg); + gtk_widget_show(MsgDlg); gtk_main(); } -void CALLBACK SPU2configure() +void CALLBACK SPU2configure() { LOG_CALLBACK("SPU2configure()\n"); ConfDlg = create_Config(); @@ -92,7 +92,7 @@ void CALLBACK SPU2configure() set_checked(ConfDlg, "recordingbutton", (conf.options & OPTION_RECORDING)); set_checked(ConfDlg, "mutebutton", (conf.options & OPTION_MUTE)); set_checked(ConfDlg, "loggingbutton", (conf.Log)); - + gtk_widget_show_all(ConfDlg); gtk_main(); } @@ -101,18 +101,18 @@ void CALLBACK SPU2configure() void on_Conf_Ok (GtkButton *button, gpointer user_data) { conf.options = 0; - - if (is_checked(ConfDlg, "realtimebutton")) + + if (is_checked(ConfDlg, "realtimebutton")) conf.options |= OPTION_REALTIME; - if (is_checked(ConfDlg, "timescalingbutton")) + if (is_checked(ConfDlg, "timescalingbutton")) conf.options |= OPTION_TIMESTRETCH; if (is_checked(ConfDlg, "recordingbutton")) conf.options |= OPTION_RECORDING; if (is_checked(ConfDlg, "mutebutton")) conf.options |= OPTION_MUTE; - + conf.Log = is_checked(ConfDlg, "loggingbutton"); - + SaveConfig(); gtk_widget_destroy(ConfDlg); gtk_main_quit(); @@ -126,31 +126,31 @@ void on_Conf_Cancel (GtkButton *button, gpointer user_data) } -void CALLBACK SPU2about() +void CALLBACK SPU2about() { LOG_CALLBACK("SPU2about()\n"); SysMessage("%s %d.%d\ndeveloper: zerofrog", libraryName, SPU2_VERSION, SPU2_BUILD); } -void SaveConfig() +void SaveConfig() { string iniFile( s_strIniPath + "zerospu2.ini" ); - + FILE* f = fopen(iniFile.c_str(),"w"); - if (f == NULL) + if (f == NULL) { ERROR_LOG("Failed to open %s\n", iniFile.c_str()); return; } - + fprintf(f, "log = %d\n", conf.Log); //fprintf(f, "options = %d\n", conf.options); - + fprintf(f, "realtime = %d\n", is_checked(ConfDlg, "realtimebutton")); fprintf(f, "timestretch = %d\n", is_checked(ConfDlg, "timescalingbutton")); fprintf(f, "recording = %d\n", is_checked(ConfDlg, "recordingbutton")); fprintf(f, "mute = %d\n", is_checked(ConfDlg, "mutebutton")); - + fclose(f); } @@ -161,9 +161,9 @@ void LoadConfig() memset(&conf, 0, sizeof(conf)); string iniFile( s_strIniPath + "zerospu2.ini" ); - + FILE* f = fopen(iniFile.c_str(), "r"); - if (f == NULL) + if (f == NULL) { ERROR_LOG("Failed to open %s\n", iniFile.c_str()); conf.Log = 0; @@ -171,22 +171,22 @@ void LoadConfig() SaveConfig();//save and return return; } - + fscanf(f, "log = %d\n", &conf.Log); - + fscanf(f, "realtime = %d\n", &temp); if (temp) conf.options |= OPTION_REALTIME; - + fscanf(f, "timestretch = %d\n", &temp); if (temp) conf.options |= OPTION_TIMESTRETCH; - + fscanf(f, "recording = %d\n", &temp); if (temp) conf.options |= OPTION_RECORDING; - + fscanf(f, "mute = %d\n", &temp); if (temp) conf.options |= OPTION_MUTE; - + fscanf(f, "options = %d\n", &conf.options); - + fclose(f); } diff --git a/plugins/zerospu2/Linux/Linux.h b/plugins/zerospu2/Linux/Linux.h index dd6886eee3..939e9d09b5 100644 --- a/plugins/zerospu2/Linux/Linux.h +++ b/plugins/zerospu2/Linux/Linux.h @@ -15,12 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + // Modified by arcum42@gmail.com - + #ifndef __LINUX_H__ #define __LINUX_H__ - + #include #include @@ -33,7 +33,7 @@ #include "Targets/SoundTargets.h" // Make it easier to check and set checkmarks in the gui -#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) +#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) #define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state) #endif // __LINUX_H__ diff --git a/plugins/zerospu2/Targets/Alsa.cpp b/plugins/zerospu2/Targets/Alsa.cpp index 121118e7a3..2e8cae13d3 100644 --- a/plugins/zerospu2/Targets/Alsa.cpp +++ b/plugins/zerospu2/Targets/Alsa.cpp @@ -15,9 +15,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + // Modified by arcum42@gmail.com - + // ALSA #include "Alsa.h" #include "Linux.h" @@ -36,86 +36,86 @@ int AlsaSetupSound() unsigned int buffer_time = SOUNDSIZE; unsigned int period_time= buffer_time / 4; int err; - + err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); - if(err < 0) + if(err < 0) { ERROR_LOG("Audio open error: %s\n", snd_strerror(err)); return -1; } - + err = snd_pcm_nonblock(handle, 0); - if(err < 0) + if(err < 0) { ERROR_LOG("Can't set blocking mode: %s\n", snd_strerror(err)); return -1; } - + snd_pcm_hw_params_alloca(&hwparams); snd_pcm_sw_params_alloca(&swparams); - + err = snd_pcm_hw_params_any(handle, hwparams); - if (err < 0) + if (err < 0) { ERROR_LOG("Broken configuration for this PCM: %s\n", snd_strerror(err)); return -1; } - + err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); - if (err < 0) + if (err < 0) { ERROR_LOG("Access type not available: %s\n", snd_strerror(err)); return -1; } err = snd_pcm_hw_params_set_format(handle, hwparams, format); - if (err < 0) + if (err < 0) { ERROR_LOG("Sample format not available: %s\n", snd_strerror(err)); return -1; } - + err = snd_pcm_hw_params_set_channels(handle, hwparams, pchannels); - if (err < 0) + if (err < 0) { ERROR_LOG("Channels count not available: %s\n", snd_strerror(err)); return -1; } err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &pspeed, 0); - if (err < 0) + if (err < 0) { ERROR_LOG("Rate not available: %s\n", snd_strerror(err)); return -1; } - + err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, 0); if(err < 0) { ERROR_LOG("Buffer time error: %s\n", snd_strerror(err)); return -1; } - + err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, 0); if (err < 0) { ERROR_LOG("Period time error: %s\n", snd_strerror(err)); return -1; } - + err = snd_pcm_hw_params(handle, hwparams); - if (err < 0) + if (err < 0) { ERROR_LOG("Unable to install hw params: %s\n", snd_strerror(err)); return -1; } - + snd_pcm_status_alloca(&status); err = snd_pcm_status(handle, status); - if(err < 0) + if(err < 0) { ERROR_LOG("Unable to get status: %s\n", snd_strerror(err)); return -1; } - + buffer_size=snd_pcm_status_get_avail(status); return 0; @@ -132,30 +132,30 @@ void AlsaRemoveSound() int AlsaSoundGetBytesBuffered() { - unsigned long l = snd_pcm_avail_update(handle); - if (MaxBuffer == 0) MaxBuffer = l; - return MaxBuffer - l; + unsigned long l = snd_pcm_avail_update(handle); + if (MaxBuffer == 0) MaxBuffer = l; + return MaxBuffer - l; /*int l; - + // failed to open? - if(handle == NULL) return SOUNDSIZE; - - l = snd_pcm_avail_update(handle); - - if (l<0) + if(handle == NULL) return SOUNDSIZE; + + l = snd_pcm_avail_update(handle); + + if (l<0) return 0; else if (l no? wait - else + else l=0; // -> else go on - + return l;*/ } void AlsaSoundFeedVoiceData(unsigned char* pSound,long lBytes) { if (handle == NULL) return; - + if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN) snd_pcm_prepare(handle); snd_pcm_writei(handle,pSound, lBytes/4); diff --git a/plugins/zerospu2/Targets/Alsa.h b/plugins/zerospu2/Targets/Alsa.h index efae32d903..be3dd56009 100644 --- a/plugins/zerospu2/Targets/Alsa.h +++ b/plugins/zerospu2/Targets/Alsa.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef ALSA_H_INCLUDED #define ALSA_H_INCLUDED diff --git a/plugins/zerospu2/Targets/OSS.cpp b/plugins/zerospu2/Targets/OSS.cpp index 22ca32c556..9bedd8a5e1 100644 --- a/plugins/zerospu2/Targets/OSS.cpp +++ b/plugins/zerospu2/Targets/OSS.cpp @@ -15,9 +15,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + // Modified by arcum42@gmail.com - + #include "Linux.h" #include "OSS.h" @@ -34,51 +34,51 @@ int OSSSetupSound() int myfrag; int oss_speed, oss_stereo; int err; - + pstereo=OSS_MODE_STEREO; - + oss_speed = pspeed; oss_stereo = pstereo; - + oss_audio_fd=open("/dev/dsp",O_WRONLY,0); - if (oss_audio_fd == -1) + if (oss_audio_fd == -1) { ERROR_LOG("Sound device not available!\n"); return -1; } - + err= ioctl(oss_audio_fd,SNDCTL_DSP_RESET,0); - if (err == -1) + if (err == -1) { ERROR_LOG("Sound reset failed\n"); return -1; } - + // we use 64 fragments with 1024 bytes each fragsize = 10; myfrag = (63 << 16) | fragsize; err = ioctl(oss_audio_fd,SNDCTL_DSP_SETFRAGMENT,&myfrag); - if (err == -1) + if (err == -1) { ERROR_LOG("Sound set fragment failed!\n"); - return -1; + return -1; } - + format = AFMT_S16_LE; err = ioctl(oss_audio_fd,SNDCTL_DSP_SETFMT,&format); - if ((err == -1) || (format!=AFMT_S16_LE)) + if ((err == -1) || (format!=AFMT_S16_LE)) { ERROR_LOG("Sound format not supported!\n"); return -1; } - + err = ioctl(oss_audio_fd,SNDCTL_DSP_STEREO,&oss_stereo); - if (err == -1) + if (err == -1) { ERROR_LOG("Stereo mode not supported!\n"); return -1; } - + err = ioctl(oss_audio_fd,SNDCTL_DSP_SPEED,&oss_speed); if ((err == -1) || (oss_speed!=pspeed)) { @@ -102,7 +102,7 @@ int OSSSoundGetBytesBuffered() { audio_buf_info info; unsigned long l; - + if(oss_audio_fd == -1) return SOUNDSIZE; if(ioctl(oss_audio_fd,SNDCTL_DSP_GETOSPACE,&info)==-1) diff --git a/plugins/zerospu2/Targets/OSS.h b/plugins/zerospu2/Targets/OSS.h index 629d1bc37e..41601f1344 100644 --- a/plugins/zerospu2/Targets/OSS.h +++ b/plugins/zerospu2/Targets/OSS.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef OSS_H_INCLUDED #define OSS_H_INCLUDED diff --git a/plugins/zerospu2/Targets/PortAudio.cpp b/plugins/zerospu2/Targets/PortAudio.cpp index 9d8198a626..993907aad2 100644 --- a/plugins/zerospu2/Targets/PortAudio.cpp +++ b/plugins/zerospu2/Targets/PortAudio.cpp @@ -15,9 +15,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + // PortAudio support implemented by Zedr0n. - + #include "PortAudio.h" #include "Linux.h" @@ -35,7 +35,7 @@ int paSetupSound() } else ERROR_LOG("ZeroSPU2: Initialized portaudio... \n"); - + /* Open an audio I/O stream. */ err = Pa_OpenDefaultStream( &stream, 0, /* no input channels */ @@ -57,7 +57,7 @@ int paSetupSound() ERROR_LOG("ZeroSPU2: Error opening sound stream...\n"); return -1; } - else ERROR_LOG("ZeroSPU2: Created sound stream successfully...\n"); + else ERROR_LOG("ZeroSPU2: Created sound stream successfully...\n"); MaxBuffer = 0; @@ -67,13 +67,13 @@ int paSetupSound() ERROR_LOG("ZeroSPU2: Error starting sound stream...\n"); return -1; } - else ERROR_LOG("ZeroSPU2: Started sound stream successfully...\n"); + else ERROR_LOG("ZeroSPU2: Started sound stream successfully...\n"); return 0; } void paRemoveSound() -{ +{ PaError err = Pa_StopStream( stream ); if( err != paNoError ) ERROR_LOG("ZeroSPU2: PortAudio error: %s\n", Pa_GetErrorText( err ) ); @@ -89,9 +89,9 @@ void paRemoveSound() int paSoundGetBytesBuffered() { - unsigned long l = Pa_GetStreamWriteAvailable(stream); - if(MaxBuffer == 0) MaxBuffer = l; - return MaxBuffer - l; + unsigned long l = Pa_GetStreamWriteAvailable(stream); + if(MaxBuffer == 0) MaxBuffer = l; + return MaxBuffer - l; } void paSoundFeedVoiceData(unsigned char* pSound, long lBytes) diff --git a/plugins/zerospu2/Targets/PortAudio.h b/plugins/zerospu2/Targets/PortAudio.h index 7749c29aa6..813086eb09 100644 --- a/plugins/zerospu2/Targets/PortAudio.h +++ b/plugins/zerospu2/Targets/PortAudio.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + // PortAudio support implemented by Zedr0n. #ifndef PORTAUDIO_H_INCLUDED #define PORTAUDIO_H_INCLUDED diff --git a/plugins/zerospu2/Targets/SoundTargets.cpp b/plugins/zerospu2/Targets/SoundTargets.cpp index da1dfa75f6..06be1d897a 100644 --- a/plugins/zerospu2/Targets/SoundTargets.cpp +++ b/plugins/zerospu2/Targets/SoundTargets.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "SoundTargets.h" SoundCallbacks *SoundCmds; diff --git a/plugins/zerospu2/Targets/SoundTargets.h b/plugins/zerospu2/Targets/SoundTargets.h index 4f6aea42d0..d2ad2c6889 100644 --- a/plugins/zerospu2/Targets/SoundTargets.h +++ b/plugins/zerospu2/Targets/SoundTargets.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef SOUNDTARGETS_H_INCLUDED #define SOUNDTARGETS_H_INCLUDED diff --git a/plugins/zerospu2/Targets/dsound51.cpp b/plugins/zerospu2/Targets/dsound51.cpp index 83e5cf6f89..79a22bef06 100644 --- a/plugins/zerospu2/Targets/dsound51.cpp +++ b/plugins/zerospu2/Targets/dsound51.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "dsound51.h" HWND hWMain = NULL; @@ -38,15 +38,15 @@ int DSSetupSound() WAVEFORMATEX pcmwf; dsval = DirectSoundCreate(NULL,&lpDS,NULL); - if(dsval != DS_OK) + if(dsval != DS_OK) { MessageBox(hWMain,"DirectSoundCreate!","Error",MB_OK); return -1; } - if(DS_OK != IDirectSound_SetCooperativeLevel(lpDS,hWMain, DSSCL_PRIORITY)) + if(DS_OK != IDirectSound_SetCooperativeLevel(lpDS,hWMain, DSSCL_PRIORITY)) { - if(DS_OK != IDirectSound_SetCooperativeLevel(lpDS,hWMain, DSSCL_NORMAL)) + if(DS_OK != IDirectSound_SetCooperativeLevel(lpDS,hWMain, DSSCL_NORMAL)) { MessageBox(hWMain,"SetCooperativeLevel!","Error",MB_OK); return -1; @@ -55,12 +55,12 @@ int DSSetupSound() memset(&dsbd,0,sizeof(DSBUFFERDESC)); dsbd.dwSize = sizeof(DSBUFFERDESC); // NT4 hack! sizeof(dsbd); - dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; - dsbd.dwBufferBytes = 0; + dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; + dsbd.dwBufferBytes = 0; dsbd.lpwfxFormat = NULL; dsval = IDirectSound_CreateSoundBuffer(lpDS,&dsbd,&lpDSBPRIMARY,NULL); - if(dsval != DS_OK) + if(dsval != DS_OK) { MessageBox(hWMain, "CreateSoundBuffer (Primary)", "Error",MB_OK); return -1; @@ -69,7 +69,7 @@ int DSSetupSound() memset(&pcmwf, 0, sizeof(WAVEFORMATEX)); pcmwf.wFormatTag = WAVE_FORMAT_PCM; - pcmwf.nChannels = 2; + pcmwf.nChannels = 2; pcmwf.nBlockAlign = 4; pcmwf.nSamplesPerSec = SAMPLE_RATE; @@ -78,7 +78,7 @@ int DSSetupSound() pcmwf.wBitsPerSample = 16; dsval = IDirectSoundBuffer_SetFormat(lpDSBPRIMARY,&pcmwf); - if(dsval != DS_OK) + if(dsval != DS_OK) { MessageBox(hWMain, "SetFormat!", "Error",MB_OK); return -1; @@ -89,19 +89,19 @@ int DSSetupSound() IDirectSound_GetCaps(lpDS,&dscaps); IDirectSoundBuffer_GetCaps(lpDSBPRIMARY,&dsbcaps); - memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); + memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); // NT4 hack! sizeof(DSBUFFERDESC); - dsbdesc.dwSize = sizeof(DSBUFFERDESC); + dsbdesc.dwSize = sizeof(DSBUFFERDESC); dsbdesc.dwFlags = DSBCAPS_LOCHARDWARE | DSBCAPS_STICKYFOCUS | DSBCAPS_GETCURRENTPOSITION2; dsbdesc.dwBufferBytes = SOUNDSIZE; dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf; dsval = IDirectSound_CreateSoundBuffer(lpDS,&dsbdesc,&lpDSBSECONDARY1,NULL); - if(dsval != DS_OK) + if(dsval != DS_OK) { dsbdesc.dwFlags = DSBCAPS_LOCSOFTWARE | DSBCAPS_STICKYFOCUS | DSBCAPS_GETCURRENTPOSITION2; dsval = IDirectSound_CreateSoundBuffer(lpDS,&dsbdesc,&lpDSBSECONDARY1,NULL); - if(dsval != DS_OK) + if(dsval != DS_OK) { MessageBox(hWMain,"CreateSoundBuffer (Secondary1)", "Error",MB_OK); return -1; @@ -116,52 +116,52 @@ int DSSetupSound() } dsval = IDirectSoundBuffer_Play(lpDSBSECONDARY1,0,0,DSBPLAY_LOOPING); - if(dsval != DS_OK) + if(dsval != DS_OK) { MessageBox(hWMain,"Play (Secondary1)","Error",MB_OK); return -1; } - + // init some play vars LastWrite = 0x00000000; - LastPlay = 0; - + LastPlay = 0; + return 0; } void DSRemoveSound() -{ +{ int iRes; - if (lpDSBSECONDARY1 != NULL) + if (lpDSBSECONDARY1 != NULL) { IDirectSoundBuffer_Stop(lpDSBSECONDARY1); iRes = IDirectSoundBuffer_Release(lpDSBSECONDARY1); - + // FF says such a loop is bad... Demo says it's good... Pete doesn't care while(iRes!=0) iRes = IDirectSoundBuffer_Release(lpDSBSECONDARY1); - + lpDSBSECONDARY1 = NULL; } - if (lpDSBPRIMARY != NULL) + if (lpDSBPRIMARY != NULL) { IDirectSoundBuffer_Stop(lpDSBPRIMARY); iRes = IDirectSoundBuffer_Release(lpDSBPRIMARY); - + // FF says such a loop is bad... Demo says it's good... Pete doesn't care while(iRes!=0) iRes = IDirectSoundBuffer_Release(lpDSBPRIMARY); - + lpDSBPRIMARY = NULL; } - if (lpDS!=NULL) + if (lpDS!=NULL) { iRes = IDirectSound_Release(lpDS); - + // FF says such a loop is bad... Demo says it's good... Pete doesn't care while(iRes!=0) iRes = IDirectSound_Release(lpDS); - + lpDS = NULL; } @@ -177,21 +177,21 @@ int DSSoundGetBytesBuffered() if(cplay > SOUNDSIZE) return SOUNDSIZE; if(cplay < LastWrite) return LastWrite - cplay; - + return (SOUNDSIZE - cplay) + LastWrite; } void DSSoundFeedVoiceData(unsigned char* pSound,long lBytes) { LPVOID lpvPtr1, lpvPtr2; - unsigned long dwBytes1,dwBytes2; + unsigned long dwBytes1,dwBytes2; unsigned long *lpSS, *lpSD; unsigned long dw,cplay,cwrite; HRESULT hr; unsigned long status; IDirectSoundBuffer_GetStatus(lpDSBSECONDARY1,&status); - if (status & DSBSTATUS_BUFFERLOST) + if (status & DSBSTATUS_BUFFERLOST) { if (IDirectSoundBuffer_Restore(lpDSBSECONDARY1) != DS_OK) return; IDirectSoundBuffer_Play(lpDSBSECONDARY1,0,0,DSBPLAY_LOOPING); @@ -204,28 +204,28 @@ void DSSoundFeedVoiceData(unsigned char* pSound,long lBytes) hr = IDirectSoundBuffer_Lock(lpDSBSECONDARY1,LastWrite,lBytes, &lpvPtr1, &dwBytes1, &lpvPtr2, &dwBytes2, 0); - if (hr != DS_OK) + if (hr != DS_OK) { LastWrite=0xffffffff; return; } - + lpSS = (unsigned long *)pSound; lpSD = (unsigned long *)lpvPtr1; dw = dwBytes1 >> 2; - while(dw) + while(dw) { *lpSD++=*lpSS++; dw--; } - if (lpvPtr2) + if (lpvPtr2) { lpSD = (unsigned long *)lpvPtr2; dw = dwBytes2 >> 2; - - while(dw) + + while(dw) { *lpSD++ = *lpSS++; dw--; @@ -236,4 +236,4 @@ void DSSoundFeedVoiceData(unsigned char* pSound,long lBytes) LastWrite += lBytes; if(LastWrite >= SOUNDSIZE) LastWrite -= SOUNDSIZE; LastPlay = cplay; -} \ No newline at end of file +} diff --git a/plugins/zerospu2/Targets/dsound51.h b/plugins/zerospu2/Targets/dsound51.h index eeaf8073d5..4a0e537eb4 100644 --- a/plugins/zerospu2/Targets/dsound51.h +++ b/plugins/zerospu2/Targets/dsound51.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef DSOUND51_H_INCLUDED #define DSOUND51_H_INCLUDED @@ -43,4 +43,4 @@ static SoundCallbacks DSCmds = (soundFeedFunction)DSSoundFeedVoiceData }; -#endif \ No newline at end of file +#endif diff --git a/plugins/zerospu2/Windows/Win32.cpp b/plugins/zerospu2/Windows/Win32.cpp index aab484d1b6..7cf5a8f867 100644 --- a/plugins/zerospu2/Windows/Win32.cpp +++ b/plugins/zerospu2/Windows/Win32.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include #include #include @@ -30,7 +30,7 @@ extern HWND hWMain; ///////// HINSTANCE hInst; -void SysMessage(char *fmt, ...) +void SysMessage(char *fmt, ...) { va_list list; char tmp[512]; @@ -38,30 +38,30 @@ void SysMessage(char *fmt, ...) va_start(list,fmt); vsprintf_s(tmp,fmt,list); va_end(list); - + MessageBox((hWMain==NULL) ? GetActiveWindow() : hWMain, tmp, "ZeroSPU2 Msg", MB_SETFOREGROUND | MB_OK); } -BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) +BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { - - switch(uMsg) + + switch(uMsg) { case WM_INITDIALOG: LoadConfig(); if (conf.Log) CheckDlgButton(hW, IDC_LOGGING, TRUE); - if( conf.options & OPTION_REALTIME) + if( conf.options & OPTION_REALTIME) CheckDlgButton(hW, IDC_REALTIME, TRUE); - if( conf.options & OPTION_TIMESTRETCH) + if( conf.options & OPTION_TIMESTRETCH) CheckDlgButton(hW, IDC_TIMESTRETCH, TRUE); - if( conf.options & OPTION_MUTE) + if( conf.options & OPTION_MUTE) CheckDlgButton(hW, IDC_MUTESOUND, TRUE); - if( conf.options & OPTION_RECORDING) + if( conf.options & OPTION_RECORDING) CheckDlgButton(hW, IDC_SNDRECORDING, TRUE); return TRUE; case WM_COMMAND: - switch(LOWORD(wParam)) + switch(LOWORD(wParam)) { case IDCANCEL: EndDialog(hW, TRUE); @@ -70,9 +70,9 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) conf.options = 0; if (IsDlgButtonChecked(hW, IDC_LOGGING)) conf.Log = 1; - else + else conf.Log = 0; - + if (IsDlgButtonChecked(hW, IDC_REALTIME)) conf.options |= OPTION_REALTIME; if (IsDlgButtonChecked(hW, IDC_TIMESTRETCH)) @@ -81,7 +81,7 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) conf.options |= OPTION_MUTE; if (IsDlgButtonChecked(hW, IDC_SNDRECORDING)) conf.options |= OPTION_RECORDING; - + SaveConfig(); EndDialog(hW, FALSE); return TRUE; @@ -90,15 +90,15 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) return FALSE; } -BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) +BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch(uMsg) + switch(uMsg) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: - switch(LOWORD(wParam)) + switch(LOWORD(wParam)) { case IDOK: EndDialog(hW, FALSE); @@ -108,19 +108,19 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) return FALSE; } -void CALLBACK SPU2configure() +void CALLBACK SPU2configure() { - DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), GetActiveWindow(), (DLGPROC)ConfigureDlgProc); + DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), GetActiveWindow(), (DLGPROC)ConfigureDlgProc); } -void CALLBACK SPU2about() +void CALLBACK SPU2about() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), GetActiveWindow(), (DLGPROC)AboutDlgProc); } // DLL INIT -BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) +BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; return TRUE; // very quick :) @@ -144,14 +144,14 @@ void LoadConfig() FILE *fp; Config *Conf1 = &conf; char szValue[256]; - + string iniFile( s_strIniPath + "zerospu2.ini" ); fopen_s(&fp, iniFile.c_str(), "rt");//check if zerospu2.ini really exists if (!fp) { - CreateDirectory(s_strIniPath.c_str(), NULL); + CreateDirectory(s_strIniPath.c_str(), NULL); memset(&conf, 0, sizeof(conf)); conf.Log = 0;//default value conf.options = OPTION_TIMESTRETCH; @@ -159,7 +159,7 @@ void LoadConfig() return ; } fclose(fp); - + GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, iniFile.c_str()); Conf1->Log = strtoul(szValue, NULL, 10); GetPrivateProfileString("Interface", "Options", NULL, szValue, 20, iniFile.c_str()); diff --git a/plugins/zerospu2/Windows/resource.h b/plugins/zerospu2/Windows/resource.h index 530ced6cca..85ef07167c 100644 --- a/plugins/zerospu2/Windows/resource.h +++ b/plugins/zerospu2/Windows/resource.h @@ -17,7 +17,7 @@ #define IDC_MUTESOUND 1011 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 102 diff --git a/plugins/zerospu2/reg.h b/plugins/zerospu2/reg.h index ab91e84f0d..5f26e07654 100644 --- a/plugins/zerospu2/reg.h +++ b/plugins/zerospu2/reg.h @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - + + #ifndef __REG_H__ #define __REG_H__ @@ -35,7 +35,7 @@ enum REG_VP_VOLXL = 0x000C, // Current Voice Volume Left REG_VP_VOLXR = 0x000E, // Current Voice Volume Right // end unimplemented section - + REG_C0_FMOD1 = 0x0180, // Pitch Modulation Spec. REG_C0_FMOD2 = 0x0182, REG_S_NON = 0x0184, // Alloc Noise Generator - unimplemented @@ -62,7 +62,7 @@ enum REG_C0_DMACTRL = 0x01AE, // unimplemented REG_C0_ADMAS = 0x01B0, // AutoDMA Status - // Section Unimplemented + // Section Unimplemented // Actually, some are implemented but weren't using the constants. REG_VA_SSA = 0x01C0, // Waveform data starting address REG_VA_LSAX = 0x01C4, // Loop point address @@ -92,11 +92,11 @@ R_MIX_DEST_B0 = 0x0334, R_MIX_DEST_B1 = 0x0338, REG_A_EEA = 0x033C, // Address: End address of working area for effects processing (upper part of address only!) // end unimplemented section - + REG_C0_END1 = 0x0340, // End Point passed flag REG_C0_END2 = 0x0342, REG_C0_SPUSTAT = 0x0344, // Status register? - + // core 1 has the same registers with 0x400 added, and ends at 0x746. REG_C1_FMOD1 = 0x0580, REG_C1_FMOD2 = 0x0582, @@ -120,7 +120,7 @@ R_MIX_DEST_B1 = 0x0338, REG_C1_END1 = 0x0740, REG_C1_END2 = 0x0742, REG_C1_SPUSTAT = 0x0744, - + // Interesting to note that *most* of the volume controls aren't implemented in Zerospu2. REG_P_MVOLL = 0x0760, // Master Volume Left - unimplemented REG_P_MVOLR = 0x0762, // Master Volume Right - unimplemented @@ -132,7 +132,7 @@ R_MIX_DEST_B1 = 0x0338, REG_C0_BVOLR = 0x076E, // Sound Data Volume Right REG_P_MVOLXL = 0x0770, // Current Master Volume Left - unimplemented REG_P_MVOLXR = 0x0772, // Current Master Volume Right - unimplemented - + // Another unimplemented section R_IIR_ALPHA = 0x0774, // IIR alpha (% used) R_ACC_COEF_A = 0x0776, @@ -141,27 +141,27 @@ R_MIX_DEST_B1 = 0x0338, R_ACC_COEF_D = 0x077C, R_IIR_COEF = 0x077E, R_FB_ALPHA = 0x0780, // feedback alpha (% used) - R_FB_X = 0x0782, // feedback + R_FB_X = 0x0782, // feedback R_IN_COEF_L = 0x0784, R_IN_COEF_R = 0x0786, // end unimplemented section - + REG_C1_BVOLL = 0x0794, REG_C1_BVOLR = 0x0796, - + SPDIF_OUT = 0x07C0, // SPDIF Out: OFF/'PCM'/Bitstream/Bypass - unimplemented - REG_IRQINFO = 0x07C2, + REG_IRQINFO = 0x07C2, SPDIF_MODE = 0x07C6, // unimplemented SPDIF_MEDIA = 0x07C8, // SPDIF Media: 'CD'/DVD - unimplemented - SPDIF_COPY_PROT = 0x07CC // SPDIF Copy Protection - unimplemented + SPDIF_COPY_PROT = 0x07CC // SPDIF Copy Protection - unimplemented // NOTE: SPDIF_COPY is defined in Linux kernel headers as 0x0004. -}; +}; // Not sure if this is a good idea, but I don't feel like retyping it, so I'll leave it in for now. /*struct core_registers { u16 pad[179]; - + u16 fmod1; u16 pad1; u16 fmod2; u16 pad2; u16 s_non; u16 pad3[3]; @@ -183,8 +183,8 @@ R_MIX_DEST_B1 = 0x0338, u16 spu_addr_lo; u16 pad19; u16 spu_data; u16 pad20; u16 dma_ctrl; u16 pad21; - u16 admas; u16 pad22[16]; - + u16 admas; u16 pad22[16]; + // Not complete past this point (not padded properly) u16 va_ssa; u16 pad23[3]; //0x01C0, // Waveform data starting address u16 va_lsax; u16 pad24[3]; //0x01C4, // Loop point address @@ -212,12 +212,12 @@ R_MIX_DEST_B1 = 0x0338, u16 mix_dest_a1; u16 pad46; //0x0330, u16 mix_dest_b0; u16 pad47; //0x0334, u16 mix_dest_b1; u16 pad48; // 0x0338, - u16 a_eea; u16 pad49; //0x033C, + u16 a_eea; u16 pad49; //0x033C, u16 end1; u16 pad 50; //0x0340, // End Point passed flag u16 end2; u16 pad 51; //0x0342, u16 statx; //0x0344, // Status register? };*/ - + // These SPDIF defines aren't used yet - swiped from spu2ghz, like a number of the registers I added in. // -- arcum42 #define SPDIF_OUT_OFF 0x0000 //no spdif output diff --git a/plugins/zerospu2/zerodma.cpp b/plugins/zerospu2/zerodma.cpp index 215b97ad07..aa6a878ee1 100644 --- a/plugins/zerospu2/zerodma.cpp +++ b/plugins/zerospu2/zerodma.cpp @@ -28,7 +28,7 @@ void CALLBACK SPU2readDMAMem(u16 *pMem, int size, int channel) { u32 spuaddr = C_SPUADDR(channel); - + SPU2_LOG("SPU2 readDMAMem(%d) size %x, addr: %x\n", channel, size, pMem); for (u32 i = 0; i < size; i++) @@ -71,23 +71,23 @@ void CALLBACK SPU2readDMA7Mem(u16* pMem, int size) // WRITE // AutoDMA's are used to transfer to the DIRECT INPUT area of the spu2 memory -// Left and Right channels are always interleaved together in the transfer so +// Left and Right channels are always interleaved together in the transfer so // the AutoDMA's deinterleaves them and transfers them. An interrupt is -// generated when half of the buffer (256 short-words for left and 256 -// short-words for right ) has been transferred. Another interrupt occurs at +// generated when half of the buffer (256 short-words for left and 256 +// short-words for right ) has been transferred. Another interrupt occurs at // the end of the transfer. int ADMASWrite(int channel) { u32 spuaddr; ADMA *Adma = &adma[channel]; - + if (interrupt & 0x2) { WARN_LOG("ADMASWrite(%d) returning for interrupt\n", channel); return 0; } - + if (Adma->AmountLeft <= 0) { WARN_LOG("ADMASWrite(%d) amount left is 0\n", channel); @@ -98,13 +98,13 @@ int ADMASWrite(int channel) spuaddr = C_SPUADDR(channel); u32 left_addr = spuaddr + 0x2000 + c_offset(channel); u32 right_addr = left_addr + 0x200; - + // SPU2 Deinterleaves the Left and Right Channels memcpy((s16*)(spu2mem + left_addr),(s16*)Adma->MemAddr,512); Adma->MemAddr += 256; memcpy((s16*)(spu2mem + right_addr),(s16*)Adma->MemAddr,512); Adma->MemAddr += 256; - + if (spu2attr(channel).irq && (irq_test1(channel, spuaddr) || irq_test2(channel, spuaddr))) { IRQINFO |= (4 * (channel + 1)); @@ -114,7 +114,7 @@ int ADMASWrite(int channel) spuaddr = (spuaddr + 256) & 511; C_SPUADDR_SET(spuaddr, channel); - + Adma->AmountLeft -= 512; return (Adma->AmountLeft <= 0); @@ -132,12 +132,12 @@ void SPU2writeDMAMem(u16* pMem, int size, int channel) if (spu2admas(channel) && (spu2attr(channel).dma == 0) && size) { if (!Adma->Enabled ) Adma->Index = 0; - + Adma->MemAddr = pMem; Adma->AmountLeft = size; SPUTargetCycle[channel] = size; spu2stat_clear_80(channel); - if (!Adma->Enabled || (Adma->Index > 384)) + if (!Adma->Enabled || (Adma->Index > 384)) { C_SPUADDR_SET(0, channel); if (ADMASWrite(channel)) @@ -160,14 +160,14 @@ void SPU2writeDMAMem(u16* pMem, int size, int channel) memcpy((u8*)(spu2mem + spuaddr),(u8*)pMem,size << 1); spuaddr += size; C_SPUADDR_SET(spuaddr, channel); - + if (spu2attr(channel).irq && (spuaddr < C_IRQA(channel) && (C_IRQA(channel) <= (spuaddr + 0x20)))) { IRQINFO |= 4 * (channel + 1); SPU2_LOG("SPU2writeDMAMem:interrupt\n"); irqCallbackSPU2(); } - + if (spuaddr > 0xFFFFE) spuaddr = 0x2800; C_SPUADDR_SET(spuaddr, channel); @@ -215,13 +215,13 @@ s32 CALLBACK SPU2dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProces // Needs implementation. return 0; } - + s32 CALLBACK SPU2dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed) { // Needs implementation. return 0; } - + void CALLBACK SPU2dmaInterrupt(s32 channel) { LOG_CALLBACK("SPU2dmaInterruptDMA()\n"); diff --git a/plugins/zerospu2/zerospu2.cpp b/plugins/zerospu2/zerospu2.cpp index 1118bb9ad5..905a73831b 100644 --- a/plugins/zerospu2/zerospu2.cpp +++ b/plugins/zerospu2/zerospu2.cpp @@ -20,7 +20,7 @@ #ifdef _WIN32 #include "svnrev.h" -#endif +#endif #include "Targets/SoundTargets.h" @@ -154,23 +154,23 @@ static void InitLibraryName() } -u32 CALLBACK PS2EgetLibType() +u32 CALLBACK PS2EgetLibType() { return PS2E_LT_SPU2; } -char* CALLBACK PS2EgetLibName() +char* CALLBACK PS2EgetLibName() { InitLibraryName(); return libraryName; } -u32 CALLBACK PS2EgetLibVersion2(u32 type) +u32 CALLBACK PS2EgetLibVersion2(u32 type) { return (SPU2_MINOR<<24) | (SPU2_VERSION<<16) | (SPU2_REVISION<<8) | SPU2_BUILD; } -void __Log(char *fmt, ...) +void __Log(char *fmt, ...) { va_list list; @@ -181,7 +181,7 @@ void __Log(char *fmt, ...) va_end(list); } -void __LogToConsole(const char *fmt, ...) +void __LogToConsole(const char *fmt, ...) { va_list list; @@ -222,26 +222,26 @@ s32 CALLBACK SPU2init() LOG_CALLBACK("SPU2init()\n"); spu2Log = fopen("logs/spu2.txt", "w"); if (spu2Log) setvbuf(spu2Log, NULL, _IONBF, 0); - - SPU2_LOG("Spu2 null version %d,%d\n",SPU2_REVISION,SPU2_BUILD); + + SPU2_LOG("Spu2 null version %d,%d\n",SPU2_REVISION,SPU2_BUILD); SPU2_LOG("SPU2init\n"); - + #ifdef _WIN32 QueryPerformanceFrequency(&g_counterfreq); #endif - + InitApi(); spu2regs = (s8*)malloc(0x10000); spu2mem = (u16*)malloc(0x200000); // 2Mb memset(spu2regs, 0, 0x10000); memset(spu2mem, 0, 0x200000); - if ((spu2mem == NULL) || (spu2regs == NULL)) + if ((spu2mem == NULL) || (spu2regs == NULL)) { - SysMessage("Error allocating Memory\n"); + SysMessage("Error allocating Memory\n"); return -1; } - + memset(dwEndChannel2, 0, sizeof(dwEndChannel2)); memset(dwNewChannel2, 0, sizeof(dwNewChannel2)); memset(iFMod, 0, sizeof(iFMod)); @@ -255,7 +255,7 @@ s32 CALLBACK SPU2init() voices[i+24].memoffset = 0x400; // init each channel - for (u32 i = 0; i < ArraySize(voices); ++i) + for (u32 i = 0; i < ArraySize(voices); ++i) { voices[i].init(i); } @@ -263,7 +263,7 @@ s32 CALLBACK SPU2init() return 0; } -s32 CALLBACK SPU2open(void *pDsp) +s32 CALLBACK SPU2open(void *pDsp) { LOG_CALLBACK("SPU2open()\n"); #ifdef _WIN32 @@ -280,7 +280,7 @@ s32 CALLBACK SPU2open(void *pDsp) SPUTargetCycle[0] = SPUTargetCycle[1] = 0; s_nDropPacket = 0; - if ( conf.options & OPTION_TIMESTRETCH ) + if ( conf.options & OPTION_TIMESTRETCH ) { pSoundTouch = new soundtouch::SoundTouch(); pSoundTouch->setSampleRate(SAMPLE_RATE); @@ -295,7 +295,7 @@ s32 CALLBACK SPU2open(void *pDsp) g_bPlaySound = !(conf.options&OPTION_MUTE); - if ( g_bPlaySound && SetupSound() != 0 ) + if ( g_bPlaySound && SetupSound() != 0 ) { SysMessage("ZeroSPU2: Failed to initialize sound"); g_bPlaySound = false; @@ -303,7 +303,7 @@ s32 CALLBACK SPU2open(void *pDsp) if ( g_bPlaySound ) { // initialize the audio buffers - for (u32 i = 0; i < ArraySize(s_pAudioBuffers); ++i) + for (u32 i = 0; i < ArraySize(s_pAudioBuffers); ++i) { s_pAudioBuffers[i].pbuf = (u8*)_aligned_malloc(4 * NS_TOTAL_SIZE, 16); // 4 bytes for each sample s_pAudioBuffers[i].len = 0; @@ -313,24 +313,24 @@ s32 CALLBACK SPU2open(void *pDsp) s_nQueuedBuffers = 0; s_pCurOutput = (s16*)s_pAudioBuffers[0].pbuf; assert( s_pCurOutput != NULL); - - for (s32 i = 0; i < ArraySize(s_nDurations); ++i) + + for (s32 i = 0; i < ArraySize(s_nDurations); ++i) { s_nDurations[i] = NSFRAMES*1000; } s_nTotalDuration = ArraySize(s_nDurations)*NSFRAMES*1000; s_nCurDuration = 0; - + // launch the thread s_bThreadExit = false; #ifdef _WIN32 s_threadSPU2 = CreateThread(NULL, 0, SPU2ThreadProc, NULL, 0, NULL); - if ( s_threadSPU2 == NULL ) + if ( s_threadSPU2 == NULL ) { return -1; } #else - if ( pthread_create(&s_threadSPU2, NULL, SPU2ThreadProc, NULL) != 0 ) + if ( pthread_create(&s_threadSPU2, NULL, SPU2ThreadProc, NULL) != 0 ) { SysMessage("ZeroSPU2: Failed to create spu2thread\n"); return -1; @@ -342,7 +342,7 @@ s32 CALLBACK SPU2open(void *pDsp) return 0; } -void CALLBACK SPU2close() +void CALLBACK SPU2close() { LOG_CALLBACK("SPU2close()\n"); g_nSpuInit = 0; @@ -363,8 +363,8 @@ void CALLBACK SPU2close() delete g_pWavRecord; g_pWavRecord = NULL; delete pSoundTouch; pSoundTouch = NULL; - - for (u32 i = 0; i < ArraySize(s_pAudioBuffers); ++i) + + for (u32 i = 0; i < ArraySize(s_pAudioBuffers); ++i) { _aligned_free(s_pAudioBuffers[i].pbuf); } @@ -384,7 +384,7 @@ void CALLBACK SPU2async(u32 cycle) { //LOG_CALLBACK("SPU2async()\n"); SPUCycles += cycle; - + if (interrupt & (1<<2)) { if (SPUCycles - SPUStartCycle[1] >= SPUTargetCycle[1]) @@ -394,7 +394,7 @@ void CALLBACK SPU2async(u32 cycle) irqCallbackDMA7(); #endif } - + } if (interrupt & (1<<1)) @@ -408,15 +408,15 @@ void CALLBACK SPU2async(u32 cycle) } } - if ( g_nSpuInit ) + if ( g_nSpuInit ) { - while((SPUCycles-SPUWorkerCycles > 0) && (CYCLES_PER_MS < (SPUCycles - SPUWorkerCycles))) + while((SPUCycles-SPUWorkerCycles > 0) && (CYCLES_PER_MS < (SPUCycles - SPUWorkerCycles))) { SPU2Worker(); SPUWorkerCycles += CYCLES_PER_MS; } } - else + else SPUWorkerCycles = SPUCycles; } @@ -434,14 +434,14 @@ void InitADSR() // INIT ADSR { r+=rs; rd++; - - if (rd==5) + + if (rd==5) { rd=1; rs*=2; } } - + if (r>0x3FFFFFFF) r=0x3FFFFFFF; RateTable[i]=r; } @@ -450,7 +450,7 @@ void InitADSR() // INIT ADSR s32 MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR { u32 rateadd[8] = { 0, 4, 6, 8, 9, 10, 11, 12 }; - + if (pvoice->bStop) // should be stopped: { if (pvoice->ADSRX.ReleaseModeExp) // do release @@ -464,7 +464,7 @@ s32 MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR } // bIgnoreLoop sets EnvelopeVol to 0 anyways, so we can use one if statement rather then two. - if ((pvoice->ADSRX.EnvelopeVol<0) || (pvoice->bIgnoreLoop == 0)) + if ((pvoice->ADSRX.EnvelopeVol<0) || (pvoice->bIgnoreLoop == 0)) { pvoice->ADSRX.EnvelopeVol=0; pvoice->bOn=false; @@ -478,19 +478,19 @@ s32 MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR } pvoice->ADSRX.lVolume=pvoice->ADSRX.EnvelopeVol>>21; - + return pvoice->ADSRX.lVolume; } else // not stopped yet? { s32 temp = ((pvoice->ADSRX.EnvelopeVol>>28)&0x7); - - switch (pvoice->ADSRX.State) + + switch (pvoice->ADSRX.State) { case 0: // -> attack if (pvoice->ADSRX.AttackModeExp) { - if (pvoice->ADSRX.EnvelopeVol<0x60000000) + if (pvoice->ADSRX.EnvelopeVol<0x60000000) pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.AttackRate^0x7F) - 0x10 + 32]; else pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.AttackRate^0x7F) - 0x18 + 32]; @@ -500,22 +500,22 @@ s32 MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.AttackRate^0x7F) - 0x10 + 32]; } - if (pvoice->ADSRX.EnvelopeVol<0) + if (pvoice->ADSRX.EnvelopeVol<0) { pvoice->ADSRX.EnvelopeVol=0x7FFFFFFF; pvoice->ADSRX.State=1; } break; - + case 1: // -> decay pvoice->ADSRX.EnvelopeVol-=RateTable[(4*(pvoice->ADSRX.DecayRate^0x1F)) - 0x18+ rateadd[temp] + 32]; if (pvoice->ADSRX.EnvelopeVol<0) pvoice->ADSRX.EnvelopeVol=0; - + if (((pvoice->ADSRX.EnvelopeVol>>27)&0xF) <= pvoice->ADSRX.SustainLevel) pvoice->ADSRX.State=2; break; - + case 2: // -> sustain if (pvoice->ADSRX.SustainIncrease) { @@ -536,16 +536,16 @@ s32 MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR if (pvoice->ADSRX.EnvelopeVol<0) pvoice->ADSRX.EnvelopeVol=0; } break; - + default: // This should never happen. return 0; } - + pvoice->ADSRX.lVolume=pvoice->ADSRX.EnvelopeVol>>21; return pvoice->ADSRX.lVolume; } - + return 0; } @@ -554,7 +554,7 @@ void MixChannels(s32 channel) // mix all channels s32 left_vol, right_vol; ADMA *Adma; - + if (channel == 0) { Adma = &adma[0]; @@ -567,22 +567,22 @@ void MixChannels(s32 channel) left_vol = REG_C1_BVOLL; right_vol = REG_C1_BVOLR; } - - if ((spu2mmix(channel) & 0xF0) && spu2admas(channel)) + + if ((spu2mmix(channel) & 0xF0) && spu2admas(channel)) { - for (u32 ns = 0; ns < NSSIZE; ns++) - { + for (u32 ns = 0; ns < NSSIZE; ns++) + { u16 left_reg = 0x2000 + c_offset(channel) + Adma->Index; u16 right_reg = left_reg + 0x200; - - if ((spu2mmix(channel) & 0x80)) + + if ((spu2mmix(channel) & 0x80)) s_buffers[ns][0] += (((s16*)spu2mem)[left_reg]*(s32)spu2Ru16(left_vol))>>16; - if ((spu2mmix(channel) & 0x40)) + if ((spu2mmix(channel) & 0x40)) s_buffers[ns][1] += (((s16*)spu2mem)[right_reg]*(s32)spu2Ru16(right_vol))>>16; - + Adma->Index +=1; MemAddr[channel] += 4; - + if (Adma->Index == 128 || Adma->Index == 384) { if (ADMASWrite(channel)) @@ -598,12 +598,12 @@ void MixChannels(s32 channel) else irqCallbackDMA7(); #endif - + } if (channel == 1) Adma->Enabled = 2; } - if (Adma->Index == 512) + if (Adma->Index == 512) { if ( Adma->Enabled == 2 ) Adma->Enabled = 0; Adma->Index = 0; @@ -615,7 +615,7 @@ void MixChannels(s32 channel) // resamples pStereoSamples void ResampleLinear(s16* pStereoSamples, s32 oldsamples, s16* pNewSamples, s32 newsamples) { - for (s32 i = 0; i < newsamples; ++i) + for (s32 i = 0; i < newsamples; ++i) { s32 io = i * oldsamples; s32 old = io / newsamples; @@ -638,24 +638,24 @@ static __forceinline u32 GetNewSamples(s32 nReadBuf) { u32 NewSamples = s_pAudioBuffers[nReadBuf].avgtime / 1000; s32 bytesbuf = SoundGetBytesBuffered() * 10; - + if (bytesbuf < MaxBuffer) { NewSamples += 1; } - else if (bytesbuf > MaxBuffer * 5) + else if (bytesbuf > MaxBuffer * 5) { // check the current timestamp, if too far apart, speed up audio //WARN_LOG("making faster %d\n", timeGetTime() - s_pAudioBuffers[nReadBuf].timestamp); NewSamples = NewSamples - ((bytesbuf - 400000) / 100000); } - if (s_nDropPacket > 0) + if (s_nDropPacket > 0) { s_nDropPacket--; NewSamples -= 1; } - + return min(NewSamples * NSSIZE, NS_TOTAL_SIZE * 3); } @@ -663,7 +663,7 @@ static __forceinline void ExtractSamples() { // extract 2*NSFRAMES ms at a time s32 nOutSamples; - + do { nOutSamples = pSoundTouch->receiveSamples(s_floatBuffer, NS_TOTAL_SIZE * 5); @@ -686,19 +686,19 @@ void* SPU2ThreadProc(void* lpParam) { s32 nReadBuf = 0; - while (!s_bThreadExit) + while (!s_bThreadExit) { - if (!(conf.options&OPTION_REALTIME)) + if (!(conf.options&OPTION_REALTIME)) { - while(s_nQueuedBuffers< 3 && !s_bThreadExit) + while(s_nQueuedBuffers< 3 && !s_bThreadExit) { //Sleeping Sleep(1); if (s_bThreadExit) return NULL; } - while( SoundGetBytesBuffered() > 72000 ) + while( SoundGetBytesBuffered() > 72000 ) { //Bytes buffered Sleep(1); @@ -706,9 +706,9 @@ void* SPU2ThreadProc(void* lpParam) if (s_bThreadExit) return NULL; } } - else + else { - while(s_nQueuedBuffers< 1 && !s_bThreadExit) + while(s_nQueuedBuffers< 1 && !s_bThreadExit) { //Sleeping Sleep(1); @@ -766,8 +766,8 @@ void SoundOn(s32 start,s32 end,u16 val) // SOUND ON PSX COMAND void SoundOff(s32 start,s32 end,u16 val) // SOUND OFF PSX COMMAND { for (s32 ch=start;ch>=1) // loop channels - { - if (val&1) voices[ch].bStop=true; // && s_chan[i].bOn) mmm... + { + if (val&1) voices[ch].bStop=true; // && s_chan[i].bOn) mmm... } } @@ -776,10 +776,10 @@ void FModOn(s32 start,s32 end,u16 val) // FMOD ON PSX COMMAND s32 ch; for (ch=start;ch>=1) // loop channels - { - if (val&1) + { + if (val&1) { // -> fmod on/off - if (ch>0) + if (ch>0) { voices[ch].bFMod=1; // --> sound channel voices[ch-1].bFMod=2; // --> freq channel @@ -793,21 +793,21 @@ void FModOn(s32 start,s32 end,u16 val) // FMOD ON PSX COMMAND void VolumeOn(s32 start,s32 end,u16 val,s32 iRight) // VOLUME ON PSX COMMAND { s32 ch; - + for (ch=start;ch>=1) // loop channels - { - if (val&1) + { + if (val&1) { // -> reverb on/off - if (iRight) + if (iRight) voices[ch].bVolumeR = true; - else + else voices[ch].bVolumeL = true; } - else + else { - if (iRight) + if (iRight) voices[ch].bVolumeR = false; - else + else voices[ch].bVolumeL = false; } } @@ -829,9 +829,9 @@ void CALLBACK SPU2write(u32 mem, u16 value) if ((r<0x0180) || (r>=0x0400 && r<0x0580)) // u32s are always >= 0. { s32 ch=0; - if (r >= 0x400) + if (r >= 0x400) ch = ((r - 0x400) >> 4) + 24; - else + else ch = (r >> 4); VOICE_PROCESSED* pvoice = &voices[ch]; @@ -845,9 +845,9 @@ void CALLBACK SPU2write(u32 mem, u16 value) case 4: { s32 NP; - if (value> 0x3fff) + if (value> 0x3fff) NP=0x3fff; // get pitch val - else + else NP=value; pvoice->pvoice->pitch = NP; @@ -859,7 +859,7 @@ void CALLBACK SPU2write(u32 mem, u16 value) } case 6: { - pvoice->ADSRX.AttackModeExp=(value&0x8000)?1:0; + pvoice->ADSRX.AttackModeExp=(value&0x8000)?1:0; pvoice->ADSRX.AttackRate = ((value>>8) & 0x007f); pvoice->ADSRX.DecayRate = (((value>>4) & 0x000f)); pvoice->ADSRX.SustainLevel = (value & 0x000f); @@ -876,7 +876,7 @@ void CALLBACK SPU2write(u32 mem, u16 value) return; } - + // more channel info if ((r>=0x01c0 && r<0x02E0)||(r>=0x05c0 && r<0x06E0)) { @@ -926,51 +926,51 @@ void CALLBACK SPU2write(u32 mem, u16 value) } // process non-channel data - switch(mem & 0xffff) + switch(mem & 0xffff) { case REG_C0_SPUDATA: spuaddr = C0_SPUADDR(); spu2mem[spuaddr] = value; spuaddr++; - + if (spu2attr0.irq && (C0_IRQA() == spuaddr)) { IRQINFO |= 4; SPU2_LOG("SPU2write:C0_CPUDATA interrupt\n"); irqCallbackSPU2(); } - + if (spuaddr>0xFFFFE) spuaddr = 0x2800; - + C0_SPUADDR_SET(spuaddr); spu2stat_clear_80(0); spu2attr1.irq = 0; break; - + case REG_C1_SPUDATA: spuaddr = C1_SPUADDR(); spu2mem[spuaddr] = value; spuaddr++; - + if (spu2attr1.irq && (C1_IRQA() == spuaddr)) { IRQINFO |= 8; SPU2_LOG("SPU2write:C1_CPUDATA interrupt\n"); irqCallbackSPU2(); } - + if (spuaddr>0xFFFFE) spuaddr = 0x2800; - + C1_SPUADDR_SET(spuaddr); spu2stat_clear_80(1); spu2attr0.irq = 0; break; - + case REG_C0_IRQA_HI: case REG_C0_IRQA_LO: pSpuIrq[0] = spu2mem + C0_IRQA(); break; - + case REG_C1_IRQA_HI: case REG_C1_IRQA_LO: pSpuIrq[1] = spu2mem + C1_IRQA(); @@ -986,13 +986,13 @@ void CALLBACK SPU2write(u32 mem, u16 value) // clear interrupt if (!(value & 0x40)) IRQINFO &= ~0x4; break; - + case REG_C1_CTRL: spu2Ru16(mem) = value; // clear interrupt if (!(value & 0x40)) IRQINFO &= ~0x8; break; - + // Could probably simplify case REG_C0_SPUON1: SoundOn(0,16,value); break; case REG_C0_SPUON2: SoundOn(16,24,value); break; @@ -1033,28 +1033,28 @@ u16 CALLBACK SPU2read(u32 mem) u16 ret = 0; u32 r = mem & 0xffff; // register - // channel info + // channel info // if the register is any of the regs before core 0, or is somewhere between core 0 and 1... if ((r < 0x0180) || (r >= 0x0400 && r < 0x0580)) // u32s are always >= 0. { s32 ch = 0; - - if (r >= 0x400) + + if (r >= 0x400) ch=((r - 0x400) >> 4) + 24; - else + else ch = (r >> 4); VOICE_PROCESSED* pvoice = &voices[ch]; - + if ((r&0x0f) == 10) return (u16)(pvoice->ADSRX.EnvelopeVol >> 16); } - + if ((r>=REG_VA_SSA && r=0x05c0 && r<0x06E0)) // some channel info? { s32 ch = 0; u32 rx = r; - + if (rx >= 0x400) { ch = 24; @@ -1065,7 +1065,7 @@ u16 CALLBACK SPU2read(u32 mem) rx -= (ch % 24) * 12; VOICE_PROCESSED* pvoice = &voices[ch]; - switch(rx) + switch(rx) { case REG_VA_SSA: ret = ((((uptr)pvoice->pStart-(uptr)spu2mem)>>17)&0x3F); @@ -1091,7 +1091,7 @@ u16 CALLBACK SPU2read(u32 mem) return ret; } - switch(mem & 0xffff) + switch(mem & 0xffff) { case REG_C0_SPUDATA: spuaddr = C0_SPUADDR(); @@ -1100,7 +1100,7 @@ u16 CALLBACK SPU2read(u32 mem) if (spuaddr > 0xfffff) spuaddr=0; C0_SPUADDR_SET(spuaddr); break; - + case REG_C1_SPUDATA: spuaddr = C1_SPUADDR(); ret = spu2mem[spuaddr]; @@ -1114,7 +1114,7 @@ u16 CALLBACK SPU2read(u32 mem) case REG_C0_END2: ret = (dwEndChannel2[0]>>16); break; case REG_C1_END2: ret = (dwEndChannel2[1]>>16); break; - case REG_IRQINFO: + case REG_IRQINFO: ret = IRQINFO; break; @@ -1170,39 +1170,39 @@ s32 CALLBACK SPU2test() int CALLBACK SPU2setupRecording(int start, void* pData) { LOG_CALLBACK("SPU2setupRecording()\n"); - if ( start ) + if ( start ) { conf.options |= OPTION_RECORDING; WARN_LOG("ZeroSPU2: started recording at %s\n", RECORD_FILENAME); } - else + else { conf.options &= ~OPTION_RECORDING; WARN_LOG("ZeroSPU2: stopped recording\n"); } - + return 1; } void save_data(freezeData *data) { SPU2freezeData *spud; - + spud = (SPU2freezeData*)data->data; spud->version = 0x70000002; memcpy(spud->spu2regs, spu2regs, 0x10000); memcpy(spud->spu2mem, spu2mem, 0x200000); - + spud->nSpuIrq[0] = (s32)(pSpuIrq[0] - spu2mem); spud->nSpuIrq[1] = (s32)(pSpuIrq[1] - spu2mem); - + memcpy(spud->dwNewChannel2, dwNewChannel2, sizeof(dwNewChannel2)); memcpy(spud->dwEndChannel2, dwEndChannel2, sizeof(dwEndChannel2)); - + spud->dwNoiseVal = dwNoiseVal; spud->interrupt = interrupt; - + memcpy(spud->iFMod, iFMod, sizeof(iFMod)); memcpy(spud->MemAddr, MemAddr, sizeof(MemAddr)); @@ -1213,20 +1213,20 @@ void save_data(freezeData *data) spud->SPUCycles = SPUCycles; spud->SPUWorkerCycles = SPUWorkerCycles; - + memcpy(spud->SPUStartCycle, SPUStartCycle, sizeof(SPUStartCycle)); memcpy(spud->SPUTargetCycle, SPUTargetCycle, sizeof(SPUTargetCycle)); - for (u32 i = 0; i < ArraySize(s_nDurations); ++i) + for (u32 i = 0; i < ArraySize(s_nDurations); ++i) { s_nDurations[i] = NSFRAMES*1000; } - + s_nTotalDuration = ArraySize(s_nDurations)*NSFRAMES*1000; s_nCurDuration = 0; - + spud->voicesize = SPU_VOICE_STATE_SIZE; - for (u32 i = 0; i < ArraySize(voices); ++i) + for (u32 i = 0; i < ArraySize(voices); ++i) { memcpy(&spud->voices[i], &voices[i], SPU_VOICE_STATE_SIZE); spud->voices[i].pStart = (u8*)((uptr)voices[i].pStart-(uptr)spu2mem); @@ -1242,30 +1242,30 @@ void save_data(freezeData *data) void load_data(freezeData *data) { SPU2freezeData *spud; - - spud = (SPU2freezeData*)data->data; - - if (spud->version != 0x70000002) + + spud = (SPU2freezeData*)data->data; + + if (spud->version != 0x70000002) { ERROR_LOG("zerospu2: Sound data either corrupted or from another plugin. Ignoring.\n"); return; } - + memcpy(spu2regs, spud->spu2regs, 0x10000); memcpy(spu2mem, spud->spu2mem, 0x200000); - + pSpuIrq[0] = spu2mem + spud->nSpuIrq[0]; pSpuIrq[1] = spu2mem + spud->nSpuIrq[1]; - + memcpy(dwNewChannel2, spud->dwNewChannel2, sizeof(dwNewChannel2)); memcpy(dwEndChannel2, spud->dwEndChannel2, sizeof(dwEndChannel2)); - + dwNoiseVal = spud->dwNoiseVal; interrupt = spud->interrupt; - + memcpy(iFMod, spud->iFMod, sizeof(iFMod)); memcpy(MemAddr, spud->MemAddr, sizeof(MemAddr)); - + adma[0] = spud->adma[0]; adma[1] = spud->adma[1]; adma[0].MemAddr = (u16*)(g_pDMABaseAddr+spud->AdmaMemAddr[0]); @@ -1273,11 +1273,11 @@ void load_data(freezeData *data) SPUCycles = spud->SPUCycles; SPUWorkerCycles = spud->SPUWorkerCycles; - + memcpy(SPUStartCycle, spud->SPUStartCycle, sizeof(SPUStartCycle)); memcpy(SPUTargetCycle, spud->SPUTargetCycle, sizeof(SPUTargetCycle)); - for (u32 i = 0; i < ArraySize(voices); ++i) + for (u32 i = 0; i < ArraySize(voices); ++i) { memcpy(&voices[i], &spud->voices[i], min((s32)SPU_VOICE_STATE_SIZE, spud->voicesize)); voices[i].pStart = (u8*)((uptr)spud->voices[i].pStart+(uptr)spu2mem); @@ -1287,12 +1287,12 @@ void load_data(freezeData *data) s_GlobalTimeStamp = 0; g_startcount = 0xffffffff; - - for (u32 i = 0; i < ArraySize(s_nDurations); ++i) + + for (u32 i = 0; i < ArraySize(s_nDurations); ++i) { s_nDurations[i] = NSFRAMES*1000; } - + s_nTotalDuration = ArraySize(s_nDurations)*NSFRAMES*1000; s_nCurDuration = 0; s_nQueuedBuffers = 0; @@ -1318,6 +1318,6 @@ s32 CALLBACK SPU2freeze(int mode, freezeData *data) default: break; } - + return 0; } diff --git a/plugins/zerospu2/zerospu2.h b/plugins/zerospu2/zerospu2.h index 9f3501e130..87ceca0c18 100644 --- a/plugins/zerospu2/zerospu2.h +++ b/plugins/zerospu2/zerospu2.h @@ -36,7 +36,7 @@ using namespace std; extern FILE *spu2Log; extern string s_strIniPath; -// Prints most of the function names of the callbacks as they are called by pcsx2. +// Prints most of the function names of the callbacks as they are called by pcsx2. // I'm keeping the code in because I have a feeling it will come in handy. //#define PRINT_CALLBACKS @@ -140,7 +140,7 @@ static __forceinline void clamp16(s32 &dest) { if (dest < -32768L) dest = -32768L; - else if (dest > 32767L) + else if (dest > 32767L) dest = 32767L; } @@ -148,9 +148,9 @@ static __forceinline void clampandwrite16(s16 &dest, s32 &value) { if (value < -32768) dest = -32768; - else if (value > 32767) + else if (value > 32767) dest = 32767; - else + else dest = (s16)value; } @@ -158,7 +158,7 @@ struct tSPU_ATTR { u16 extCd : 1; u16 extAudio : 1; - u16 cdreverb : 1; + u16 cdreverb : 1; u16 extr : 1; // external reverb u16 dma : 2; // 1 - no dma, 2 - write, 3 - read u16 irq : 1; @@ -239,7 +239,7 @@ static __forceinline void SPU2_SET32BIT(u32 value, u32 lo, u32 hi) static __forceinline u32 C_IRQA(s32 c) { - if (c == 0) + if (c == 0) return SPU2_GET32BIT(REG_C0_IRQA_LO, REG_C0_IRQA_HI); else return SPU2_GET32BIT(REG_C1_IRQA_LO, REG_C1_IRQA_HI); @@ -290,16 +290,16 @@ struct _SPU_VOICE u16 SustainLvl : 4; u16 DecayRate : 4; - u16 AttackRate : 7; + u16 AttackRate : 7; u16 AttackExp : 1; // if 0, linear - + u16 ReleaseRate : 5; u16 ReleaseExp : 1; // if 0, linear u16 SustainRate : 7; u16 res1 : 1; u16 SustainDec : 1; // if 0, inc u16 SustainExp : 1; // if 0, linear - + u16 AdsrVol; u16 Address; // add / 8 u16 RepeatAddr; // gets reset when sample starts @@ -359,7 +359,7 @@ struct VOICE_PROCESSED s32 iIrqDone; // debug irq done flag s32 s_1, s_2; // last decoding infos - s32 iOldNoise; // old noise val for this channel + s32 iOldNoise; // old noise val for this channel s32 iActFreq, iUsedFreq; // current psx pitch & pc pitch s32 iStartAddr, iLoopAddr, iNextAddr; @@ -371,7 +371,7 @@ struct VOICE_PROCESSED bool bIgnoreLoop, bNew, bNoise, bReverb, bOn, bStop, bVolChanged; bool bVolumeR, bVolumeL; - + // end save state /////////////////// @@ -385,7 +385,7 @@ struct VOICE_PROCESSED void init(s32 i) { chanid = i; - + if (chanid > 23) { memoffset = 0x400; @@ -396,7 +396,7 @@ struct VOICE_PROCESSED memoffset = 0x0; memchannel = 0; } - + pLoop = pStart = pCurr = (u8*)spu2mem; pvoice = (_SPU_VOICE*)((u8*)spu2regs + memoffset) + (i % 24); @@ -421,7 +421,7 @@ struct ADMA u16* MemAddr; s32 Index; s32 AmountLeft; - s32 Enabled; + s32 Enabled; // used to make sure that ADMA doesn't get interrupted with a writeDMA call }; diff --git a/plugins/zerospu2/zeroworker.cpp b/plugins/zerospu2/zeroworker.cpp index 55e79c073f..538445d659 100644 --- a/plugins/zerospu2/zeroworker.cpp +++ b/plugins/zerospu2/zeroworker.cpp @@ -24,13 +24,13 @@ s32 g_logsound = 0; WavOutFile* g_pWavRecord=NULL; // used for recording -const s32 f[5][2] = { +const s32 f[5][2] = { { 0, 0 }, { 60, 0 }, { 115, -52 }, { 98, -55 }, { 122, -60 } }; - + s32 predict_nr, shift_factor, flags; s32 s_1, s_2; @@ -42,7 +42,7 @@ static __forceinline s32 SetPacket(s32 val) ret += ((s_1 * f[predict_nr][0]) >> 6) + ((s_2 * f[predict_nr][1]) >> 6); s_2 = s_1; s_1 = ret; - + return ret; } @@ -50,7 +50,7 @@ void SPU2Loop(VOICE_PROCESSED* pChannel, u32 ch) { u8* start; u32 nSample; - + for (u32 ns = 0; ns < NSSIZE; ns++) { // fmod freq channel @@ -61,7 +61,7 @@ void SPU2Loop(VOICE_PROCESSED* pChannel, u32 ch) if (pChannel->iSBPos == 28) // 28 reached? { start=pChannel->pCurr; // set up the current pos - + // special "stop" sign if (start == (u8*)-1) //!pChannel->bOn { @@ -70,40 +70,40 @@ void SPU2Loop(VOICE_PROCESSED* pChannel, u32 ch) pChannel->ADSRX.EnvelopeVol = 0; return; // -> and done for this channel } - + predict_nr = (s32)start[0]; shift_factor = predict_nr&0xf; predict_nr >>= 4; flags=(s32)start[1]; start += 2; - + pChannel->iSBPos = 0; // decode the 16byte packet s_1 = pChannel->s_1; s_2 = pChannel->s_2; - + for (nSample=0; nSample<28; ++start) { s32 d = (s32)*start; s32 s; - + s = ((d & 0xf)<<12); pChannel->SB[nSample++] = SetPacket(s); - + s = ((d & 0xf0) << 8); pChannel->SB[nSample++] = SetPacket(s); } - + // irq occurs no matter what core accesses the address - for (s32 core = 0; core < 2; ++core) + for (s32 core = 0; core < 2; ++core) { if (spu2attr(core).irq) // some callback and irq active? { - // if irq address reached or irq on looping addr, when stop/loop flag is set + // if irq address reached or irq on looping addr, when stop/loop flag is set u8* pirq = (u8*)pSpuIrq[core]; - - if ((pirq > (start - 16) && pirq <= start) || + + if ((pirq > (start - 16) && pirq <= start) || ((flags & 1) && (pirq > (pChannel->pLoop - 16) && pirq <= pChannel->pLoop))) { IRQINFO |= 4 << core; @@ -121,7 +121,7 @@ void SPU2Loop(VOICE_PROCESSED* pChannel, u32 ch) { // We play this block out first... dwEndChannel2[ch / 24] |= (1 << (ch % 24)); - + if (flags != 3 || pChannel->pLoop == NULL) { // and checking if pLoop is set avoids crashes, yeah start = (u8*)-1; @@ -142,7 +142,7 @@ void SPU2Loop(VOICE_PROCESSED* pChannel, u32 ch) pChannel->StoreInterpolationVal(pChannel->SB[pChannel->iSBPos++]); // get sample data pChannel->spos -= 0x10000; } - + s32 sval = (MixADSR(pChannel) * pChannel->iGetVal()) / 1023; // mix adsr with noise or sample val. if (pChannel->bFMod == 2) // fmod freq channel @@ -150,11 +150,11 @@ void SPU2Loop(VOICE_PROCESSED* pChannel, u32 ch) // -> store 1T sample data, use that to do fmod on next channel if (!pChannel->bNoise) iFMod[ns] = sval; } - else + else { if (pChannel->bVolumeL) s_buffers[ns][0] += (sval * pChannel->leftvol) >> 14; - + if (pChannel->bVolumeR) s_buffers[ns][1] += (sval * pChannel->rightvol) >> 14; } @@ -167,11 +167,11 @@ void SPU2Worker() { // assume s_buffers are zeroed out if (dwNewChannel2[0] || dwNewChannel2[1]) s_pAudioBuffers[s_nCurBuffer].newchannels++; - + VOICE_PROCESSED* pChannel = voices; for (u32 ch=0; ch < SPU_NUMBER_VOICES; ch++, pChannel++) // loop em all... we will collect 1 ms of sound of each playing channel { - if (pChannel->bNew) + if (pChannel->bNew) { pChannel->StartSound(); // start new sound dwEndChannel2[ch / 24] &= ~(1 << (ch % 24)); // clear end channel bit @@ -191,29 +191,29 @@ void SPU2Worker() MixChannels(0); MixChannels(1); - if ( g_bPlaySound ) + if ( g_bPlaySound ) { assert( s_pCurOutput != NULL); - for (u32 ns = 0; ns < NSSIZE; ns++) + for (u32 ns = 0; ns < NSSIZE; ns++) { // clamp and write clampandwrite16(s_pCurOutput[0],s_buffers[ns][0]); clampandwrite16(s_pCurOutput[1],s_buffers[ns][1]); - + s_pCurOutput += 2; s_buffers[ns][0] = 0; s_buffers[ns][1] = 0; } // check if end reached - if ((uptr)s_pCurOutput - (uptr)s_pAudioBuffers[s_nCurBuffer].pbuf >= 4 * NS_TOTAL_SIZE) + if ((uptr)s_pCurOutput - (uptr)s_pAudioBuffers[s_nCurBuffer].pbuf >= 4 * NS_TOTAL_SIZE) { - if ( conf.options & OPTION_RECORDING ) + if ( conf.options & OPTION_RECORDING ) { static s32 lastrectime = 0; - if (timeGetTime() - lastrectime > 5000) + if (timeGetTime() - lastrectime > 5000) { WARN_LOG("ZeroSPU2: recording\n"); lastrectime = timeGetTime(); @@ -221,7 +221,7 @@ void SPU2Worker() LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf+2, 4, NS_TOTAL_SIZE); } - if ( s_nQueuedBuffers >= ArraySize(s_pAudioBuffers)-1 ) + if ( s_nQueuedBuffers >= ArraySize(s_pAudioBuffers)-1 ) { //ZeroSPU2: dropping packets! game too fast s_nDropPacket += NSFRAMES; @@ -230,24 +230,24 @@ void SPU2Worker() else { // submit to final mixer #ifdef ZEROSPU2_DEVBUILD - if ( g_logsound ) + if ( g_logsound ) LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf + 2, 4, NS_TOTAL_SIZE); #endif - if ( g_startcount == 0xffffffff ) + if ( g_startcount == 0xffffffff ) { g_startcount = timeGetTime(); g_packetcount = 0; } - if ( conf.options & OPTION_TIMESTRETCH ) + if ( conf.options & OPTION_TIMESTRETCH ) { u32 newtotal = s_nTotalDuration - s_nDurations[s_nCurDuration]; u64 newtime = GetMicroTime(); u32 duration; - + if (s_GlobalTimeStamp == 0) s_GlobalTimeStamp = newtime - NSFRAMES * 1000; duration = (u32)(newtime-s_GlobalTimeStamp); - + s_nDurations[s_nCurDuration] = duration; s_nTotalDuration = newtotal + duration; s_nCurDuration = (s_nCurDuration+1)%ArraySize(s_nDurations); @@ -276,8 +276,8 @@ void LogPacketSound(void* packet, s32 memsize) u8* pstart = (u8*)packet; s_1 = s_2 = 0; - - for (s32 i = 0; i < memsize; i += 16) + + for (s32 i = 0; i < memsize; i += 16) { predict_nr = (s32)pstart[0]; shift_factor = predict_nr&0xf; @@ -287,9 +287,9 @@ void LogPacketSound(void* packet, s32 memsize) for (s32 nSample = 0;nSample < 28; ++pstart) { s32 d = (s32)*pstart; - + s32 temp; - + temp = ((d & 0xf) << 12); buf[nSample++] = SetPacket(temp); temp = ((d & 0xf0) << 8); @@ -302,7 +302,7 @@ void LogPacketSound(void* packet, s32 memsize) void LogRawSound(void* pleft, s32 leftstride, void* pright, s32 rightstride, s32 numsamples) { - if (g_pWavRecord == NULL ) + if (g_pWavRecord == NULL ) g_pWavRecord = new WavOutFile(RECORD_FILENAME, SAMPLE_RATE, 16, 2); u8* left = (u8*)pleft; @@ -311,7 +311,7 @@ void LogRawSound(void* pleft, s32 leftstride, void* pright, s32 rightstride, s32 tempbuf.resize(2 * numsamples); - for (s32 i = 0; i < numsamples; ++i) + for (s32 i = 0; i < numsamples; ++i) { tempbuf[2*i+0] = *(s16*)left; tempbuf[2*i+1] = *(s16*)right; diff --git a/plugins/zzogl-pg/opengl/GLWin32.cpp b/plugins/zzogl-pg/opengl/GLWin32.cpp index 325de6c5e8..d54c6c25dc 100644 --- a/plugins/zzogl-pg/opengl/GLWin32.cpp +++ b/plugins/zzogl-pg/opengl/GLWin32.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "GS.h" #include "zerogs.h" @@ -70,7 +70,7 @@ LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) } bool GLWindow::CreateWindow(void *pDisplay) -{ +{ RECT rc, rcdesktop; rc.left = 0; rc.top = 0; rc.right = conf.width; rc.bottom = conf.height; @@ -125,12 +125,12 @@ bool GLWindow::CreateWindow(void *pDisplay) if (GShwnd == NULL) return false; if (pDisplay != NULL) *(HWND*)pDisplay = GShwnd; - + return (pDisplay != NULL); } bool GLWindow::ReleaseWindow() -{ +{ if (hRC) // Do We Have A Rendering Context? { if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts? @@ -155,8 +155,8 @@ bool GLWindow::ReleaseWindow() } void GLWindow::CloseWindow() -{ - if( GShwnd != NULL ) +{ + if( GShwnd != NULL ) { DestroyWindow(GShwnd); GShwnd = NULL; @@ -196,7 +196,7 @@ bool GLWindow::DisplayWindow(int _width, int _height) SetWindowLong( GShwnd, GWL_EXSTYLE, dwExStyle ); SetWindowPos(GShwnd, HWND_TOP, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_SHOWWINDOW); - + if (conf.options & GSOPTION_FULLSCREEN) { DEVMODE dmScreenSettings; memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); @@ -234,19 +234,19 @@ bool GLWindow::DisplayWindow(int _width, int _height) 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored - 24, // 24Bit Z-Buffer (Depth Buffer) + 24, // 24Bit Z-Buffer (Depth Buffer) 8, // 8bit Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; - + if (!(hDC=GetDC(GShwnd))) { MessageBox(NULL,"(1) Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; } - + if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) { MessageBox(NULL,"(2) Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; @@ -266,7 +266,7 @@ bool GLWindow::DisplayWindow(int _width, int _height) MessageBox(NULL,"(5) Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; } - + UpdateWindow(GShwnd); return true; } @@ -277,7 +277,7 @@ void GLWindow::SwapGLBuffers() SwapBuffers(hDC); lastswaptime = timeGetTime(); } - + void GLWindow::SetTitle(char *strtitle) { SetWindowText(GShwnd, strtitle); @@ -288,4 +288,4 @@ void GLWindow::ResizeCheck() } -#endif \ No newline at end of file +#endif diff --git a/plugins/zzogl-pg/opengl/GLWinX11.cpp b/plugins/zzogl-pg/opengl/GLWinX11.cpp index 753ff852ea..a19362ea80 100644 --- a/plugins/zzogl-pg/opengl/GLWinX11.cpp +++ b/plugins/zzogl-pg/opengl/GLWinX11.cpp @@ -15,26 +15,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "GS.h" #include "zerogs.h" #ifdef GL_X11_WINDOW bool GLWindow::CreateWindow(void *pDisplay) -{ +{ glDisplay = XOpenDisplay(0); glScreen = DefaultScreen(glDisplay); if ( pDisplay == NULL ) return false; - + *(Display**)pDisplay = glDisplay; - + return true; } bool GLWindow::ReleaseWindow() -{ +{ if (context) { if (!glXMakeCurrent(glDisplay, None, NULL)) @@ -47,9 +47,9 @@ bool GLWindow::ReleaseWindow() } /* switch back to original desktop resolution if we were in fullscreen */ - if ( glDisplay != NULL ) + if ( glDisplay != NULL ) { - if (fullScreen) + if (fullScreen) { XF86VidModeSwitchToMode(glDisplay, glScreen, &deskMode); XF86VidModeSetViewPort(glDisplay, glScreen, 0, 0); @@ -59,8 +59,8 @@ bool GLWindow::ReleaseWindow() } void GLWindow::CloseWindow() -{ - if ( glDisplay != NULL ) +{ + if ( glDisplay != NULL ) { XCloseDisplay(glDisplay); glDisplay = NULL; @@ -78,40 +78,40 @@ bool GLWindow::DisplayWindow(int _width, int _height) Atom wmDelete; Window winDummy; unsigned int borderDummy; - + // attributes for a single buffered visual in RGBA format with at least // 8 bits per color and a 24 bit depth buffer - int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, + int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, None}; - // attributes for a double buffered visual in RGBA format with at least + // attributes for a double buffered visual in RGBA format with at least // 8 bits per color and a 24 bit depth buffer - int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, + int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, None }; GLWin.fullScreen = !!(conf.options & GSOPTION_FULLSCREEN); - + /* get an appropriate visual */ vi = glXChooseVisual(glDisplay, glScreen, attrListDbl); - if (vi == NULL) + if (vi == NULL) { vi = glXChooseVisual(glDisplay, glScreen, attrListSgl); doubleBuffered = false; ERROR_LOG("Only Singlebuffered Visual!\n"); } - else + else { doubleBuffered = true; ERROR_LOG("Got Doublebuffered Visual!\n"); } - if (vi == NULL) + if (vi == NULL) { ERROR_LOG("Failed to get buffered Visual!\n"); return false; @@ -119,10 +119,10 @@ bool GLWindow::DisplayWindow(int _width, int _height) glXQueryVersion(glDisplay, &glxMajorVersion, &glxMinorVersion); ERROR_LOG("glX-Version %d.%d\n", glxMajorVersion, glxMinorVersion); - + /* create a GLX context */ context = glXCreateContext(glDisplay, vi, NULL, GL_TRUE); - + /* create a color map */ cmap = XCreateColormap(glDisplay, RootWindow(glDisplay, vi->screen), vi->visual, AllocNone); @@ -132,7 +132,7 @@ bool GLWindow::DisplayWindow(int _width, int _height) // get a connection XF86VidModeQueryVersion(glDisplay, &vidModeMajorVersion, &vidModeMinorVersion); - if (fullScreen) + if (fullScreen) { XF86VidModeModeInfo **modes = NULL; int modeNum = 0; @@ -142,20 +142,20 @@ bool GLWindow::DisplayWindow(int _width, int _height) bestMode = 0; ERROR_LOG("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion); XF86VidModeGetAllModeLines(glDisplay, glScreen, &modeNum, &modes); - - if( modeNum > 0 && modes != NULL ) + + if( modeNum > 0 && modes != NULL ) { /* save desktop-resolution before switching modes */ deskMode = *modes[0]; - + /* look for mode with requested resolution */ - for (i = 0; i < modeNum; i++) + for (i = 0; i < modeNum; i++) { if ((modes[i]->hdisplay == _width) && (modes[i]->vdisplay == _height)) { bestMode = i; } - } + } XF86VidModeSwitchToMode(glDisplay, glScreen, modes[bestMode]); XF86VidModeSetViewPort(glDisplay, glScreen, 0, 0); @@ -163,7 +163,7 @@ bool GLWindow::DisplayWindow(int _width, int _height) dpyHeight = modes[bestMode]->vdisplay; ERROR_LOG("Resolution %dx%d\n", dpyWidth, dpyHeight); XFree(modes); - + /* create a fullscreen window */ attr.override_redirect = True; attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask; @@ -176,7 +176,7 @@ bool GLWindow::DisplayWindow(int _width, int _height) XGrabKeyboard(glDisplay, glWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); XGrabPointer(glDisplay, glWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, glWindow, None, CurrentTime); } - else + else { ERROR_LOG("Failed to start fullscreen. If you received the \n" "\"XFree86-VidModeExtension\" extension is missing, add\n" @@ -185,34 +185,34 @@ bool GLWindow::DisplayWindow(int _width, int _height) fullScreen = false; } } - - if (!fullScreen) + + if (!fullScreen) { // create a window in window mode attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask; glWindow = XCreateWindow(glDisplay, RootWindow(glDisplay, vi->screen), 0, 0, _width, _height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &attr); - + // only set window title and handle wm_delete_events if in windowed mode wmDelete = XInternAtom(glDisplay, "WM_DELETE_WINDOW", True); - + XSetWMProtocols(glDisplay, glWindow, &wmDelete, 1); XSetStandardProperties(glDisplay, glWindow, "ZZOgl-PG", "ZZOgl-PG", None, NULL, 0, NULL); XMapRaised(glDisplay, glWindow); - } + } // connect the glx-context to the window glXMakeCurrent(glDisplay, glWindow, context); XGetGeometry(glDisplay, glWindow, &winDummy, &x, &y, &width, &height, &borderDummy, &depth); ERROR_LOG("Depth %d\n", depth); - if (glXIsDirect(glDisplay, context)) + if (glXIsDirect(glDisplay, context)) ERROR_LOG("you have Direct Rendering!\n"); else ERROR_LOG("no Direct Rendering possible!\n"); // better for pad plugin key input (thc) - XSelectInput(glDisplay, glWindow, ExposureMask | KeyPressMask | KeyReleaseMask | + XSelectInput(glDisplay, glWindow, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask ); @@ -223,7 +223,7 @@ void GLWindow::SwapGLBuffers() { glXSwapBuffers(glDisplay, glWindow); } - + void GLWindow::SetTitle(char *strtitle) { XTextProperty prop; @@ -237,8 +237,8 @@ void GLWindow::SetTitle(char *strtitle) void GLWindow::ResizeCheck() { XEvent event; - - while(XCheckTypedEvent(glDisplay, ConfigureNotify, &event)) + + while(XCheckTypedEvent(glDisplay, ConfigureNotify, &event)) { if ((event.xconfigure.width != width) || (event.xconfigure.height != height)) { ZeroGS::ChangeWindowSize(event.xconfigure.width, event.xconfigure.height); diff --git a/plugins/zzogl-pg/opengl/GS.h b/plugins/zzogl-pg/opengl/GS.h index 242d7bf434..b71ec17a72 100644 --- a/plugins/zzogl-pg/opengl/GS.h +++ b/plugins/zzogl-pg/opengl/GS.h @@ -250,9 +250,9 @@ extern u8* g_pBasePS2Mem; // PS2 vertex struct VertexGPU { - // gained from XYZ2, XYZ3, XYZF2, XYZF3, + // gained from XYZ2, XYZ3, XYZF2, XYZF3, // X -- bits 0-15, Y-16-31. Z - 32-63 if no F used, 32-55 otherwise, F (fog) - 56-63 - // X, Y stored in 12d3 format, + // X, Y stored in 12d3 format, s16 x, y, f, resv0; // note: xy is 12d3 // Vertex color settings. RGB -- luminance of red/green/blue, A -- alpha. 1.0 == 0x80. // Goes grom RGBAQ register, bits 0-7, 8-15, 16-23 and 24-31 accordingly @@ -361,7 +361,7 @@ inline frameInfo CreateFrame(int fbp, int fbw, int fbh, int psm, u32 fbm){ typedef struct { u16 prim; - + union { struct { u16 iip : 1; @@ -441,9 +441,9 @@ union tex_0_info tex_0_info(u32 data0, u32 data1) { _u32[0] = data0; _u32[1] = data1; } u32 tbw_mult() { - if (tbw == 0) + if (tbw == 0) return 64; - else + else return (tbw << 6); } u32 psm_fix() @@ -548,12 +548,12 @@ typedef struct { int fba; } fbaInfo; -typedef struct { +typedef struct { Vertex gsvertex[3]; u32 rgba; float q; Vertex vertexregs; - + int primC; // number of verts current storing int primIndex; // current prim index int nTriFanVert; @@ -575,13 +575,13 @@ typedef struct { bufInfo dstbuf, dstbufnew; clutInfo clut; - + texaInfo texa; trxposInfo trxpos, trxposnew; int imageWtemp, imageHtemp; - int imageTransfer; + int imageTransfer; int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY; pathInfo path[3]; @@ -600,9 +600,9 @@ static __forceinline u16 RGBA32to16(u32 c) static __forceinline u32 RGBA16to32(u16 c) { - return (((c) & 0x001f) << 3) | - (((c) & 0x03e0) << 6) | - (((c) & 0x7c00) << 9) | + return (((c) & 0x001f) << 3) | + (((c) & 0x03e0) << 6) | + (((c) & 0x7c00) << 9) | (((c) & 0x8000) ? 0xff000000 : 0); } @@ -655,7 +655,7 @@ inline float Clamp(float fx, float fmin, float fmax) } // PSMT16, 16S have shorter color per pixel, also cluted textures with half storage. -inline bool PSMT_ISHALF_STORAGE(const tex0Info& tex0) { +inline bool PSMT_ISHALF_STORAGE(const tex0Info& tex0) { if (PSMT_IS16BIT(tex0.psm) || (PSMT_ISCLUT(tex0.psm) && tex0.cpsm > 1)) return true; else @@ -664,45 +664,45 @@ inline bool PSMT_ISHALF_STORAGE(const tex0Info& tex0) { //--------------------------- Inlines for bitwise ops //--------------------------- textures -// Tex0Info (TEXD_x registers) bits, lower word +// Tex0Info (TEXD_x registers) bits, lower word // The register is really 64-bit, but we use 2 32bit ones to represent it // Obtain tbp0 -- Texture Buffer Base Pointer (Word Address/64) -- from data. Bits 0-13. -static __forceinline int ZZOglGet_tbp0_TexBits(u32 data) -{ +static __forceinline int ZZOglGet_tbp0_TexBits(u32 data) +{ //return tex_0_info(data).tbp0; return (data ) & 0x3fff; } // Obtain tbw -- Texture Buffer Width (Texels/64) -- from data, do not multiply to 64. Bits 14-19 // ( data & 0xfc000 ) >> 14 -static __forceinline int ZZOglGet_tbw_TexBits(u32 data) -{ +static __forceinline int ZZOglGet_tbw_TexBits(u32 data) +{ //return tex_0_info(data).tbw; return (data >> 14) & 0x3f; } // Obtain tbw -- Texture Buffer Width (Texels) -- from data, do multiply to 64, never return 0. -static __forceinline int ZZOglGet_tbw_TexBitsMult(u32 data) -{ +static __forceinline int ZZOglGet_tbw_TexBitsMult(u32 data) +{ //return text_0_info(data).tbw_mult(); int result = ZZOglGet_tbw_TexBits(data); - if (result == 0) + if (result == 0) return 64; - else + else return (result << 6); } -// Obtain psm -- Pixel Storage Format -- from data. Bits 20-25. +// Obtain psm -- Pixel Storage Format -- from data. Bits 20-25. // (data & 0x3f00000) >> 20 -static __forceinline int ZZOglGet_psm_TexBits(u32 data) -{ +static __forceinline int ZZOglGet_psm_TexBits(u32 data) +{ //return tex_0_info(data).psm; return ((data >> 20) & 0x3f); } -// Obtain psm -- Pixel Storage Format -- from data. Bits 20-25. Fix incorrect psm == 9 -static __forceinline int ZZOglGet_psm_TexBitsFix(u32 data) -{ +// Obtain psm -- Pixel Storage Format -- from data. Bits 20-25. Fix incorrect psm == 9 +static __forceinline int ZZOglGet_psm_TexBitsFix(u32 data) +{ //return tex_0_info(data).psm_fix(); int result = ZZOglGet_psm_TexBits(data) ; // printf ("result %d\n", result); @@ -712,15 +712,15 @@ static __forceinline int ZZOglGet_psm_TexBitsFix(u32 data) // Obtain tw -- Texture Width (Width = 2^TW) -- from data. Bits 26-29 // (data & 0x3c000000)>>26 -static __forceinline u16 ZZOglGet_tw_TexBits(u32 data) -{ +static __forceinline u16 ZZOglGet_tw_TexBits(u32 data) +{ //return tex_0_info(data).tw; return ((data >> 26) & 0xf); } // Obtain tw -- Texture Width (Width = TW) -- from data. Width could newer be more than 1024. -static __forceinline u16 ZZOglGet_tw_TexBitsExp(u32 data) -{ +static __forceinline u16 ZZOglGet_tw_TexBitsExp(u32 data) +{ //return tex_0_info(data).tw_exp(); u16 result = ZZOglGet_tw_TexBits(data); if (result > 10) result = 10; @@ -730,15 +730,15 @@ static __forceinline u16 ZZOglGet_tw_TexBitsExp(u32 data) // TH set at the border of upper and higher words. // Obtain th -- Texture Height (Height = 2^TH) -- from data. Bits 30-31 lower, 0-1 higher // (dataLO & 0xc0000000) >> 30 + (dataHI & 0x3) * 0x4 -static __forceinline u16 ZZOglGet_th_TexBits(u32 dataLO, u32 dataHI) -{ +static __forceinline u16 ZZOglGet_th_TexBits(u32 dataLO, u32 dataHI) +{ //return tex_0_info(dataLO, dataHI).th; return (((dataLO >> 30) & 0x3) | ((dataHI & 0x3) << 2)); } // Obtain th --Texture Height (Height = 2^TH) -- from data. Height could newer be more than 1024. -static __forceinline u16 ZZOglGet_th_TexBitsExp(u32 dataLO, u32 dataHI) -{ +static __forceinline u16 ZZOglGet_th_TexBitsExp(u32 dataLO, u32 dataHI) +{ //return tex_0_info(dataLO, dataHI).th_exp(); u16 result = ZZOglGet_th_TexBits(dataLO, dataHI); if (result > 10) result = 10; @@ -748,24 +748,24 @@ static __forceinline u16 ZZOglGet_th_TexBitsExp(u32 dataLO, u32 dataHI) // Tex0Info bits, higher word. // Obtain tcc -- Texture Color Component 0=RGB, 1=RGBA + use Alpha from TEXA reg when not in PSM -- from data. Bit 3 // (data & 0x4)>>2 -static __forceinline u8 ZZOglGet_tcc_TexBits(u32 data) -{ +static __forceinline u8 ZZOglGet_tcc_TexBits(u32 data) +{ //return tex_0_info(0, data).tcc; return ((data >> 2) & 0x1); } // Obtain tfx -- Texture Function (0=modulate, 1=decal, 2=hilight, 3=hilight2) -- from data. Bit 4-5 // (data & 0x18)>>3 -static __forceinline u8 ZZOglGet_tfx_TexBits(u32 data) -{ +static __forceinline u8 ZZOglGet_tfx_TexBits(u32 data) +{ //return tex_0_info(0, data).tfx; return ((data >> 3) & 0x3); } // Obtain cbp from data -- Clut Buffer Base Pointer (Address/256) -- Bits 5-18 // (data & 0x7ffe0)>>5 -static __forceinline int ZZOglGet_cbp_TexBits(u32 data) -{ +static __forceinline int ZZOglGet_cbp_TexBits(u32 data) +{ //return tex_0_info(0, data).cbp; return ((data >> 5) & 0x3fff); } @@ -773,8 +773,8 @@ static __forceinline int ZZOglGet_cbp_TexBits(u32 data) // Obtain cpsm from data -- Clut pixel Storage Format -- Bits 19-22. 22nd is at no use. // (data & 0x700000)>>19 // 0000 - psmct32; 0010 - psmct16; 1010 - psmct16s. -static __forceinline u8 ZZOglGet_cpsm_TexBits(u32 data) -{ +static __forceinline u8 ZZOglGet_cpsm_TexBits(u32 data) +{ //return (tex_0_info(0, data).cpsm & 0xe); return ((data >> 19) & 0xe); } @@ -782,54 +782,54 @@ static __forceinline u8 ZZOglGet_cpsm_TexBits(u32 data) // Obtain csm -- I don't know what is it -- from data. Bit 23 // (data & 0x800000)>>23 // csm is the clut storage mode. 0 for CSM1, 1 for CSM2. -static __forceinline u8 ZZOglGet_csm_TexBits(u32 data) -{ +static __forceinline u8 ZZOglGet_csm_TexBits(u32 data) +{ //return tex_0_info(0, data).csm; return ((data >> 23) & 0x1); } // Obtain csa -- -- from data. Bits 24-28 // (data & 0x1f000000)>>24 -static __forceinline u8 ZZOglGet_csa_TexBits(u32 data) -{ +static __forceinline u8 ZZOglGet_csa_TexBits(u32 data) +{ //return tex_0_info(0, data).csa_fix(); - + if ((data & 0x700000) == 0 ) // it is cpsm < 2 check return ((data >> 24) & 0xf); - else + else return ((data >> 24) & 0x1f); } // Obtain cld -- -- from data. Bits 29-31 // (data & 0xe0000000)>>29 -static __forceinline u8 ZZOglGet_cld_TexBits(u32 data) -{ +static __forceinline u8 ZZOglGet_cld_TexBits(u32 data) +{ //return tex_0_info(0, data).cld; return ((data >> 29) & 0x7); } -//-------------------------- frames +//-------------------------- frames // FrameInfo bits. // Obtain fbp -- frame Buffer Base Pointer (Word Address/2048) -- from data. Bits 0-15 inline int -ZZOglGet_fbp_FrameBits(u32 data) { +ZZOglGet_fbp_FrameBits(u32 data) { return ((data ) & 0x1ff); } // So we got adress / 64, henceby frame fbp and tex tbp have the same dimension -- "real adress" is x64. inline int -ZZOglGet_fbp_FrameBitsMult(u32 data) { +ZZOglGet_fbp_FrameBitsMult(u32 data) { return (ZZOglGet_fbp_FrameBits(data) << 5); } // Obtain fbw -- width (Texels/64) -- from data. Bits 16-23 inline int -ZZOglGet_fbw_FrameBits(u32 data) { +ZZOglGet_fbw_FrameBits(u32 data) { return ((data >> 16) & 0x3f); } inline int -ZZOglGet_fbw_FrameBitsMult(u32 data) { +ZZOglGet_fbw_FrameBitsMult(u32 data) { return (ZZOglGet_fbw_FrameBits(data) << 6); } @@ -837,12 +837,12 @@ ZZOglGet_fbw_FrameBitsMult(u32 data) { // Obtain psm -- Pixel Storage Format -- from data. Bits 24-29. // (data & 0x3f000000) >> 24 inline int -ZZOglGet_psm_FrameBits(u32 data) { +ZZOglGet_psm_FrameBits(u32 data) { return ((data >> 24) & 0x3f); } // Function for calculating overal height from frame data. -inline int +inline int ZZOgl_fbh_Calc (int fbp, int fbw, int psm) { int fbh = ( 1024 * 1024 - 64 * fbp ) / fbw; fbh &= ~0x1f; @@ -864,20 +864,20 @@ ZZOglGet_fbh_FrameBitsCalc (u32 data) { int fbp = ZZOglGet_fbp_FrameBits(data); int fbw = ZZOglGet_fbw_FrameBits(data); int psm = ZZOglGet_psm_FrameBits(data); - if (fbw > 0) + if (fbw > 0) fbh = ZZOgl_fbh_Calc(fbp, fbw, psm) ; return fbh ; } // Obtain fbm -- frame mask -- from data. All higher word. inline u32 -ZZOglGet_fbm_FrameBits(u32 data) { +ZZOglGet_fbm_FrameBits(u32 data) { return (data); -} +} // Obtain fbm -- frame mask -- from data. All higher word. Fixed from psm == PCMT24 (without alpha) inline u32 -ZZOglGet_fbm_FrameBitsFix(u32 dataLO, u32 dataHI) { +ZZOglGet_fbm_FrameBitsFix(u32 dataLO, u32 dataHI) { if (PSMT_BITMODE(ZZOglGet_psm_FrameBits(dataLO)) == 1) return (dataHI | 0xff000000); else @@ -886,31 +886,31 @@ ZZOglGet_fbm_FrameBitsFix(u32 dataLO, u32 dataHI) { // obtain colormask RED inline u32 -ZZOglGet_fbmRed_FrameBits(u32 data) { +ZZOglGet_fbmRed_FrameBits(u32 data) { return (data & 0xff); } // obtain colormask Green inline u32 -ZZOglGet_fbmGreen_FrameBits(u32 data) { +ZZOglGet_fbmGreen_FrameBits(u32 data) { return ((data >> 8) & 0xff); } // obtain colormask Blue inline u32 -ZZOglGet_fbmBlue_FrameBits(u32 data) { +ZZOglGet_fbmBlue_FrameBits(u32 data) { return ((data >> 16) & 0xff); } // obtain colormask Alpha inline u32 -ZZOglGet_fbmAlpha_FrameBits(u32 data) { +ZZOglGet_fbmAlpha_FrameBits(u32 data) { return ((data >> 24) & 0xff); } // obtain colormask Alpha inline u32 -ZZOglGet_fbmHighByte(u32 data) { +ZZOglGet_fbmHighByte(u32 data) { return (!!(data & 0x80000000)); } @@ -918,7 +918,7 @@ ZZOglGet_fbmHighByte(u32 data) { //-------------------------- tex0 comparison // Check if old and new tex0 registers have only clut difference -inline bool +inline bool ZZOglAllExceptClutIsSame( u32* oldtex, u32* newtex) { return ((oldtex[0] == newtex[0]) && ((oldtex[1] & 0x1f) == (newtex[1] & 0x1f))); } diff --git a/plugins/zzogl-pg/opengl/GSmain.cpp b/plugins/zzogl-pg/opengl/GSmain.cpp index 42e1b216d1..f1f6900d94 100644 --- a/plugins/zzogl-pg/opengl/GSmain.cpp +++ b/plugins/zzogl-pg/opengl/GSmain.cpp @@ -79,7 +79,7 @@ char *libraryName = "ZZ Ogl PG "; #else char *libraryName = "ZZ Ogl PG (Dev) "; #endif - + static const char* s_aa[5] = { "AA none |", "AA 2x |", "AA 4x |", "AA 8x |", "AA 16x |" }; static const char* s_naa[3] = { "native res |", "res /2 |", "res /4 |" }; static const char* pbilinear[] = { "off", "normal", "forced" }; @@ -129,12 +129,12 @@ void SysMessage(const char *fmt, ...) { } #else -u32 THR_KeyEvent = 0; // Value for key event processing between threads +u32 THR_KeyEvent = 0; // Value for key event processing between threads bool THR_bShift = false; #endif -void __Log(const char *fmt, ...) +void __Log(const char *fmt, ...) { va_list list; @@ -180,10 +180,10 @@ void CALLBACK GSsetGameCRC(int crc, int options) VALIDATE_THRESH = 8; conf.mrtdepth = ((conf.gamesettings & GAME_DISABLEMRTDEPTH) != 0); - if (!conf.mrtdepth) + if (!conf.mrtdepth) ERROR_LOG("Disabling MRT depth writing\n"); - else - ERROR_LOG("Enabling MRT depth writing\n"); + else + ERROR_LOG("Enabling MRT depth writing\n"); g_GameSettings |= GAME_PATH3HACK; @@ -219,7 +219,7 @@ void CALLBACK GSsetGameCRC(int crc, int options) case 0xFB0E6D72: // GodOfWar, EU, case 0xEB001875: // GodOfWar, EU, case 0xA61A4C6D: // GodOfWar, - case 0xE23D532B: // GodOfWar, + case 0xE23D532B: // GodOfWar, conf.gamesettings |= 0x00010000; // full 16 bit break; @@ -229,7 +229,7 @@ void CALLBACK GSsetGameCRC(int crc, int options) case 0xFB236A46: // SonicUnleashed, US case 0xa5d29941: // Shadow the Hedgehog - conf.gamesettings |= 0x00040100; // Fast update + no Alpha fail + conf.gamesettings |= 0x00040100; // Fast update + no Alpha fail case 0x7acf7e03: // Atelier Iris 1 case 0x9AC65D6A: // Atelier Iris 2, US @@ -247,7 +247,7 @@ void CALLBACK GSsetGameCRC(int crc, int options) } } - g_GameSettings = conf.gamesettings|options; + g_GameSettings = conf.gamesettings|options; } void CALLBACK GSsetFrameSkip(int frameskip) @@ -255,7 +255,7 @@ void CALLBACK GSsetFrameSkip(int frameskip) FUNCLOG s_frameskipping |= frameskip; if( frameskip && g_nFrameRender > 1 ) { - + for(int i = 0; i < 16; ++i) { g_GIFPackedRegHandlers[i] = GIFPackedRegHandlerNOP; } @@ -304,7 +304,7 @@ void CALLBACK GSreset() { memset(&gs, 0, sizeof(gs)); ZeroGS::GSStateReset(); - + gs.prac = 1; prim = &gs._prim[0]; gs.nTriFanVert = -1; @@ -379,7 +379,7 @@ void OnKeyboardF5(int shift) if( conf.interlace < 2 ) sprintf(strtitle, "interlace on - mode %d", conf.interlace); else sprintf(strtitle, "interlace off"); } - + ZeroGS::AddMessage(strtitle); SaveConfig(); } @@ -391,7 +391,7 @@ void OnKeyboardF6(int shift) char strtitle[256]; if( shift ) { conf.aa--; // -1 - if( conf.aa > 4 ) conf.aa = 4; // u8 in unsigned, so negative value is 255. + if( conf.aa > 4 ) conf.aa = 4; // u8 in unsigned, so negative value is 255. sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]); ZeroGS::SetAA(conf.aa); } @@ -401,7 +401,7 @@ void OnKeyboardF6(int shift) sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]); ZeroGS::SetAA(conf.aa); } - + ZeroGS::AddMessage(strtitle); SaveConfig(); } @@ -428,7 +428,7 @@ void OnKeyboardF61(int shift) { char strtitle[256]; if( shift ) { conf.negaa--; // -1 - if( conf.negaa > 2 ) conf.negaa = 2; // u8 in unsigned, so negative value is 255. + if( conf.negaa > 2 ) conf.negaa = 2; // u8 in unsigned, so negative value is 255. sprintf(strtitle, "down resolution - %s", s_naa[conf.negaa]); ZeroGS::SetNegAA(conf.negaa); } @@ -492,12 +492,12 @@ void OnKeyboardF9(int shift) { conf.gamesettings &= !(HackinshTable[CurrentHackSetting].HackMask); if( shift ) { CurrentHackSetting--; - if (CurrentHackSetting == -1) + if (CurrentHackSetting == -1) CurrentHackSetting = HACK_NUMBER-1; } - else { + else { CurrentHackSetting++; - if (CurrentHackSetting == HACK_NUMBER) + if (CurrentHackSetting == HACK_NUMBER) CurrentHackSetting = 0; } conf.gamesettings |= HackinshTable[CurrentHackSetting].HackMask; @@ -525,7 +525,7 @@ extern HINSTANCE hInst; void CALLBACK GSconfigure() { DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)ConfigureDlgProc); if( g_nPixelShaderVer == SHADER_REDUCED ) @@ -533,7 +533,7 @@ void CALLBACK GSconfigure() { } -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) +s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) { bool err; @@ -551,7 +551,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) strcpy(GStitle, Title); err = GLWin.CreateWindow(pDsp); - if (!err) + if (!err) { GS_LOG("Failed to create window. Exiting..."); return -1; @@ -564,16 +564,16 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) ERROR_LOG("initialization successful\n"); - if( conf.bilinear == 2 ) + if( conf.bilinear == 2 ) { ZeroGS::AddMessage("forced bilinear filtering - on", 1000); } - else if( conf.bilinear == 1 ) + else if( conf.bilinear == 1 ) { ZeroGS::AddMessage("normal bilinear filtering - on", 1000); } - - if( conf.aa ) + + if( conf.aa ) { char strtitle[64]; sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa], 1000); @@ -600,36 +600,36 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) void ProcessMessages() { - MSG msg; + MSG msg; ZeroMemory( &msg, sizeof(msg) ); - while( 1 ) + while( 1 ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { - switch( msg.message ) + switch( msg.message ) { case WM_KEYDOWN : - if( msg.wParam == VK_F5 ) + if( msg.wParam == VK_F5 ) { OnKeyboardF5(GetKeyState(VK_SHIFT)&0x8000); } - else if( msg.wParam == VK_F6 ) + else if( msg.wParam == VK_F6 ) { OnKeyboardF6(GetKeyState(VK_SHIFT)&0x8000); } - else if( msg.wParam == VK_F7 ) + else if( msg.wParam == VK_F7 ) { OnKeyboardF7(GetKeyState(VK_SHIFT)&0x8000); } - else if( msg.wParam == VK_F9 ) + else if( msg.wParam == VK_F9 ) { OnKeyboardF9(GetKeyState(VK_SHIFT)&0x8000); } - else if( msg.wParam == VK_ESCAPE ) + else if( msg.wParam == VK_ESCAPE ) { if( conf.options & GSOPTION_FULLSCREEN ) { - // destroy that msg + // destroy that msg conf.options &= ~GSOPTION_FULLSCREEN; ZeroGS::ChangeDeviceSize(conf.width, conf.height); UpdateWindow(GShwnd); @@ -641,7 +641,7 @@ void ProcessMessages() return; } } - + break; } @@ -654,7 +654,7 @@ void ProcessMessages() } } - if ((GetKeyState(VK_MENU)&0x8000) && (GetKeyState(VK_RETURN)&0x8000)) + if ((GetKeyState(VK_MENU)&0x8000) && (GetKeyState(VK_RETURN)&0x8000)) { conf.options ^= GSOPTION_FULLSCREEN; @@ -694,15 +694,15 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) ERROR_LOG("initialization successful\n"); - if( conf.bilinear == 2 ) + if( conf.bilinear == 2 ) { ZeroGS::AddMessage("bilinear filtering - forced", 1000); } - else if( conf.bilinear == 1 ) + else if( conf.bilinear == 1 ) { ZeroGS::AddMessage("bilinear filtering - normal", 1000); } - if( conf.aa ) + if( conf.aa ) { char strtitle[64]; sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]); @@ -720,7 +720,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread) void ProcessMessages() { FUNCLOG - + // check resizing GLWin.ResizeCheck(); @@ -737,12 +737,12 @@ void ProcessMessages() break; case XK_F7: OnKeyboardF7(my_bShift); - break; + break; case XK_F9: OnKeyboardF9(my_bShift); break; } - } + } } #endif // linux @@ -789,9 +789,9 @@ void CALLBACK GSmakeSnapshot(char *path) FUNCLOG FILE *bmpfile; - char filename[256]; + char filename[256]; u32 snapshotnr = 0; - + // increment snapshot value & try to get filename for (;;) { snapshotnr++; @@ -806,7 +806,7 @@ void CALLBACK GSmakeSnapshot(char *path) // try opening new snapshot file if((bmpfile=fopen(filename,"wb"))==NULL) { char strdir[255]; - + #ifdef _WIN32 sprintf(strdir, "%s", path); CreateDirectory(strdir, NULL); @@ -841,11 +841,11 @@ void CALLBACK GSvsync(int interlace) char strtitle[256]; GL_REPORT_ERRORD(); - + g_nRealFrame++; ZeroGS::RenderCRTC(!interlace); - + ProcessMessages(); if( --nToNextUpdate <= 0 ) { @@ -867,10 +867,10 @@ void CALLBACK GSvsync(int interlace) sprintf(strtitle, "ZZ Open GL 0.%d.%d | %.1f fps | %s%s%s savestate %d%s | shaders %s | (%.1f)", zgsbuild, zgsminor, fFPS, g_pInterlace[conf.interlace], g_pBilinear[conf.bilinear], (conf.aa >= conf.negaa) ? (conf.aa ? s_aa[conf.aa - conf.negaa] : "") : (conf.negaa ? s_naa[conf.negaa - conf.aa] : ""), - CurrentSavestate, (SaveStateExists ? "": "*" ), + CurrentSavestate, (SaveStateExists ? "": "*" ), g_pShaders[g_nPixelShaderVer], (ppf&0xfffff)/(float)UPDATE_FRAMES); #else - sprintf(strtitle, "%d | %.1f fps (sk:%d%%) | g: %.1f, t: %.1f, a: %.1f, r: %.1f | p: %.1f | tex: %d %d (%d kbpf)", g_nFrame, fFPS, + sprintf(strtitle, "%d | %.1f fps (sk:%d%%) | g: %.1f, t: %.1f, a: %.1f, r: %.1f | p: %.1f | tex: %d %d (%d kbpf)", g_nFrame, fFPS, 100*g_nFramesSkipped/g_nFrame, g_nGenVars/(float)UPDATE_FRAMES, g_nTexVars/(float)UPDATE_FRAMES, g_nAlphaVars/(float)UPDATE_FRAMES, g_nResolve/(float)UPDATE_FRAMES, (ppf&0xfffff)/(float)UPDATE_FRAMES, @@ -950,7 +950,7 @@ int CALLBACK GSsetupRecording(int start, void* pData) return 1; } -s32 CALLBACK GSfreeze(int mode, freezeData *data) +s32 CALLBACK GSfreeze(int mode, freezeData *data) { FUNCLOG @@ -969,7 +969,7 @@ s32 CALLBACK GSfreeze(int mode, freezeData *data) default: break; } - + return 0; } @@ -1002,7 +1002,7 @@ struct DVPROFSTRUCT { DATA(u64 time, u32 user = 0) : dwTime(time), dwUserData(user) {} DATA() : dwTime(0), dwUserData(0) {} - + u64 dwTime; u32 dwUserData; }; @@ -1017,7 +1017,7 @@ struct DVPROFSTRUCT list listTimes; // before DVProfEnd is called, contains the global time it started // after DVProfEnd is called, contains the time it lasted - // the list contains all the tracked times + // the list contains all the tracked times char pname[256]; list listpChild; // other profilers called during this profiler period @@ -1044,7 +1044,7 @@ void DVProfRegister(char* pname) return; list::iterator it = g_listAllProfilers.begin(); - + // while(it != g_listAllProfilers.end() ) { // // if( _tcscmp(pname, (*it)->pname) == 0 ) { @@ -1061,7 +1061,7 @@ void DVProfRegister(char* pname) // else add in a new profiler to the appropriate parent profiler DVPROFSTRUCT* pprof = NULL; - + if( g_listCurTracking.size() > 0 ) { assert( g_listCurTracking.back().pprof != NULL ); g_listCurTracking.back().pprof->listpChild.push_back(new DVPROFSTRUCT()); @@ -1122,8 +1122,8 @@ u64 DVProfWriteStruct(FILE* f, DVPROFSTRUCT* p, int ident) while(ittime != p->listTimes.end() ) { utime += (u32)ittime->dwTime; - - if( ittime->dwUserData ) + + if( ittime->dwUserData ) fprintf(f, "time: %d, user: 0x%8.8x", (u32)ittime->dwTime, ittime->dwUserData); else fprintf(f, "time: %d", (u32)ittime->dwTime); diff --git a/plugins/zzogl-pg/opengl/GifTransfer.cpp b/plugins/zzogl-pg/opengl/GifTransfer.cpp index 95f9a1e537..070ebfbbcc 100644 --- a/plugins/zzogl-pg/opengl/GifTransfer.cpp +++ b/plugins/zzogl-pg/opengl/GifTransfer.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "GS.h" #include "Mem.h" #include "zerogs.h" @@ -33,7 +33,7 @@ static int count = 0; g_GIFPackedRegHandlers[reg](pMem); path->regn += 4; - if (path->nreg == path->regn) + if (path->nreg == path->regn) { path->regn = 0; path->nloop--; @@ -47,9 +47,9 @@ void _GSgifRegList(pathInfo *path, u32 *pMem) // 64bit int reg = (int)((path->regs >> path->regn) & 0xf); g_GIFRegHandlers[reg](pMem); - + path->regn += 4; - if (path->nreg == path->regn) + if (path->nreg == path->regn) { path->regn = 0; path->nloop--; @@ -74,12 +74,12 @@ extern HANDLE g_hCurrentThread; __forceinline void gifTransferLog(int index, u32 *pMem, u32 size) { #ifdef _DEBUG - if( conf.log & 0x20 ) + if( conf.log & 0x20 ) { static int nSaveIndex = 0; GS_LOG("%d: p:%d %x\n", nSaveIndex++, index + 1, size); int vals[4] = {0}; - for(u32 i = 0; i < size; i++) + for(u32 i = 0; i < size; i++) { for(u32 j = 0; j < 4; ++j ) vals[j] ^= pMem[4*i+j]; @@ -97,7 +97,7 @@ template void _GSgifTransfer(u32 *pMem, u32 size) FUNCLOG pathInfo *path = &gs.path[index]; - + #ifdef _WIN32 assert( g_hCurrentThread == GetCurrentThread() ); #endif @@ -109,17 +109,17 @@ template void _GSgifTransfer(u32 *pMem, u32 size) while(size > 0) { //LOG(_T("Transfer(%08x, %d) START\n"), pMem, size); - if (path->nloop == 0) + if (path->nloop == 0) { path->setTag(pMem); pMem += 4; size--; if ((g_GameSettings & GAME_PATH3HACK) && (index == 2) && path->eop) nPath3Hack = 1; - - // eeuser 7.2.2. GIFtag: "... when NLOOP is 0, the GIF does not output anything, and + + // eeuser 7.2.2. GIFtag: "... when NLOOP is 0, the GIF does not output anything, and // values other than the EOP field are disregarded." - if (path->nloop > 0) + if (path->nloop > 0) { gs.q = 1.0f; @@ -132,12 +132,12 @@ template void _GSgifTransfer(u32 *pMem, u32 size) } else { - switch(path->mode) + switch(path->mode) { case GIF_FLG_PACKED: { // Needs to be looked at. - + // first try a shortcut for a very common case /*if(path.adonly && size >= path.nloop) @@ -151,22 +151,22 @@ template void _GSgifTransfer(u32 *pMem, u32 size) mem += sizeof(GIFPackedReg); } while(--path.nloop > 0);*/ - + do { g_GIFPackedRegHandlers[path->GetReg()](pMem); - + pMem += 4; size--; - } + } while (path->StepReg() && (size > 0)); - + break; } case GIF_FLG_REGLIST: { // Needs to be looked at. - + //GS_LOG("%8.8x%8.8x %d L\n", ((u32*)&gs.regs)[1], *(u32*)&gs.regs, path->tag.nreg/4); size *= 2; @@ -174,18 +174,18 @@ template void _GSgifTransfer(u32 *pMem, u32 size) do { g_GIFRegHandlers[path->GetReg()](pMem); - + pMem += 2; size--; } while(path->StepReg() && (size > 0)); - + if(size & 1) pMem += 2; size /= 2; break; } - + case GIF_FLG_IMAGE: // FROM_VFRAM case GIF_FLG_IMAGE2: // Used in the DirectX version, so we'll use it here too. { @@ -197,21 +197,21 @@ template void _GSgifTransfer(u32 *pMem, u32 size) case 0: ZeroGS::TransferHostLocal(pMem, len * 4); break; - case 1: + case 1: ZeroGS::TransferLocalHost(pMem, len); break; - case 2: + case 2: //Move(); //ERROR_LOG("GIF_FLG_IMAGE MOVE"); break; - case 3: + case 3: //assert(0); break; - default: + default: //assert(0); break; } - + pMem += len * 4; path->nloop -= len; size -= len; @@ -225,14 +225,14 @@ template void _GSgifTransfer(u32 *pMem, u32 size) break; } } - + if (index == 0) { if(path->tag.EOP && path->nloop == 0) { break; } - } + } } // This is the case when not all data was readed from one try: VU1 has too much data. @@ -256,7 +256,7 @@ template void _GSgifTransfer(u32 *pMem, u32 size) void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr) { FUNCLOG - + //GS_LOG("GSgifTransfer1 0x%x (mode %d)\n", addr, path->mode); #ifdef _DEBUG @@ -272,7 +272,7 @@ void CALLBACK GSgifTransfer2(u32 *pMem, u32 size) FUNCLOG //GS_LOG("GSgifTransfer2 size = %lx (mode %d, gs.path2.tag.nloop = %d)\n", size, gs.path[1].mode, gs.path[1].tag.nloop); - + _GSgifTransfer<1>(pMem, size); } @@ -291,7 +291,7 @@ template void _GSgifTransfer(u32 *pMem, u32 size) FUNCLOG pathInfo *path = &gs.path[index]; - + #ifdef _WIN32 assert( g_hCurrentThread == GetCurrentThread() ); #endif @@ -303,7 +303,7 @@ template void _GSgifTransfer(u32 *pMem, u32 size) while(size > 0) { //LOG(_T("Transfer(%08x, %d) START\n"), pMem, size); - if (path->nloop == 0) + if (path->nloop == 0) { path->setTag(pMem); gs.q = 1; @@ -312,14 +312,14 @@ template void _GSgifTransfer(u32 *pMem, u32 size) if ((g_GameSettings & GAME_PATH3HACK) && (index == 2) && path->eop) nPath3Hack = 1; - if (index == 0) + if (index == 0) { - if (path->mode == GIF_FLG_PACKED) + if (path->mode == GIF_FLG_PACKED) { // check if 0xb is in any reg, if yes, exit (kh2) for(int i = 0; i < path->nreg; i += 4) { - if (((path->regs >> i) & 0xf) == 11) + if (((path->regs >> i) & 0xf) == 11) { ERROR_LOG_SPAM("Invalid unpack type\n"); path->nloop = 0; @@ -329,16 +329,16 @@ template void _GSgifTransfer(u32 *pMem, u32 size) } } - if(path->nloop == 0 ) + if(path->nloop == 0 ) { - if (index == 0) + if (index == 0) { // ffx hack if( path->eop ) return; - continue; + continue; } - /*if( !path->eop ) + /*if( !path->eop ) { //DEBUG_LOG("continuing from eop\n"); continue; @@ -349,7 +349,7 @@ template void _GSgifTransfer(u32 *pMem, u32 size) } } - switch(path->mode) + switch(path->mode) { case GIF_FLG_PACKED: { @@ -357,16 +357,16 @@ template void _GSgifTransfer(u32 *pMem, u32 size) for(; size > 0; size--, pMem += 4) { int reg = (int)((path->regs >> path->regn) & 0xf); - + g_GIFPackedRegHandlers[reg](pMem); path->regn += 4; - - if (path->nreg == path->regn) + + if (path->nreg == path->regn) { path->regn = 0; - - if( path->nloop-- <= 1 ) + + if( path->nloop-- <= 1 ) { size--; pMem += 4; @@ -381,19 +381,19 @@ template void _GSgifTransfer(u32 *pMem, u32 size) //GS_LOG("%8.8x%8.8x %d L\n", ((u32*)&gs.regs)[1], *(u32*)&gs.regs, path->tag.nreg/4); assert( path->nloop > 0 ); size *= 2; - + for(; size > 0; pMem+= 2, size--) { int reg = (int)((path->regs >> path->regn) & 0xf); - + g_GIFRegHandlers[reg](pMem); - + path->regn += 4; - - if (path->nreg == path->regn) + + if (path->nreg == path->regn) { path->regn = 0; - if( path->nloop-- <= 1 ) + if( path->nloop-- <= 1 ) { size--; pMem += 2; @@ -413,28 +413,28 @@ template void _GSgifTransfer(u32 *pMem, u32 size) { int process = min((int)size, path->nloop); - if( process > 0 ) + if( process > 0 ) { - if ( gs.imageTransfer ) + if ( gs.imageTransfer ) ZeroGS::TransferLocalHost(pMem, process); - else + else ZeroGS::TransferHostLocal(pMem, process*4); path->nloop -= process; - pMem += process*4; + pMem += process*4; size -= process; assert( size == 0 || path->nloop == 0 ); } break; } - else + else { // simulate int process = min((int)size, path->nloop); - + path->nloop -= process; - pMem += process*4; + pMem += process*4; size -= process; } @@ -452,10 +452,10 @@ template void _GSgifTransfer(u32 *pMem, u32 size) // This is the case when not all data was readed from one try: VU1 has too much data. // So we should redo reading from the start. - if ((index == 0) && size == 0 && path->nloop > 0) + if ((index == 0) && size == 0 && path->nloop > 0) { ERROR_LOG_SPAMA("VU1 too much data, ignore if gfx are fine %d\n", path->nloop) - // TODO: this code is not working correctly. Anyway, ringing work only in single-threaded mode. + // TODO: this code is not working correctly. Anyway, ringing work only in single-threaded mode. // _GSgifTransfer(&gs.path[0], (u32*)((u8*)pMem-0x4000), (0x4000)/16); } } @@ -465,9 +465,9 @@ void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr) FUNCLOG pathInfo *path = &gs.path[0]; - + //GS_LOG("GSgifTransfer1 0x%x (mode %d)\n", addr, path->mode); - + // addr &= 0x3fff; #ifdef _DEBUG @@ -479,7 +479,7 @@ void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr) path->eop = 0; _GSgifTransfer<0>((u32*)((u8*)pMem + addr), (0x4000 - addr)/16); - if (!path->eop && (path->nloop > 0)) + if (!path->eop && (path->nloop > 0)) { assert( (addr&0xf) == 0 ); //BUG path->nloop = 0; @@ -493,7 +493,7 @@ void CALLBACK GSgifTransfer2(u32 *pMem, u32 size) FUNCLOG //GS_LOG("GSgifTransfer2 size = %lx (mode %d, gs.path2.tag.nloop = %d)\n", size, gs.path[1].mode, gs.path[1].tag.nloop); - + _GSgifTransfer<1>(pMem, size); } diff --git a/plugins/zzogl-pg/opengl/GifTransfer.h b/plugins/zzogl-pg/opengl/GifTransfer.h index ff2c4f7d37..836a533fd6 100644 --- a/plugins/zzogl-pg/opengl/GifTransfer.h +++ b/plugins/zzogl-pg/opengl/GifTransfer.h @@ -15,14 +15,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef GIFTRANSFER_H_INCLUDED #define GIFTRANSFER_H_INCLUDED #include "Regs.h" #include "Util.h" -// If you notice bugs in the newest revisions, you might try disabling this, +// If you notice bugs in the newest revisions, you might try disabling this, // to see if they are related. #define NEW_GIF_TRANSFER enum GIF_FLG @@ -67,9 +67,9 @@ union GIFTag // EE part. Data transfer packet description -typedef struct +typedef struct { -#ifdef NEW_GIF_TRANSFER +#ifdef NEW_GIF_TRANSFER u32 mode; int reg; u64 regs; @@ -90,18 +90,18 @@ typedef struct #endif #ifdef NEW_GIF_TRANSFER - void setTag(u32 *data) + void setTag(u32 *data) { tag.set(data); nloop = tag.NLOOP; eop = tag.EOP; mode = tag.FLG; - + // Hmm.... nreg = tag.NREG << 2; if (nreg == 0) nreg = 64; - + regs = tag.REGS; reg = 0; @@ -109,8 +109,8 @@ typedef struct // data[3], data[2], data[1], data[0], // path->eop, path->nloop, mode, path->nreg, tag.PRE); } - - u32 GetReg() + + u32 GetReg() { return (regs >> reg) & 0xf; } @@ -118,13 +118,13 @@ typedef struct bool StepReg() { reg += 4; - - if (reg == nreg) + + if (reg == nreg) { reg = 0; nloop--; - - if (nloop == 0) + + if (nloop == 0) { return false; } @@ -132,7 +132,7 @@ typedef struct return true; } #else - void setTag(u32 *data) + void setTag(u32 *data) { tag.set(data); @@ -141,7 +141,7 @@ typedef struct u32 tagpre = tag.PRE; u32 tagprim = tag.PRIM; u32 tagflg = tag.FLG; - + // Hmm.... nreg = tag.NREG << 2; if (nreg == 0) nreg = 64; @@ -152,7 +152,7 @@ typedef struct mode = tagflg; - switch (mode) + switch (mode) { case GIF_FLG_PACKED: regs = *(u64 *)(data+2); diff --git a/plugins/zzogl-pg/opengl/Linux/Conf.cpp b/plugins/zzogl-pg/opengl/Linux/Conf.cpp index 4caac02e5d..c7de8d878b 100644 --- a/plugins/zzogl-pg/opengl/Linux/Conf.cpp +++ b/plugins/zzogl-pg/opengl/Linux/Conf.cpp @@ -24,17 +24,17 @@ #include #include "GS.h" -void SaveConfig() +void SaveConfig() { const std::string iniFile( s_strIniPath + "zzogl-pg.ini" ); FILE* f = fopen(iniFile.c_str(),"w"); - if (f == NULL) + if (f == NULL) { printf("failed to open %s\n", iniFile.c_str()); return; } - + fprintf(f, "interlace = %hhx\n", conf.interlace); fprintf(f, "mrtdepth = %hhx\n", conf.mrtdepth); fprintf(f, "options = %x\n", conf.options); //u32 @@ -44,7 +44,7 @@ void SaveConfig() fclose(f); } -void LoadConfig() +void LoadConfig() { int err = 0; memset(&conf, 0, sizeof(conf)); @@ -58,7 +58,7 @@ void LoadConfig() const std::string iniFile( s_strIniPath + "zzogl-pg.ini" ); FILE* f = fopen(iniFile.c_str(), "r"); - if (f == NULL) + if (f == NULL) { printf("failed to open %s\n", iniFile.c_str()); SaveConfig();//save and return @@ -76,7 +76,7 @@ void LoadConfig() if ((conf.aa < 0) || (conf.aa > 4)) conf.aa = 0; conf.isWideScreen = conf.options & GSOPTION_WIDESCREEN; - switch(conf.options & GSOPTION_WINDIMS) + switch(conf.options & GSOPTION_WINDIMS) { case GSOPTION_WIN640: conf.width = 640; @@ -100,7 +100,7 @@ void LoadConfig() conf.options &= ~(GSOPTION_WIREFRAME | GSOPTION_CAPTUREAVI); conf.options |= GSOPTION_LOADED; - if( conf.width <= 0 || conf.height <= 0 ) + if( conf.width <= 0 || conf.height <= 0 ) { conf.width = 640; conf.height = 480; diff --git a/plugins/zzogl-pg/opengl/Linux/Linux.cpp b/plugins/zzogl-pg/opengl/Linux/Linux.cpp index e8cc5689eb..7663f28156 100644 --- a/plugins/zzogl-pg/opengl/Linux/Linux.cpp +++ b/plugins/zzogl-pg/opengl/Linux/Linux.cpp @@ -34,7 +34,7 @@ void CALLBACK GSkeyEvent(keyEvent *ev) { //static bool bShift = false; static bool bAlt = false; - + switch(ev->evt) { case KEYPRESS: switch(ev->key) { @@ -45,7 +45,7 @@ void CALLBACK GSkeyEvent(keyEvent *ev) THR_KeyEvent = ev->key ; break; case XK_Escape: - if (conf.options & GSOPTION_FULLSCREEN) + if (conf.options & GSOPTION_FULLSCREEN) GSclose(); break; case XK_Shift_L: @@ -89,7 +89,7 @@ void CreateGameHackTable(GtkWidget *treeview) GtkListStore *treestore;//Gets typecast as GtkTreeModel as needed. GtkTreeIter treeiter; GtkTreeViewColumn *treecol; - + //--------- Let's build a treeview for our advanced options! --------// treestore = gtk_list_store_new(2,G_TYPE_BOOLEAN, G_TYPE_STRING); @@ -103,7 +103,7 @@ void CreateGameHackTable(GtkWidget *treeview) gtk_tree_view_column_add_attribute(treecol, treerend, "active", 0);//link 'active' attrib to first column of model g_object_set(treerend, "activatable", TRUE, NULL);//set 'activatable' attrib true by default for all rows regardless of model. g_signal_connect(treerend, "toggled", (GCallback) OnToggle_advopts, treestore);//set a global callback, we also pass a reference to our treestore. - + //COLUMN 1 is the text descriptions treecol = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(treecol, "Description"); @@ -114,7 +114,7 @@ void CreateGameHackTable(GtkWidget *treeview) //setup the model with all our rows of option data mapConfOpts.clear(); - + add_map_entry(GAME_TEXTURETARGS, "00000001", "Tex Target checking - 00000001\nLego Racers"); add_map_entry(GAME_AUTORESET, "00000002", "Auto reset targs - 00000002\nShadow Hearts, Samurai Warriors. Use when game is slow and toggling AA fixes it."); add_map_entry(GAME_NOTARGETRESOLVE, "00000010", "No target resolves - 00000010\nStops all resolving of targets. Try this first for really slow games. Dark Cloud 1"); @@ -139,7 +139,7 @@ void CreateGameHackTable(GtkWidget *treeview) add_map_entry(GAME_NOLOGZ, "20000000", "No logarithmic Z, could decrease number of Z-artefacts - 20000000"); add_map_entry(GAME_INTERLACE2X, "00000004", "Interlace 2X - 00000004\nFixes 2x bigger screen (Gradius 3)."); - for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) + for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) { gtk_list_store_append(treestore, &treeiter);//new row itval = (conf.gamesettings&it->second.value)?TRUE:FALSE; @@ -149,7 +149,7 @@ void CreateGameHackTable(GtkWidget *treeview) gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(treestore));//NB: store is cast as tree model. g_object_unref(treestore);//allow model to be destroyed when the tree is destroyed. - + //don't select/highlight rows gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), GTK_SELECTION_NONE); //------treeview done -------// @@ -160,22 +160,22 @@ void SaveGameHackTable(GtkWidget *treeview) GtkTreeModel *treemodel; GtkTreeIter treeiter; gboolean treeoptval; - + //------- get advanced options from the treeview model -------// treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter_first(treemodel, &treeiter); conf.gamesettings = 0; - for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) + for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) { treeoptval = FALSE; gtk_tree_model_get(treemodel, &treeiter, 0, &treeoptval, -1); - + if(treeoptval) conf.gamesettings |= it->second.value; - - gtk_tree_model_iter_next(treemodel,&treeiter); + + gtk_tree_model_iter_next(treemodel,&treeiter); } - + GSsetGameCRC(0, conf.gamesettings); //---------- done getting advanced options ---------// } @@ -194,10 +194,10 @@ void OnToggle_advopts(GtkCellRendererToggle *cell, gchar *path, gpointer user_da void DisplayDialog() { int return_value; - + GtkWidget *dialog; GtkWidget *main_frame, *main_box; - + GtkWidget *option_frame, *option_box; GtkWidget *int_label, *int_box; GtkWidget *bilinear_check, *bilinear_label; @@ -206,13 +206,13 @@ void DisplayDialog() GtkWidget *snap_label, *snap_box; GtkWidget *size_label, *size_box; GtkWidget *fullscreen_check, *widescreen_check; - + GtkWidget *advanced_frame, *advanced_box; GtkWidget *advanced_scroll; GtkWidget *tree; - + if (!(conf.options & GSOPTION_LOADED)) LoadConfig(); - + /* Create the widgets */ dialog = gtk_dialog_new_with_buttons ( "ZZOgl PG Config", @@ -223,18 +223,18 @@ void DisplayDialog() GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - + int_label = gtk_label_new ("Interlacing: (F5 to toggle)"); int_box = gtk_combo_box_new_text (); gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "No Interlacing"); gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "Interlace 0"); gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "Interlace 1"); gtk_combo_box_set_active(GTK_COMBO_BOX(int_box), conf.interlace); - - + + bilinear_check = gtk_check_button_new_with_label("Bilinear Filtering (Shift + F5)"); bilinear_label = gtk_label_new ("Best quality is off. Turn on for speed."); - + aa_label = gtk_label_new ("Anti-Aliasing for Higher Quality(F6)"); aa_box = gtk_combo_box_new_text (); gtk_combo_box_append_text(GTK_COMBO_BOX(aa_box), "1X - No Anti-Aliasing"); @@ -243,19 +243,19 @@ void DisplayDialog() gtk_combo_box_append_text(GTK_COMBO_BOX(aa_box), "8X - Anti-Aliasing x 8"); gtk_combo_box_append_text(GTK_COMBO_BOX(aa_box), "16X - Anti-Aliasing x 16"); gtk_combo_box_set_active(GTK_COMBO_BOX(aa_box), conf.aa); - + wireframe_check = gtk_check_button_new_with_label("Wireframe Rendering(Shift + F6)"); avi_check = gtk_check_button_new_with_label("Capture Avi (as zerogs.avi)(F7)"); - + snap_label = gtk_label_new ("Snapshot format:"); snap_box = gtk_combo_box_new_text (); gtk_combo_box_append_text(GTK_COMBO_BOX(snap_box), "JPEG"); gtk_combo_box_append_text(GTK_COMBO_BOX(snap_box), "TIFF"); gtk_combo_box_set_active(GTK_COMBO_BOX(snap_box), conf.options&GSOPTION_TGASNAP); - + fullscreen_check = gtk_check_button_new_with_label("Fullscreen (Alt + Enter)"); widescreen_check = gtk_check_button_new_with_label("Widescreen"); - + size_label = gtk_label_new ("Default Window Size: (no speed impact)"); size_box = gtk_combo_box_new_text (); gtk_combo_box_append_text(GTK_COMBO_BOX(size_box), "640x480"); @@ -263,24 +263,24 @@ void DisplayDialog() gtk_combo_box_append_text(GTK_COMBO_BOX(size_box), "1024x768"); gtk_combo_box_append_text(GTK_COMBO_BOX(size_box), "1280x960"); gtk_combo_box_set_active(GTK_COMBO_BOX(size_box), (conf.options&GSOPTION_WINDIMS)>>4); - + main_box = gtk_hbox_new(false, 5); main_frame = gtk_frame_new ("ZZOgl PG Config"); gtk_container_add (GTK_CONTAINER(main_frame), main_box); - + option_box = gtk_vbox_new(false, 5); option_frame = gtk_frame_new (""); gtk_container_add (GTK_CONTAINER(option_frame), option_box); - + advanced_box = gtk_vbox_new(false, 5); advanced_frame = gtk_frame_new ("Advanced Settings:"); gtk_container_add (GTK_CONTAINER(advanced_frame), advanced_box); - + tree = gtk_tree_view_new(); CreateGameHackTable(tree); advanced_scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(advanced_scroll), tree); - + gtk_box_pack_start(GTK_BOX(option_box), int_label, false, false, 2); gtk_box_pack_start(GTK_BOX(option_box), int_box, false, false, 2); gtk_box_pack_start(GTK_BOX(option_box), bilinear_check, false, false, 2); @@ -295,36 +295,36 @@ void DisplayDialog() gtk_box_pack_start(GTK_BOX(option_box), widescreen_check, false, false, 2); gtk_box_pack_start(GTK_BOX(option_box), size_label, false, false, 2); gtk_box_pack_start(GTK_BOX(option_box), size_box, false, false, 2); - + gtk_box_pack_start(GTK_BOX(advanced_box), advanced_scroll, true, true, 2); - + gtk_box_pack_start(GTK_BOX(main_box), option_frame, false, false, 2); gtk_box_pack_start(GTK_BOX(main_box), advanced_frame, true, true, 2); - + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bilinear_check), conf.bilinear); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wireframe_check), (conf.options & GSOPTION_WIREFRAME)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(avi_check), (conf.options & GSOPTION_CAPTUREAVI)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fullscreen_check), (conf.options & GSOPTION_FULLSCREEN)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widescreen_check), (conf.options & GSOPTION_WIDESCREEN)); - + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_frame); gtk_widget_show_all (dialog); - + return_value = gtk_dialog_run (GTK_DIALOG (dialog)); - + if (return_value == GTK_RESPONSE_ACCEPT) { int fake_options = 0; SaveGameHackTable(tree); - - if (gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)) != -1) + + if (gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)) != -1) conf.interlace = gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)); - if (gtk_combo_box_get_active(GTK_COMBO_BOX(aa_box)) != -1) + if (gtk_combo_box_get_active(GTK_COMBO_BOX(aa_box)) != -1) conf.aa = gtk_combo_box_get_active(GTK_COMBO_BOX(aa_box)); - - conf.negaa = 0; - + + conf.negaa = 0; + switch(gtk_combo_box_get_active(GTK_COMBO_BOX(size_box))) { case 0: fake_options |= GSOPTION_WIN640; break; @@ -332,28 +332,28 @@ void DisplayDialog() case 2: fake_options |= GSOPTION_WIN1024; break; case 3: fake_options |= GSOPTION_WIN1280; break; } - + conf.bilinear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bilinear_check)); - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wireframe_check))) + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wireframe_check))) fake_options |= GSOPTION_WIREFRAME; - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(avi_check))) + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(avi_check))) fake_options |= GSOPTION_CAPTUREAVI; - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fullscreen_check))) + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fullscreen_check))) fake_options |= GSOPTION_FULLSCREEN; - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widescreen_check))) + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widescreen_check))) fake_options |= GSOPTION_WIDESCREEN; - - if (gtk_combo_box_get_active(GTK_COMBO_BOX(snap_box)) == 1) + + if (gtk_combo_box_get_active(GTK_COMBO_BOX(snap_box)) == 1) fake_options |= GSOPTION_TGASNAP; conf.options = fake_options; SaveConfig(); } - + gtk_widget_destroy (dialog); } @@ -361,9 +361,9 @@ void CALLBACK GSconfigure() { char strcurdir[256]; getcwd(strcurdir, 256); - + if (!(conf.options & GSOPTION_LOADED)) LoadConfig(); - + DisplayDialog(); } @@ -388,34 +388,34 @@ void SysMessage(const char *fmt, ...) gtk_widget_destroy (dialog); } -void CALLBACK GSabout() +void CALLBACK GSabout() { SysMessage("ZZOgl PG: by Zeydlitz (PG version worked on by arcum42). Based off of ZeroGS, by zerofrog."); } -s32 CALLBACK GStest() +s32 CALLBACK GStest() { return 0; } -void *SysLoadLibrary(char *lib) +void *SysLoadLibrary(char *lib) { return dlopen(lib, RTLD_NOW | RTLD_GLOBAL); } -void *SysLoadSym(void *lib, char *sym) +void *SysLoadSym(void *lib, char *sym) { void *ret = dlsym(lib, sym); if (ret == NULL) printf("null: %s\n", sym); return dlsym(lib, sym); } -char *SysLibError() +char *SysLibError() { return dlerror(); } -void SysCloseLibrary(void *lib) +void SysCloseLibrary(void *lib) { dlclose(lib); } diff --git a/plugins/zzogl-pg/opengl/Mem.cpp b/plugins/zzogl-pg/opengl/Mem.cpp index 55ad989da5..8eeedb62f5 100644 --- a/plugins/zzogl-pg/opengl/Mem.cpp +++ b/plugins/zzogl-pg/opengl/Mem.cpp @@ -30,10 +30,10 @@ BLOCK m_Blocks[0x40]; // do so blocks are indexable PCSX2_ALIGNED16(u32 tempblock[64]); // Add a bunch of local variables that used to be in the TransferHostLocal -// functions, in order to de-macro the TransmitHostLocal macros. +// functions, in order to de-macro the TransmitHostLocal macros. // May be in a class or namespace eventually. int tempX, tempY; -int pitch, area, fracX; +int pitch, area, fracX; int nSize; u8* pstart; @@ -50,50 +50,50 @@ u8* pstart; template static __forceinline const T* AlignOnBlockBoundry(TransferData data, TransferFuncts fun, Point alignedPt, int& endY, const T* pbuf) { - bool bCanAlign = ((MOD_POW2(gs.trxpos.dx, data.blockwidth) == 0) && (gs.imageX == gs.trxpos.dx) && - (alignedPt.y > endY) && (alignedPt.x > gs.trxpos.dx)); - - if ((gs.imageEndX - gs.trxpos.dx) % data.widthlimit) - { - /* hack */ - int testwidth = (int)nSize - + bool bCanAlign = ((MOD_POW2(gs.trxpos.dx, data.blockwidth) == 0) && (gs.imageX == gs.trxpos.dx) && + (alignedPt.y > endY) && (alignedPt.x > gs.trxpos.dx)); + + if ((gs.imageEndX - gs.trxpos.dx) % data.widthlimit) + { + /* hack */ + int testwidth = (int)nSize - (gs.imageEndY - gs.imageY) * (gs.imageEndX - gs.trxpos.dx) - + (gs.imageX - gs.trxpos.dx); - - if ((testwidth <= data.widthlimit) && (testwidth >= -data.widthlimit)) - { - /* don't transfer */ - /*DEBUG_LOG("bad texture %s: %d %d %d\n", #psm, gs.trxpos.dx, gs.imageEndX, nQWordSize);*/ + + (gs.imageX - gs.trxpos.dx); + + if ((testwidth <= data.widthlimit) && (testwidth >= -data.widthlimit)) + { + /* don't transfer */ + /*DEBUG_LOG("bad texture %s: %d %d %d\n", #psm, gs.trxpos.dx, gs.imageEndX, nQWordSize);*/ //ERROR_LOG("bad texture: testwidth = %d; data.widthlimit = %d\n", testwidth, data.widthlimit); - gs.imageTransfer = -1; - } - bCanAlign = false; - } - /* first align on block boundary */ - if ( MOD_POW2(gs.imageY, data.blockheight) || !bCanAlign ) - { + gs.imageTransfer = -1; + } + bCanAlign = false; + } + /* first align on block boundary */ + if ( MOD_POW2(gs.imageY, data.blockheight) || !bCanAlign ) + { u32 transwidth; - - if( !bCanAlign ) - endY = gs.imageEndY; /* transfer the whole image */ - else - assert( endY < gs.imageEndY); /* part of alignment condition */ - - if (((gs.imageEndX - gs.trxpos.dx) % data.widthlimit) || ((gs.imageEndX - gs.imageX) % data.widthlimit)) - { - /* transmit with a width of 1 */ + + if( !bCanAlign ) + endY = gs.imageEndY; /* transfer the whole image */ + else + assert( endY < gs.imageEndY); /* part of alignment condition */ + + if (((gs.imageEndX - gs.trxpos.dx) % data.widthlimit) || ((gs.imageEndX - gs.imageX) % data.widthlimit)) + { + /* transmit with a width of 1 */ transwidth = (1 + (DSTPSM == PSMT4)); - } - else - { + } + else + { transwidth = data.widthlimit; - } - + } + pbuf = TransmitHostLocalY(data, fun.wp, transwidth, endY, pbuf); if (pbuf == NULL) return NULL; - - if( nSize == 0 || tempY == gs.imageEndY ) return NULL; - } + + if( nSize == 0 || tempY == gs.imageEndY ) return NULL; + } return pbuf; } @@ -103,219 +103,219 @@ static __forceinline const T* TransferAligningToBlocks(TransferData data, Transf bool bAligned; const u32 TSize = sizeof(T); _SwizzleBlock swizzle; - - /* can align! */ - pitch = gs.imageEndX - gs.trxpos.dx; - area = pitch * data.blockheight; - fracX = gs.imageEndX - alignedPt.x; - - /* on top of checking whether pbuf is aligned, make sure that the width is at least aligned to its limits (due to bugs in pcsx2) */ - bAligned = !((uptr)pbuf & 0xf) && (TransPitch(pitch, data.transfersize) & 0xf) == 0; - - if ( bAligned || ((DSTPSM==PSMCT24) || (DSTPSM==PSMT8H) || (DSTPSM==PSMT4HH) || (DSTPSM==PSMT4HL))) + + /* can align! */ + pitch = gs.imageEndX - gs.trxpos.dx; + area = pitch * data.blockheight; + fracX = gs.imageEndX - alignedPt.x; + + /* on top of checking whether pbuf is aligned, make sure that the width is at least aligned to its limits (due to bugs in pcsx2) */ + bAligned = !((uptr)pbuf & 0xf) && (TransPitch(pitch, data.transfersize) & 0xf) == 0; + + if ( bAligned || ((DSTPSM==PSMCT24) || (DSTPSM==PSMT8H) || (DSTPSM==PSMT4HH) || (DSTPSM==PSMT4HL))) swizzle = (fun.Swizzle); - else + else swizzle = (fun.Swizzle_u); - + //Transfer aligning to blocks. - for(; tempY < alignedPt.y && nSize >= area; tempY += data.blockheight, nSize -= area) - { - for(int tempj = gs.trxpos.dx; tempj < alignedPt.x; tempj += data.blockwidth, pbuf += TransPitch(data.blockwidth, data.transfersize)/TSize) - { + for(; tempY < alignedPt.y && nSize >= area; tempY += data.blockheight, nSize -= area) + { + for(int tempj = gs.trxpos.dx; tempj < alignedPt.x; tempj += data.blockwidth, pbuf += TransPitch(data.blockwidth, data.transfersize)/TSize) + { u8 *temp = pstart + fun.gp(tempj, tempY, gs.dstbuf.bw) * data.blockbits/8; - swizzle(temp, (u8*)pbuf, TransPitch(pitch, data.transfersize), 0xffffffff); - } - - /* transfer the rest */ + swizzle(temp, (u8*)pbuf, TransPitch(pitch, data.transfersize), 0xffffffff); + } + + /* transfer the rest */ if (alignedPt.x < gs.imageEndX) - { + { pbuf = TransmitHostLocalX(data, fun.wp, data.widthlimit, data.blockheight, alignedPt.x, pbuf); if (pbuf == NULL) return NULL; - - pbuf -= TransPitch((alignedPt.x - gs.trxpos.dx), data.transfersize)/TSize; - } - else - { - pbuf += (data.blockheight - 1)* TransPitch(pitch, data.transfersize)/TSize; + + pbuf -= TransPitch((alignedPt.x - gs.trxpos.dx), data.transfersize)/TSize; } - - tempX = gs.trxpos.dx; + else + { + pbuf += (data.blockheight - 1)* TransPitch(pitch, data.transfersize)/TSize; + } + + tempX = gs.trxpos.dx; } return pbuf; } static __forceinline int FinishTransfer(TransferData data, int nLeftOver) { - if( tempY >= gs.imageEndY ) - { - assert( gs.imageTransfer == -1 || tempY == gs.imageEndY ); - gs.imageTransfer = -1; - /*int start, end; - ZeroGS::GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw); + if( tempY >= gs.imageEndY ) + { + assert( gs.imageTransfer == -1 || tempY == gs.imageEndY ); + gs.imageTransfer = -1; + /*int start, end; + ZeroGS::GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw); ZeroGS::g_MemTargs.ClearRange(start, end);*/ - } - else - { - /* update new params */ - gs.imageY = tempY; - gs.imageX = tempX; - } - - return (nSize * TransPitch(2, data.transfersize) + nLeftOver)/2; + } + else + { + /* update new params */ + gs.imageY = tempY; + gs.imageX = tempX; + } + + return (nSize * TransPitch(2, data.transfersize) + nLeftOver)/2; } template static __forceinline int RealTransfer(TransferData data, TransferFuncts fun, const void* pbyMem, u32 nQWordSize) { - assert( gs.imageTransfer == 0 ); - - pstart = g_pbyGSMemory + gs.dstbuf.bp*256; - const T* pbuf = (const T*)pbyMem; + assert( gs.imageTransfer == 0 ); + + pstart = g_pbyGSMemory + gs.dstbuf.bp*256; + const T* pbuf = (const T*)pbyMem; const int tp2 = TransPitch(2, data.transfersize); - int nLeftOver = (nQWordSize*4*2)%tp2; - tempY = gs.imageY; tempX = gs.imageX; + int nLeftOver = (nQWordSize*4*2)%tp2; + tempY = gs.imageY; tempX = gs.imageX; Point alignedPt; - - nSize = (nQWordSize*4*2)/tp2; - nSize = min(nSize, gs.imageWnew * gs.imageHnew); - - int endY = ROUND_UPPOW2(gs.imageY, data.blockheight); - alignedPt.y = ROUND_DOWNPOW2(gs.imageEndY, data.blockheight); - alignedPt.x = ROUND_DOWNPOW2(gs.imageEndX, data.blockwidth); - + + nSize = (nQWordSize*4*2)/tp2; + nSize = min(nSize, gs.imageWnew * gs.imageHnew); + + int endY = ROUND_UPPOW2(gs.imageY, data.blockheight); + alignedPt.y = ROUND_DOWNPOW2(gs.imageEndY, data.blockheight); + alignedPt.x = ROUND_DOWNPOW2(gs.imageEndX, data.blockwidth); + pbuf = AlignOnBlockBoundry(data, fun, alignedPt, endY, pbuf); if (pbuf == NULL) return FinishTransfer(data, nLeftOver); pbuf = TransferAligningToBlocks(data, fun, alignedPt, pbuf); if (pbuf == NULL) return FinishTransfer(data, nLeftOver); - - if (TransPitch(nSize, data.transfersize)/4 > 0) - { + + if (TransPitch(nSize, data.transfersize)/4 > 0) + { pbuf = TransmitHostLocalY(data, fun.wp, data.widthlimit, gs.imageEndY, pbuf); if (pbuf == NULL) return FinishTransfer(data, nLeftOver); - /* sometimes wrong sizes are sent (tekken tag) */ - assert( gs.imageTransfer == -1 || TransPitch(nSize, data.transfersize)/4 <= 2 ); - } - + /* sometimes wrong sizes are sent (tekken tag) */ + assert( gs.imageTransfer == -1 || TransPitch(nSize, data.transfersize)/4 <= 2 ); + } + return FinishTransfer(data, nLeftOver); } //DEFINE_TRANSFERLOCAL(32, u32, 2, 32, 8, 8, _, SwizzleBlock32); -int TransferHostLocal32(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal32(const void* pbyMem, u32 nQWordSize) +{ TransferData data(2,32,8,8,32, PSM_); TransferFuncts fun(writePixel32_0, getPixelAddress32_0, SwizzleBlock32, SwizzleBlock32u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(32Z, u32, 2, 32, 8, 8, _, SwizzleBlock32); -int TransferHostLocal32Z(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal32Z(const void* pbyMem, u32 nQWordSize) +{ TransferData data(2,32,8,8,32, PSM_); TransferFuncts fun(writePixel32Z_0, getPixelAddress32Z_0, SwizzleBlock32, SwizzleBlock32u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(24, u8, 8, 32, 8, 8, _24, SwizzleBlock24); -int TransferHostLocal24(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal24(const void* pbyMem, u32 nQWordSize) +{ TransferData data(8,32,8,8,24, PSM_24_); TransferFuncts fun(writePixel24_0, getPixelAddress24_0, SwizzleBlock24, SwizzleBlock24u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(24Z, u8, 8, 32, 8, 8, _24, SwizzleBlock24); -int TransferHostLocal24Z(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal24Z(const void* pbyMem, u32 nQWordSize) +{ TransferData data(8,32,8,8,24, PSM_24_); TransferFuncts fun(writePixel24Z_0, getPixelAddress24Z_0, SwizzleBlock24, SwizzleBlock24u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(16, u16, 4, 16, 16, 8, _, SwizzleBlock16); -int TransferHostLocal16(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal16(const void* pbyMem, u32 nQWordSize) +{ TransferData data(4,16,16,8,16, PSM_); TransferFuncts fun(writePixel16_0, getPixelAddress16_0, SwizzleBlock16, SwizzleBlock16u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(16S, u16, 4, 16, 16, 8, _, SwizzleBlock16); -int TransferHostLocal16S(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal16S(const void* pbyMem, u32 nQWordSize) +{ TransferData data(4,16,16,8,16, PSM_); TransferFuncts fun(writePixel16S_0, getPixelAddress16S_0, SwizzleBlock16, SwizzleBlock16u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(16Z, u16, 4, 16, 16, 8, _, SwizzleBlock16); -int TransferHostLocal16Z(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal16Z(const void* pbyMem, u32 nQWordSize) +{ TransferData data(4,16,16,8,16, PSM_); TransferFuncts fun(writePixel16Z_0, getPixelAddress16Z_0, SwizzleBlock16, SwizzleBlock16u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(16SZ, u16, 4, 16, 16, 8, _, SwizzleBlock16); -int TransferHostLocal16SZ(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal16SZ(const void* pbyMem, u32 nQWordSize) +{ TransferData data(4,16,16,8,16, PSM_); TransferFuncts fun(writePixel16SZ_0, getPixelAddress16SZ_0, SwizzleBlock16, SwizzleBlock16u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(8, u8, 4, 8, 16, 16, _, SwizzleBlock8); -int TransferHostLocal8(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal8(const void* pbyMem, u32 nQWordSize) +{ TransferData data(4,8,16,16,8, PSM_); TransferFuncts fun(writePixel8_0, getPixelAddress8_0, SwizzleBlock8, SwizzleBlock8u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(4, u8, 8, 4, 32, 16, _4, SwizzleBlock4); -int TransferHostLocal4(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal4(const void* pbyMem, u32 nQWordSize) +{ TransferData data(8,4,32,16,4, PSM_4_); TransferFuncts fun(writePixel4_0, getPixelAddress4_0, SwizzleBlock4, SwizzleBlock4u); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(8H, u8, 4, 32, 8, 8, _, SwizzleBlock8H); -int TransferHostLocal8H(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal8H(const void* pbyMem, u32 nQWordSize) +{ TransferData data(4,32,8,8,8, PSM_); TransferFuncts fun(writePixel8H_0, getPixelAddress8H_0, SwizzleBlock8H, SwizzleBlock8Hu); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(4HL, u8, 8, 32, 8, 8, _4, SwizzleBlock4HL); -int TransferHostLocal4HL(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal4HL(const void* pbyMem, u32 nQWordSize) +{ TransferData data(8,32,8,8,4, PSM_4_); TransferFuncts fun(writePixel4HL_0, getPixelAddress4HL_0, SwizzleBlock4HL, SwizzleBlock4HLu); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} //DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH); -int TransferHostLocal4HH(const void* pbyMem, u32 nQWordSize) -{ +int TransferHostLocal4HH(const void* pbyMem, u32 nQWordSize) +{ TransferData data(8,32,8,8,4, PSM_4_); TransferFuncts fun(writePixel4HH_0, getPixelAddress4HH_0, SwizzleBlock4HH, SwizzleBlock4HHu); return RealTransfer(data, fun, pbyMem, nQWordSize); -} +} void TransferLocalHost32(void* pbyMem, u32 nQWordSize) { FUNCLOG } void TransferLocalHost24(void* pbyMem, u32 nQWordSize) {FUNCLOG} diff --git a/plugins/zzogl-pg/opengl/Mem.h b/plugins/zzogl-pg/opengl/Mem.h index 089d1b6037..1cc7a24a64 100644 --- a/plugins/zzogl-pg/opengl/Mem.h +++ b/plugins/zzogl-pg/opengl/Mem.h @@ -140,14 +140,14 @@ extern u32 g_pageTable16SZ[64][64]; extern u32 g_pageTable8[64][128]; extern u32 g_pageTable4[128][128]; -static __forceinline u32 getPixelAddress32(int x, int y, u32 bp, u32 bw) +static __forceinline u32 getPixelAddress32(int x, int y, u32 bp, u32 bw) { u32 basepage = ((y>>5) * (bw>>6)) + (x>>6); u32 word = bp * 64 + basepage * 2048 + g_pageTable32[y&31][x&63]; return word; } -static __forceinline u32 getPixelAddress32_0(int x, int y, u32 bw) +static __forceinline u32 getPixelAddress32_0(int x, int y, u32 bw) { u32 basepage = ((y>>5) * (bw>>6)) + (x>>6); u32 word = basepage * 2048 + g_pageTable32[y&31][x&63]; @@ -163,70 +163,70 @@ static __forceinline u32 getPixelAddress32_0(int x, int y, u32 bw) #define getPixelAddress4HH getPixelAddress32 #define getPixelAddress4HH_0 getPixelAddress32_0 -static __forceinline u32 getPixelAddress16(int x, int y, u32 bp, u32 bw) +static __forceinline u32 getPixelAddress16(int x, int y, u32 bp, u32 bw) { u32 basepage = ((y>>6) * (bw>>6)) + (x>>6); u32 word = bp * 128 + basepage * 4096 + g_pageTable16[y&63][x&63]; return word; } -static __forceinline u32 getPixelAddress16_0(int x, int y, u32 bw) +static __forceinline u32 getPixelAddress16_0(int x, int y, u32 bw) { u32 basepage = ((y>>6) * (bw>>6)) + (x>>6); u32 word = basepage * 4096 + g_pageTable16[y&63][x&63]; return word; } -static __forceinline u32 getPixelAddress16S(int x, int y, u32 bp, u32 bw) +static __forceinline u32 getPixelAddress16S(int x, int y, u32 bp, u32 bw) { u32 basepage = ((y>>6) * (bw>>6)) + (x>>6); u32 word = bp * 128 + basepage * 4096 + g_pageTable16S[y&63][x&63]; return word; } -static __forceinline u32 getPixelAddress16S_0(int x, int y, u32 bw) +static __forceinline u32 getPixelAddress16S_0(int x, int y, u32 bw) { u32 basepage = ((y>>6) * (bw>>6)) + (x>>6); u32 word = basepage * 4096 + g_pageTable16S[y&63][x&63]; return word; } -static __forceinline u32 getPixelAddress8(int x, int y, u32 bp, u32 bw) +static __forceinline u32 getPixelAddress8(int x, int y, u32 bp, u32 bw) { u32 basepage = ((y>>6) * ((bw+127)>>7)) + (x>>7); u32 word = bp * 256 + basepage * 8192 + g_pageTable8[y&63][x&127]; return word; } -static __forceinline u32 getPixelAddress8_0(int x, int y, u32 bw) +static __forceinline u32 getPixelAddress8_0(int x, int y, u32 bw) { u32 basepage = ((y>>6) * ((bw+127)>>7)) + (x>>7); u32 word = basepage * 8192 + g_pageTable8[y&63][x&127]; return word; } -static __forceinline u32 getPixelAddress4(int x, int y, u32 bp, u32 bw) +static __forceinline u32 getPixelAddress4(int x, int y, u32 bp, u32 bw) { u32 basepage = ((y>>7) * ((bw+127)>>7)) + (x>>7); u32 word = bp * 512 + basepage * 16384 + g_pageTable4[y&127][x&127]; return word; } -static __forceinline u32 getPixelAddress4_0(int x, int y, u32 bw) +static __forceinline u32 getPixelAddress4_0(int x, int y, u32 bw) { u32 basepage = ((y>>7) * ((bw+127)>>7)) + (x>>7); u32 word = basepage * 16384 + g_pageTable4[y&127][x&127]; return word; } -static __forceinline u32 getPixelAddress32Z(int x, int y, u32 bp, u32 bw) +static __forceinline u32 getPixelAddress32Z(int x, int y, u32 bp, u32 bw) { u32 basepage = ((y>>5) * (bw>>6)) + (x>>6); u32 word = bp * 64 + basepage * 2048 + g_pageTable32Z[y&31][x&63]; return word; } -static __forceinline u32 getPixelAddress32Z_0(int x, int y, u32 bw) +static __forceinline u32 getPixelAddress32Z_0(int x, int y, u32 bw) { u32 basepage = ((y>>5) * (bw>>6)) + (x>>6); u32 word = basepage * 2048 + g_pageTable32Z[y&31][x&63]; @@ -236,28 +236,28 @@ static __forceinline u32 getPixelAddress32Z_0(int x, int y, u32 bw) #define getPixelAddress24Z getPixelAddress32Z #define getPixelAddress24Z_0 getPixelAddress32Z_0 -static __forceinline u32 getPixelAddress16Z(int x, int y, u32 bp, u32 bw) +static __forceinline u32 getPixelAddress16Z(int x, int y, u32 bp, u32 bw) { u32 basepage = ((y>>6) * (bw>>6)) + (x>>6); u32 word = bp * 128 + basepage * 4096 + g_pageTable16Z[y&63][x&63]; return word; } -static __forceinline u32 getPixelAddress16Z_0(int x, int y, u32 bw) +static __forceinline u32 getPixelAddress16Z_0(int x, int y, u32 bw) { u32 basepage = ((y>>6) * (bw>>6)) + (x>>6); u32 word = basepage * 4096 + g_pageTable16Z[y&63][x&63]; return word; } -static __forceinline u32 getPixelAddress16SZ(int x, int y, u32 bp, u32 bw) +static __forceinline u32 getPixelAddress16SZ(int x, int y, u32 bp, u32 bw) { u32 basepage = ((y>>6) * (bw>>6)) + (x>>6); u32 word = bp * 128 + basepage * 4096 + g_pageTable16SZ[y&63][x&63]; return word; } -static __forceinline u32 getPixelAddress16SZ_0(int x, int y, u32 bw) +static __forceinline u32 getPixelAddress16SZ_0(int x, int y, u32 bw) { u32 basepage = ((y>>6) * (bw>>6)) + (x>>6); u32 word = basepage * 4096 + g_pageTable16SZ[y&63][x&63]; @@ -269,39 +269,39 @@ static __forceinline u32 getPixelAddress16SZ_0(int x, int y, u32 bw) -static __forceinline void writePixel32(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel32(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { ((u32*)pmem)[getPixelAddress32(x, y, bp, bw)] = pixel; } -static __forceinline void writePixel24(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel24(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { u8 *buf = (u8*)&((u32*)pmem)[getPixelAddress32(x, y, bp, bw)]; u8 *pix = (u8*)&pixel; buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2]; } -static __forceinline void writePixel16(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel16(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { ((u16*)pmem)[getPixelAddress16(x, y, bp, bw)] = pixel; } -static __forceinline void writePixel16S(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel16S(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { ((u16*)pmem)[getPixelAddress16S(x, y, bp, bw)] = pixel; } -static __forceinline void writePixel8(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel8(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { ((u8*)pmem)[getPixelAddress8(x, y, bp, bw)] = pixel; } -static __forceinline void writePixel8H(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel8H(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { ((u8*)pmem)[4*getPixelAddress32(x, y, bp, bw)+3] = pixel; } -static __forceinline void writePixel4(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel4(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { u32 addr = getPixelAddress4(x, y, bp, bw); u8 pix = ((u8*)pmem)[addr/2]; @@ -309,36 +309,36 @@ static __forceinline void writePixel4(void* pmem, int x, int y, u32 pixel, u32 b else ((u8*)pmem)[addr/2] = (pix & 0xf0) | (pixel); } -static __forceinline void writePixel4HL(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel4HL(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { u8 *p = (u8*)pmem + 4*getPixelAddress4HL(x, y, bp, bw)+3; *p = (*p & 0xf0) | pixel; } -static __forceinline void writePixel4HH(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel4HH(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { u8 *p = (u8*)pmem + 4*getPixelAddress4HH(x, y, bp, bw)+3; *p = (*p & 0x0f) | (pixel<<4); } -static __forceinline void writePixel32Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel32Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { ((u32*)pmem)[getPixelAddress32Z(x, y, bp, bw)] = pixel; } -static __forceinline void writePixel24Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel24Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { u8 *buf = (u8*)pmem + 4*getPixelAddress32Z(x, y, bp, bw); u8 *pix = (u8*)&pixel; buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2]; } -static __forceinline void writePixel16Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel16Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { ((u16*)pmem)[getPixelAddress16Z(x, y, bp, bw)] = pixel; } -static __forceinline void writePixel16SZ(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) +static __forceinline void writePixel16SZ(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) { ((u16*)pmem)[getPixelAddress16SZ(x, y, bp, bw)] = pixel; } @@ -346,37 +346,37 @@ static __forceinline void writePixel16SZ(void* pmem, int x, int y, u32 pixel, u3 /////////////// -static __forceinline u32 readPixel32(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel32(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u32*)pmem)[getPixelAddress32(x, y, bp, bw)]; } -static __forceinline u32 readPixel24(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel24(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u32*)pmem)[getPixelAddress32(x, y, bp, bw)] & 0xffffff; } -static __forceinline u32 readPixel16(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel16(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u16*)pmem)[getPixelAddress16(x, y, bp, bw)]; } -static __forceinline u32 readPixel16S(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel16S(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u16*)pmem)[getPixelAddress16S(x, y, bp, bw)]; } -static __forceinline u32 readPixel8(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel8(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u8*)pmem)[getPixelAddress8(x, y, bp, bw)]; } -static __forceinline u32 readPixel8H(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel8H(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u8*)pmem)[4*getPixelAddress32(x, y, bp, bw) + 3]; } -static __forceinline u32 readPixel4(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel4(const void* pmem, int x, int y, u32 bp, u32 bw) { u32 addr = getPixelAddress4(x, y, bp, bw); u8 pix = ((const u8*)pmem)[addr/2]; @@ -385,13 +385,13 @@ static __forceinline u32 readPixel4(const void* pmem, int x, int y, u32 bp, u32 else return pix & 0xf; } -static __forceinline u32 readPixel4HL(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel4HL(const void* pmem, int x, int y, u32 bp, u32 bw) { const u8 *p = (const u8*)pmem+4*getPixelAddress4HL(x, y, bp, bw)+3; return *p & 0x0f; } -static __forceinline u32 readPixel4HH(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel4HH(const void* pmem, int x, int y, u32 bp, u32 bw) { const u8 *p = (const u8*)pmem+4*getPixelAddress4HH(x, y, bp, bw) + 3; return *p >> 4; @@ -399,22 +399,22 @@ static __forceinline u32 readPixel4HH(const void* pmem, int x, int y, u32 bp, u3 /////////////// -static __forceinline u32 readPixel32Z(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel32Z(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u32*)pmem)[getPixelAddress32Z(x, y, bp, bw)]; } -static __forceinline u32 readPixel24Z(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel24Z(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u32*)pmem)[getPixelAddress32Z(x, y, bp, bw)] & 0xffffff; } -static __forceinline u32 readPixel16Z(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel16Z(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u16*)pmem)[getPixelAddress16Z(x, y, bp, bw)]; } -static __forceinline u32 readPixel16SZ(const void* pmem, int x, int y, u32 bp, u32 bw) +static __forceinline u32 readPixel16SZ(const void* pmem, int x, int y, u32 bp, u32 bw) { return ((const u16*)pmem)[getPixelAddress16SZ(x, y, bp, bw)]; } @@ -423,39 +423,39 @@ static __forceinline u32 readPixel16SZ(const void* pmem, int x, int y, u32 bp, u // Functions that take 0 bps // /////////////////////////////// -static __forceinline void writePixel32_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel32_0(void* pmem, int x, int y, u32 pixel, u32 bw) { ((u32*)pmem)[getPixelAddress32_0(x, y, bw)] = pixel; } -static __forceinline void writePixel24_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel24_0(void* pmem, int x, int y, u32 pixel, u32 bw) { u8 *buf = (u8*)&((u32*)pmem)[getPixelAddress32_0(x, y, bw)]; u8 *pix = (u8*)&pixel; buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2]; } -static __forceinline void writePixel16_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel16_0(void* pmem, int x, int y, u32 pixel, u32 bw) { ((u16*)pmem)[getPixelAddress16_0(x, y, bw)] = pixel; } -static __forceinline void writePixel16S_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel16S_0(void* pmem, int x, int y, u32 pixel, u32 bw) { ((u16*)pmem)[getPixelAddress16S_0(x, y, bw)] = pixel; } -static __forceinline void writePixel8_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel8_0(void* pmem, int x, int y, u32 pixel, u32 bw) { ((u8*)pmem)[getPixelAddress8_0(x, y, bw)] = pixel; } -static __forceinline void writePixel8H_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel8H_0(void* pmem, int x, int y, u32 pixel, u32 bw) { ((u8*)pmem)[4*getPixelAddress32_0(x, y, bw)+3] = pixel; } -static __forceinline void writePixel4_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel4_0(void* pmem, int x, int y, u32 pixel, u32 bw) { u32 addr = getPixelAddress4_0(x, y, bw); u8 pix = ((u8*)pmem)[addr/2]; @@ -463,36 +463,36 @@ static __forceinline void writePixel4_0(void* pmem, int x, int y, u32 pixel, u32 else ((u8*)pmem)[addr/2] = (pix & 0xf0) | (pixel); } -static __forceinline void writePixel4HL_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel4HL_0(void* pmem, int x, int y, u32 pixel, u32 bw) { u8 *p = (u8*)pmem + 4*getPixelAddress4HL_0(x, y, bw)+3; *p = (*p & 0xf0) | pixel; } -static __forceinline void writePixel4HH_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel4HH_0(void* pmem, int x, int y, u32 pixel, u32 bw) { u8 *p = (u8*)pmem + 4*getPixelAddress4HH_0(x, y, bw)+3; *p = (*p & 0x0f) | (pixel<<4); } -static __forceinline void writePixel32Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel32Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) { ((u32*)pmem)[getPixelAddress32Z_0(x, y, bw)] = pixel; } -static __forceinline void writePixel24Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel24Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) { u8 *buf = (u8*)pmem + 4*getPixelAddress32Z_0(x, y, bw); u8 *pix = (u8*)&pixel; buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2]; } -static __forceinline void writePixel16Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel16Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) { ((u16*)pmem)[getPixelAddress16Z_0(x, y, bw)] = pixel; } -static __forceinline void writePixel16SZ_0(void* pmem, int x, int y, u32 pixel, u32 bw) +static __forceinline void writePixel16SZ_0(void* pmem, int x, int y, u32 pixel, u32 bw) { ((u16*)pmem)[getPixelAddress16SZ_0(x, y, bw)] = pixel; } @@ -500,53 +500,53 @@ static __forceinline void writePixel16SZ_0(void* pmem, int x, int y, u32 pixel, /////////////// -static __forceinline u32 readPixel32_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel32_0(const void* pmem, int x, int y, u32 bw) { return ((const u32*)pmem)[getPixelAddress32_0(x, y, bw)]; } -static __forceinline u32 readPixel24_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel24_0(const void* pmem, int x, int y, u32 bw) { return ((const u32*)pmem)[getPixelAddress32_0(x, y, bw)] & 0xffffff; } -static __forceinline u32 readPixel16_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel16_0(const void* pmem, int x, int y, u32 bw) { return ((const u16*)pmem)[getPixelAddress16_0(x, y, bw)]; } -static __forceinline u32 readPixel16S_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel16S_0(const void* pmem, int x, int y, u32 bw) { return ((const u16*)pmem)[getPixelAddress16S_0(x, y, bw)]; } -static __forceinline u32 readPixel8_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel8_0(const void* pmem, int x, int y, u32 bw) { return ((const u8*)pmem)[getPixelAddress8_0(x, y, bw)]; } -static __forceinline u32 readPixel8H_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel8H_0(const void* pmem, int x, int y, u32 bw) { return ((const u8*)pmem)[4*getPixelAddress32_0(x, y, bw) + 3]; } -static __forceinline u32 readPixel4_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel4_0(const void* pmem, int x, int y, u32 bw) { u32 addr = getPixelAddress4_0(x, y, bw); u8 pix = ((const u8*)pmem)[addr/2]; if (addr & 0x1) return pix >> 4; - else + else return pix & 0xf; } -static __forceinline u32 readPixel4HL_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel4HL_0(const void* pmem, int x, int y, u32 bw) { const u8 *p = (const u8*)pmem+4*getPixelAddress4HL_0(x, y, bw)+3; return *p & 0x0f; } -static __forceinline u32 readPixel4HH_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel4HH_0(const void* pmem, int x, int y, u32 bw) { const u8 *p = (const u8*)pmem+4*getPixelAddress4HH_0(x, y, bw) + 3; return *p >> 4; @@ -554,22 +554,22 @@ static __forceinline u32 readPixel4HH_0(const void* pmem, int x, int y, u32 bw) /////////////// -static __forceinline u32 readPixel32Z_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel32Z_0(const void* pmem, int x, int y, u32 bw) { return ((const u32*)pmem)[getPixelAddress32Z_0(x, y, bw)]; } -static __forceinline u32 readPixel24Z_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel24Z_0(const void* pmem, int x, int y, u32 bw) { return ((const u32*)pmem)[getPixelAddress32Z_0(x, y, bw)] & 0xffffff; } -static __forceinline u32 readPixel16Z_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel16Z_0(const void* pmem, int x, int y, u32 bw) { return ((const u16*)pmem)[getPixelAddress16Z_0(x, y, bw)]; } -static __forceinline u32 readPixel16SZ_0(const void* pmem, int x, int y, u32 bw) +static __forceinline u32 readPixel16SZ_0(const void* pmem, int x, int y, u32 bw) { return ((const u16*)pmem)[getPixelAddress16SZ_0(x, y, bw)]; } diff --git a/plugins/zzogl-pg/opengl/Mem_Swizzle.cpp b/plugins/zzogl-pg/opengl/Mem_Swizzle.cpp index 9932160c65..2aad5a291b 100644 --- a/plugins/zzogl-pg/opengl/Mem_Swizzle.cpp +++ b/plugins/zzogl-pg/opengl/Mem_Swizzle.cpp @@ -23,71 +23,71 @@ // special swizzle macros - which I converted to functions. #ifdef ZEROGS_SSE2 -__forceinline void SwizzleBlock32(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock32(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock32_sse2(dst, src, pitch, WriteMask); } -__forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock16_sse2(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock8_sse2(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock4_sse2(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock32u_sse2(dst, src, pitch, WriteMask); } -__forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock16u_sse2(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock8u_sse2(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock4u_sse2(dst, src, pitch/*, WriteMask*/); } #else -__forceinline void SwizzleBlock32(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock32(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock32_c(dst, src, pitch, WriteMask); } -__forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock16_c(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock8_c(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock4_c(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock32_c(dst, src, pitch, WriteMask); } -__forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock16_c(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock8_c(dst, src, pitch/*, WriteMask*/); } -__forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch, u32 WriteMask) { SwizzleBlock4_c(dst, src, pitch/*, WriteMask*/); } @@ -163,89 +163,89 @@ __forceinline void __fastcall SwizzleBlock4_c(u8* dst, u8* src, int srcpitch, u3 } } #endif -__forceinline void SwizzleBlock24(u8 *dst, u8 *src, int pitch, u32 WriteMask) -{ - u8* pnewsrc = src; - u32* pblock = tempblock; - - for(int by = 0; by < 7; ++by, pblock += 8, pnewsrc += pitch-24) - { - for(int bx = 0; bx < 8; ++bx, pnewsrc += 3) - { - pblock[bx] = *(u32*)pnewsrc; - } - } - - for(int bx = 0; bx < 7; ++bx, pnewsrc += 3) - { - /* might be 1 byte out of bounds of GS memory */ - pblock[bx] = *(u32*)pnewsrc; - } - - /* do 3 bytes for the last copy */ - *((u8*)pblock+28) = pnewsrc[0]; - *((u8*)pblock+29) = pnewsrc[1]; - *((u8*)pblock+30) = pnewsrc[2]; - SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x00ffffff); -} +__forceinline void SwizzleBlock24(u8 *dst, u8 *src, int pitch, u32 WriteMask) +{ + u8* pnewsrc = src; + u32* pblock = tempblock; + + for(int by = 0; by < 7; ++by, pblock += 8, pnewsrc += pitch-24) + { + for(int bx = 0; bx < 8; ++bx, pnewsrc += 3) + { + pblock[bx] = *(u32*)pnewsrc; + } + } + + for(int bx = 0; bx < 7; ++bx, pnewsrc += 3) + { + /* might be 1 byte out of bounds of GS memory */ + pblock[bx] = *(u32*)pnewsrc; + } + + /* do 3 bytes for the last copy */ + *((u8*)pblock+28) = pnewsrc[0]; + *((u8*)pblock+29) = pnewsrc[1]; + *((u8*)pblock+30) = pnewsrc[2]; + SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x00ffffff); +} __forceinline void SwizzleBlock8H(u8 *dst, u8 *src, int pitch, u32 WriteMask) { - u8* pnewsrc = src; - u32* pblock = tempblock; - - for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) - { - u32 u = *(u32*)pnewsrc; - pblock[0] = u<<24; - pblock[1] = u<<16; - pblock[2] = u<<8; - pblock[3] = u; - u = *(u32*)(pnewsrc+4); - pblock[4] = u<<24; - pblock[5] = u<<16; - pblock[6] = u<<8; - pblock[7] = u; - } - SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xff000000); -} + u8* pnewsrc = src; + u32* pblock = tempblock; -__forceinline void SwizzleBlock4HH(u8 *dst, u8 *src, int pitch, u32 WriteMask) -{ - u8* pnewsrc = src; - u32* pblock = tempblock; - - for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) - { - u32 u = *(u32*)pnewsrc; - pblock[0] = u<<28; - pblock[1] = u<<24; - pblock[2] = u<<20; - pblock[3] = u<<16; - pblock[4] = u<<12; - pblock[5] = u<<8; - pblock[6] = u<<4; - pblock[7] = u; - } - SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xf0000000); -} + for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) + { + u32 u = *(u32*)pnewsrc; + pblock[0] = u<<24; + pblock[1] = u<<16; + pblock[2] = u<<8; + pblock[3] = u; + u = *(u32*)(pnewsrc+4); + pblock[4] = u<<24; + pblock[5] = u<<16; + pblock[6] = u<<8; + pblock[7] = u; + } + SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xff000000); +} -__forceinline void SwizzleBlock4HL(u8 *dst, u8 *src, int pitch, u32 WriteMask) +__forceinline void SwizzleBlock4HH(u8 *dst, u8 *src, int pitch, u32 WriteMask) { - u8* pnewsrc = src; - u32* pblock = tempblock; - - for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) - { - u32 u = *(u32*)pnewsrc; - pblock[0] = u<<24; - pblock[1] = u<<20; - pblock[2] = u<<16; - pblock[3] = u<<12; - pblock[4] = u<<8; - pblock[5] = u<<4; - pblock[6] = u; - pblock[7] = u>>4; - } - SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x0f000000); -} + u8* pnewsrc = src; + u32* pblock = tempblock; + + for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) + { + u32 u = *(u32*)pnewsrc; + pblock[0] = u<<28; + pblock[1] = u<<24; + pblock[2] = u<<20; + pblock[3] = u<<16; + pblock[4] = u<<12; + pblock[5] = u<<8; + pblock[6] = u<<4; + pblock[7] = u; + } + SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xf0000000); +} + +__forceinline void SwizzleBlock4HL(u8 *dst, u8 *src, int pitch, u32 WriteMask) +{ + u8* pnewsrc = src; + u32* pblock = tempblock; + + for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) + { + u32 u = *(u32*)pnewsrc; + pblock[0] = u<<24; + pblock[1] = u<<20; + pblock[2] = u<<16; + pblock[3] = u<<12; + pblock[4] = u<<8; + pblock[5] = u<<4; + pblock[6] = u; + pblock[7] = u>>4; + } + SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x0f000000); +} diff --git a/plugins/zzogl-pg/opengl/Mem_Tables.cpp b/plugins/zzogl-pg/opengl/Mem_Tables.cpp index 2c40ae1b4c..d903c78a66 100644 --- a/plugins/zzogl-pg/opengl/Mem_Tables.cpp +++ b/plugins/zzogl-pg/opengl/Mem_Tables.cpp @@ -106,9 +106,9 @@ u32 g_columnTable32[8][8] = { }; u32 g_columnTable16[8][16] = { - { 0, 2, 8, 10, 16, 18, 24, 26, + { 0, 2, 8, 10, 16, 18, 24, 26, 1, 3, 9, 11, 17, 19, 25, 27 }, - { 4, 6, 12, 14, 20, 22, 28, 30, + { 4, 6, 12, 14, 20, 22, 28, 30, 5, 7, 13, 15, 21, 23, 29, 31 }, { 32, 34, 40, 42, 48, 50, 56, 58, 33, 35, 41, 43, 49, 51, 57, 59 }, @@ -135,7 +135,7 @@ u32 g_columnTable8[16][16] = { 43, 47, 59, 63, 11, 15, 27, 31 }, { 96, 100, 112, 116, 64, 68, 80, 84, // column 1 98, 102, 114, 118, 66, 70, 82, 86 }, - { 104, 108, 120, 124, 72, 76, 88, 92, + { 104, 108, 120, 124, 72, 76, 88, 92, 106, 110, 122, 126, 74, 78, 90, 94 }, { 65, 69, 81, 85, 97, 101, 113, 117, 67, 71, 83, 87, 99, 103, 115, 119 }, @@ -170,7 +170,7 @@ u32 g_columnTable4[16][32] = { 22, 30, 54, 62, 86, 94, 118, 126 }, { 65, 73, 97, 105, 1, 9, 33, 41, 67, 75, 99, 107, 3, 11, 35, 43, - 69, 77, 101, 109, 5, 13, 37, 45, + 69, 77, 101, 109, 5, 13, 37, 45, 71, 79, 103, 111, 7, 15, 39, 47 }, { 81, 89, 113, 121, 17, 25, 49, 57, 83, 91, 115, 123, 19, 27, 51, 59, @@ -186,7 +186,7 @@ u32 g_columnTable4[16][32] = { 214, 222, 246, 254, 150, 158, 182, 190 }, { 129, 137, 161, 169, 193, 201, 225, 233, 131, 139, 163, 171, 195, 203, 227, 235, - 133, 141, 165, 173, 197, 205, 229, 237, + 133, 141, 165, 173, 197, 205, 229, 237, 135, 143, 167, 175, 199, 207, 231, 239 }, { 145, 153, 177, 185, 209, 217, 241, 249, 147, 155, 179, 187, 211, 219, 243, 251, @@ -202,7 +202,7 @@ u32 g_columnTable4[16][32] = { 278, 286, 310, 318, 342, 350, 374, 382 }, { 321, 329, 353, 361, 257, 265, 289, 297, 323, 331, 355, 363, 259, 267, 291, 299, - 325, 333, 357, 365, 261, 269, 293, 301, + 325, 333, 357, 365, 261, 269, 293, 301, 327, 335, 359, 367, 263, 271, 295, 303 }, { 337, 345, 369, 377, 273, 281, 305, 313, 339, 347, 371, 379, 275, 283, 307, 315, @@ -218,7 +218,7 @@ u32 g_columnTable4[16][32] = { 470, 478, 502, 510, 406, 414, 438, 446 }, { 385, 393, 417, 425, 449, 457, 481, 489, 387, 395, 419, 427, 451, 459, 483, 491, - 389, 397, 421, 429, 453, 461, 485, 493, + 389, 397, 421, 429, 453, 461, 485, 493, 391, 399, 423, 431, 455, 463, 487, 495 }, { 401, 409, 433, 441, 465, 473, 497, 505, 403, 411, 435, 443, 467, 475, 499, 507, diff --git a/plugins/zzogl-pg/opengl/Mem_Transmit.h b/plugins/zzogl-pg/opengl/Mem_Transmit.h index 27a72b01d2..855e5f1d06 100644 --- a/plugins/zzogl-pg/opengl/Mem_Transmit.h +++ b/plugins/zzogl-pg/opengl/Mem_Transmit.h @@ -6,123 +6,123 @@ #define DSTPSM gs.dstbuf.psm extern int tempX, tempY; -extern int pitch, area, fracX; +extern int pitch, area, fracX; extern int nSize; extern u8* pstart; // transfers whole rows template -static __forceinline const T *TransmitHostLocalY_(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *buf) +static __forceinline const T *TransmitHostLocalY_(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *buf) { assert( (nSize%widthlimit) == 0 && widthlimit <= 4 ); - if ((gs.imageEndX-gs.trxpos.dx) % widthlimit) + if ((gs.imageEndX-gs.trxpos.dx) % widthlimit) { // GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM); - - for(; tempY < endY; ++tempY) + + for(; tempY < endY; ++tempY) { - for(; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, buf += 1) + for(; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, buf += 1) { /* write as many pixel at one time as possible */ wp(pstart, tempX%2048, tempY%2048, buf[0], gs.dstbuf.bw); } } } - for(; tempY < endY; ++tempY) + for(; tempY < endY; ++tempY) { for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit, buf += widthlimit) { - + /* write as many pixel at one time as possible */ if( nSize < widthlimit ) return NULL; - + wp(pstart, tempX%2048, tempY%2048, buf[0], gs.dstbuf.bw); - - if( widthlimit > 1 ) - { + + if( widthlimit > 1 ) + { wp(pstart, (tempX+1)%2048, tempY%2048, buf[1], gs.dstbuf.bw); - - if( widthlimit > 2 ) - { - wp(pstart, (tempX+2)%2048, tempY%2048, buf[2], gs.dstbuf.bw); - - if( widthlimit > 3 ) - { - wp(pstart, (tempX+3)%2048, tempY%2048, buf[3], gs.dstbuf.bw); - } - } - } - } - - if ( tempX >= gs.imageEndX ) - { + + if( widthlimit > 2 ) + { + wp(pstart, (tempX+2)%2048, tempY%2048, buf[2], gs.dstbuf.bw); + + if( widthlimit > 3 ) + { + wp(pstart, (tempX+3)%2048, tempY%2048, buf[3], gs.dstbuf.bw); + } + } + } + } + + if ( tempX >= gs.imageEndX ) + { assert(tempX == gs.imageEndX); - tempX = gs.trxpos.dx; - } - else - { - assert( gs.imageTransfer == -1 || nSize*sizeof(T)/4 == 0 ); - return NULL; - } - } + tempX = gs.trxpos.dx; + } + else + { + assert( gs.imageTransfer == -1 || nSize*sizeof(T)/4 == 0 ); + return NULL; + } + } return buf; -} +} // transfers whole rows template -static __forceinline const T *TransmitHostLocalY_24(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *buf) +static __forceinline const T *TransmitHostLocalY_24(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *buf) { - if (widthlimit != 8 || ((gs.imageEndX-gs.trxpos.dx)%widthlimit)) + if (widthlimit != 8 || ((gs.imageEndX-gs.trxpos.dx)%widthlimit)) { //GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM); - for(; tempY < endY; ++tempY) - { - for(; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, buf += 3) + for(; tempY < endY; ++tempY) + { + for(; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, buf += 3) { wp(pstart, tempX%2048, tempY%2048, *(u32*)(buf), gs.dstbuf.bw); - } - - if( tempX >= gs.imageEndX ) - { - assert(gs.imageTransfer == -1 || tempX == gs.imageEndX); - tempX = gs.trxpos.dx; } - else - { - assert( gs.imageTransfer == -1 || nSize == 0 ); + + if( tempX >= gs.imageEndX ) + { + assert(gs.imageTransfer == -1 || tempX == gs.imageEndX); + tempX = gs.trxpos.dx; + } + else + { + assert( gs.imageTransfer == -1 || nSize == 0 ); return NULL; } } } - else + else { assert( /*(nSize%widthlimit) == 0 &&*/ widthlimit == 8 ); - for(; tempY < endY; ++tempY) + for(; tempY < endY; ++tempY) { - for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit, buf += 3*widthlimit) + for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit, buf += 3*widthlimit) { if (nSize < widthlimit) return NULL; - + /* write as many pixel at one time as possible */ - - wp(pstart, tempX%2048, tempY%2048, *(u32*)(buf+0), gs.dstbuf.bw); - wp(pstart, (tempX+1)%2048, tempY%2048, *(u32*)(buf+3), gs.dstbuf.bw); - wp(pstart, (tempX+2)%2048, tempY%2048, *(u32*)(buf+6), gs.dstbuf.bw); - wp(pstart, (tempX+3)%2048, tempY%2048, *(u32*)(buf+9), gs.dstbuf.bw); - wp(pstart, (tempX+4)%2048, tempY%2048, *(u32*)(buf+12), gs.dstbuf.bw); - wp(pstart, (tempX+5)%2048, tempY%2048, *(u32*)(buf+15), gs.dstbuf.bw); - wp(pstart, (tempX+6)%2048, tempY%2048, *(u32*)(buf+18), gs.dstbuf.bw); - wp(pstart, (tempX+7)%2048, tempY%2048, *(u32*)(buf+21), gs.dstbuf.bw); - } - - if (tempX >= gs.imageEndX) - { - assert(gs.imageTransfer == -1 || tempX == gs.imageEndX); - tempX = gs.trxpos.dx; - } - else + + wp(pstart, tempX%2048, tempY%2048, *(u32*)(buf+0), gs.dstbuf.bw); + wp(pstart, (tempX+1)%2048, tempY%2048, *(u32*)(buf+3), gs.dstbuf.bw); + wp(pstart, (tempX+2)%2048, tempY%2048, *(u32*)(buf+6), gs.dstbuf.bw); + wp(pstart, (tempX+3)%2048, tempY%2048, *(u32*)(buf+9), gs.dstbuf.bw); + wp(pstart, (tempX+4)%2048, tempY%2048, *(u32*)(buf+12), gs.dstbuf.bw); + wp(pstart, (tempX+5)%2048, tempY%2048, *(u32*)(buf+15), gs.dstbuf.bw); + wp(pstart, (tempX+6)%2048, tempY%2048, *(u32*)(buf+18), gs.dstbuf.bw); + wp(pstart, (tempX+7)%2048, tempY%2048, *(u32*)(buf+21), gs.dstbuf.bw); + } + + if (tempX >= gs.imageEndX) { - if ( nSize < 0 ) + assert(gs.imageTransfer == -1 || tempX == gs.imageEndX); + tempX = gs.trxpos.dx; + } + else + { + if ( nSize < 0 ) { /* extracted too much */ assert( (nSize%3)==0 && nSize > -24 ); @@ -139,53 +139,53 @@ static __forceinline const T *TransmitHostLocalY_24(_writePixel_0 wp, u32 widthl // meant for 4bit transfers template -static __forceinline const T *TransmitHostLocalY_4(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *buf) +static __forceinline const T *TransmitHostLocalY_4(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *buf) { - for(; tempY < endY; ++tempY) + for(; tempY < endY; ++tempY) { - for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit) + for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit) { - /* write as many pixel at one time as possible */ - wp(pstart, tempX%2048, tempY%2048, *buf&0x0f, gs.dstbuf.bw); - wp(pstart, (tempX+1)%2048, tempY%2048, *buf>>4, gs.dstbuf.bw); - buf++; - if ( widthlimit > 2 ) - { - wp(pstart, (tempX+2)%2048, tempY%2048, *buf&0x0f, gs.dstbuf.bw); - wp(pstart, (tempX+3)%2048, tempY%2048, *buf>>4, gs.dstbuf.bw); - buf++; - - if( widthlimit > 4 ) - { - wp(pstart, (tempX+4)%2048, tempY%2048, *buf&0x0f, gs.dstbuf.bw); - wp(pstart, (tempX+5)%2048, tempY%2048, *buf>>4, gs.dstbuf.bw); - buf++; - - if( widthlimit > 6 ) - { - wp(pstart, (tempX+6)%2048, tempY%2048, *buf&0x0f, gs.dstbuf.bw); - wp(pstart, (tempX+7)%2048, tempY%2048, *buf>>4, gs.dstbuf.bw); - buf++; - } - } - } - } - - if ( tempX >= gs.imageEndX ) - { - tempX = gs.trxpos.dx; - } - else - { - assert( gs.imageTransfer == -1 || (nSize/32) == 0 ); + /* write as many pixel at one time as possible */ + wp(pstart, tempX%2048, tempY%2048, *buf&0x0f, gs.dstbuf.bw); + wp(pstart, (tempX+1)%2048, tempY%2048, *buf>>4, gs.dstbuf.bw); + buf++; + if ( widthlimit > 2 ) + { + wp(pstart, (tempX+2)%2048, tempY%2048, *buf&0x0f, gs.dstbuf.bw); + wp(pstart, (tempX+3)%2048, tempY%2048, *buf>>4, gs.dstbuf.bw); + buf++; + + if( widthlimit > 4 ) + { + wp(pstart, (tempX+4)%2048, tempY%2048, *buf&0x0f, gs.dstbuf.bw); + wp(pstart, (tempX+5)%2048, tempY%2048, *buf>>4, gs.dstbuf.bw); + buf++; + + if( widthlimit > 6 ) + { + wp(pstart, (tempX+6)%2048, tempY%2048, *buf&0x0f, gs.dstbuf.bw); + wp(pstart, (tempX+7)%2048, tempY%2048, *buf>>4, gs.dstbuf.bw); + buf++; + } + } + } + } + + if ( tempX >= gs.imageEndX ) + { + tempX = gs.trxpos.dx; + } + else + { + assert( gs.imageTransfer == -1 || (nSize/32) == 0 ); return NULL; - } - } + } + } return buf; -} +} template - static __forceinline const T *TransmitHostLocalY(TransferData data, _writePixel_0 wp, u32 widthlimit, u32 endY, const T *buf) + static __forceinline const T *TransmitHostLocalY(TransferData data, _writePixel_0 wp, u32 widthlimit, u32 endY, const T *buf) { switch (data.psm) { @@ -196,43 +196,43 @@ template assert(0); return NULL; } - -template -static __forceinline const T *TransmitHostLocalX_(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *buf) -{ - for(u32 tempi = 0; tempi < blockheight; ++tempi) - { - for(tempX = startX; tempX < gs.imageEndX; tempX++, buf++) - { - wp(pstart, tempX%2048, (tempY+tempi)%2048, buf[0], gs.dstbuf.bw); - } - buf += pitch - fracX; - } - return buf; -} -// transmit until endX, don't check size since it has already been prevalidated template -static __forceinline const T *TransmitHostLocalX_24(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *buf) +static __forceinline const T *TransmitHostLocalX_(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *buf) { - for(u32 tempi = 0; tempi < blockheight; ++tempi) - { - for(tempX = startX; tempX < gs.imageEndX; tempX++, buf += 3) - { - wp(pstart, tempX%2048, (tempY+tempi)%2048, *(u32*)buf, gs.dstbuf.bw); - } - buf += 3*(pitch-fracX); - } - return buf; -} - -// transmit until endX, don't check size since it has already been prevalidated -template -static __forceinline const T *TransmitHostLocalX_4(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *buf) -{ for(u32 tempi = 0; tempi < blockheight; ++tempi) { - for(tempX = startX; tempX < gs.imageEndX; tempX+=2, buf++) + for(tempX = startX; tempX < gs.imageEndX; tempX++, buf++) + { + wp(pstart, tempX%2048, (tempY+tempi)%2048, buf[0], gs.dstbuf.bw); + } + buf += pitch - fracX; + } + return buf; +} + +// transmit until endX, don't check size since it has already been prevalidated +template +static __forceinline const T *TransmitHostLocalX_24(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *buf) +{ + for(u32 tempi = 0; tempi < blockheight; ++tempi) + { + for(tempX = startX; tempX < gs.imageEndX; tempX++, buf += 3) + { + wp(pstart, tempX%2048, (tempY+tempi)%2048, *(u32*)buf, gs.dstbuf.bw); + } + buf += 3*(pitch-fracX); + } + return buf; +} + +// transmit until endX, don't check size since it has already been prevalidated +template +static __forceinline const T *TransmitHostLocalX_4(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *buf) +{ + for(u32 tempi = 0; tempi < blockheight; ++tempi) + { + for(tempX = startX; tempX < gs.imageEndX; tempX+=2, buf++) { wp(pstart, tempX%2048, (tempY+tempi)%2048, buf[0]&0x0f, gs.dstbuf.bw); wp(pstart, (tempX+1)%2048, (tempY+tempi)%2048, buf[0]>>4, gs.dstbuf.bw); @@ -241,9 +241,9 @@ static __forceinline const T *TransmitHostLocalX_4(_writePixel_0 wp, u32 widthli } return buf; } - + template - static __forceinline const T *TransmitHostLocalX(TransferData data, _writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *buf) + static __forceinline const T *TransmitHostLocalX(TransferData data, _writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *buf) { switch (data.psm) { @@ -254,7 +254,7 @@ template assert(0); return NULL; } - + // calculate pitch in source buffer static __forceinline u32 TransPitch(u32 pitch, u32 size) { diff --git a/plugins/zzogl-pg/opengl/Regs.cpp b/plugins/zzogl-pg/opengl/Regs.cpp index 1ffb5175df..c41ad6d0d2 100644 --- a/plugins/zzogl-pg/opengl/Regs.cpp +++ b/plugins/zzogl-pg/opengl/Regs.cpp @@ -72,7 +72,7 @@ GIFRegHandler g_GIFRegHandlers[] = { C_ASSERT(sizeof(g_GIFRegHandlers)/sizeof(g_GIFRegHandlers[0]) == 100 ); // values for keeping track of changes -u32 s_uTex1Data[2][2] = {{0,}}; +u32 s_uTex1Data[2][2] = {{0,}}; u32 s_uClampData[2] = {0,}; u32 results[65535] = {0,}; @@ -82,7 +82,7 @@ inline bool NoHighlights(int i) { // This is hack-code, I still in search of correct reason, why some triangles should not be drawn. // I'd have thought we could just test prim->_val and ZeroGS::vb[i].zbuf.psm directly... - int resultA = prim->iip + ((prim->tme) << 1) + ((prim->fge) << 2) + ((prim->abe) << 3) + ((prim->aa1) << 4) + ((prim->fst) << 5) + ((prim->ctxt) << 6) + ((prim->fix)<< 7) + + int resultA = prim->iip + ((prim->tme) << 1) + ((prim->fge) << 2) + ((prim->abe) << 3) + ((prim->aa1) << 4) + ((prim->fst) << 5) + ((prim->ctxt) << 6) + ((prim->fix)<< 7) + ((ZeroGS::vb[i].zbuf.psm ) << 8); // if ( results[resultA] == 0 ) { // results[resultA] = 1; @@ -103,10 +103,10 @@ inline bool NoHighlights(int i) { // if psm is 16S or 24, tme, abe, & fst are true, the rest are false, result is 0x302 or 0x700, and there is a mask. if ((resultA == 0x3a2a || resultA == 0x312a) && (result == 0x302 || result == 0x700) && (ZeroGS::vb[i].zbuf.zmsk)) return false; // Silent Hill:SM and Front Mission 5, result != 0x300 - + // if psm is 24, abe is true, tme doesn't matter, the rest are false, result is 0x54c or 0x50c and there is a mask. if (((resultA == 0x3100) || (resultA == 0x3108)) && ((result == 0x54c) || (result == 0x50c)) && (ZeroGS::vb[i].zbuf.zmsk)) return false; // Okage - + // if psm is 24, abe & tme are true, the rest are false, and no result. if ((resultA == 0x310a) && (result == 0x0)) return false; // Radiata Stories // if psm is 16S, tme, abe, fst, and ctxt are true, the rest are false, result is 0x330 or 0x500, and there is a mask. @@ -126,7 +126,7 @@ void __fastcall GIFPackedRegHandlerNull(u32* data) void __fastcall GIFPackedRegHandlerRGBA(u32* data) { FUNCLOG - gs.rgba = (data[0] & 0xff) | + gs.rgba = (data[0] & 0xff) | ((data[1] & 0xff) << 8) | ((data[2] & 0xff) << 16) | ((data[3] & 0xff) << 24); @@ -146,34 +146,34 @@ void __fastcall GIFPackedRegHandlerUV(u32* data) { FUNCLOG gs.vertexregs.u = data[0] & 0x3fff; - gs.vertexregs.v = data[1] & 0x3fff; + gs.vertexregs.v = data[1] & 0x3fff; } -void __forceinline KICK_VERTEX2() -{ +void __forceinline KICK_VERTEX2() +{ FUNCLOG - if (++gs.primC >= (int)g_primmult[prim->prim]) - { + if (++gs.primC >= (int)g_primmult[prim->prim]) + { if ( NoHighlights(prim->ctxt) ) - (*ZeroGS::drawfn[prim->prim])(); - gs.primC -= g_primsub[prim->prim]; - } -} + (*ZeroGS::drawfn[prim->prim])(); + gs.primC -= g_primsub[prim->prim]; + } +} -void __forceinline KICK_VERTEX3() -{ +void __forceinline KICK_VERTEX3() +{ FUNCLOG - if (++gs.primC >= (int)g_primmult[prim->prim]) - { - gs.primC -= g_primsub[prim->prim]; - if (prim->prim == 5) - { - /* tri fans need special processing */ - if (gs.nTriFanVert == gs.primIndex) - gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex); - } - } -} + if (++gs.primC >= (int)g_primmult[prim->prim]) + { + gs.primC -= g_primsub[prim->prim]; + if (prim->prim == 5) + { + /* tri fans need special processing */ + if (gs.nTriFanVert == gs.primIndex) + gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex); + } + } +} void __fastcall GIFPackedRegHandlerXYZF2(u32* data) { @@ -189,7 +189,7 @@ void __fastcall GIFPackedRegHandlerXYZF2(u32* data) KICK_VERTEX3(); } else { - KICK_VERTEX2(); + KICK_VERTEX2(); } } @@ -206,7 +206,7 @@ void __fastcall GIFPackedRegHandlerXYZ2(u32* data) KICK_VERTEX3(); } else { - KICK_VERTEX2(); + KICK_VERTEX2(); } } @@ -236,7 +236,7 @@ void tex0Write(int i, u32 *data) FUNCLOG u32 psm = ZZOglGet_psm_TexBitsFix(data[0]); - if ( m_Blocks[psm].bpp == 0 ) + if ( m_Blocks[psm].bpp == 0 ) { // kh and others return; @@ -247,15 +247,15 @@ void tex0Write(int i, u32 *data) ZeroGS::vb[i].bNeedTexCheck = 1; // don't update unless necessary - if (PSMT_ISCLUT(psm)) + if (PSMT_ISCLUT(psm)) { - if (ZeroGS::CheckChangeInClut(data[1], psm)) + if (ZeroGS::CheckChangeInClut(data[1], psm)) { // loading clut, so flush whole texture ZeroGS::vb[i].FlushTexData(); } // check if csa is the same!! (ffx bisaid island, grass) - else if ((data[1] & 0x1f780000) != (ZeroGS::vb[i].uCurTex0Data[1] & 0x1f780000)) + else if ((data[1] & 0x1f780000) != (ZeroGS::vb[i].uCurTex0Data[1] & 0x1f780000)) { ZeroGS::Flush(i); // flush any previous entries } @@ -275,8 +275,8 @@ void tex2Write(int i, u32 *data) { // don't update unless necessary // if( ZZOglGet_psm_TexBitsFix(*s_uTex0Data) == ZZOglGet_psm_TexBitsFix(data[0]) ) { // psm is the same - if (ZZOglAllExceptClutIsSame(s_uTex0Data, data)) { - if (!PSMT_ISCLUT(psm)) + if (ZZOglAllExceptClutIsSame(s_uTex0Data, data)) { + if (!PSMT_ISCLUT(psm)) return; // have to write the CLUT again if changed @@ -294,13 +294,13 @@ void tex2Write(int i, u32 *data) { ZeroGS::Flush(i); ZeroGS::vb[i].bVarsTexSync = FALSE; ZeroGS::vb[i].bTexConstsSync = FALSE; - + s_uTex0Data[0] = (s_uTex0Data[0]&~0x03f00000)|(psm<<20); s_uTex0Data[1] = (s_uTex0Data[1]&0x1f)|(data[1]&~0x1f); tex0.psm = ZZOglGet_psm_TexBitsFix(data[0]); - if( PSMT_ISCLUT(tex0.psm) ) + if( PSMT_ISCLUT(tex0.psm) ) ZeroGS::CluttingForFlushedTex(&tex0, data[1], i); } @@ -308,10 +308,10 @@ __forceinline void frameWrite(int i, u32 *data) { FUNCLOG frameInfo& gsfb = ZeroGS::vb[i].gsfb; - if ((gsfb.fbp == ZZOglGet_fbp_FrameBitsMult(data[0])) && + if ((gsfb.fbp == ZZOglGet_fbp_FrameBitsMult(data[0])) && (gsfb.fbw == ZZOglGet_fbw_FrameBitsMult(data[0])) && - (gsfb.psm == ZZOglGet_psm_FrameBits(data[0])) && - (gsfb.fbm == ZZOglGet_fbm_FrameBits(data[0])) ) + (gsfb.psm == ZZOglGet_psm_FrameBits(data[0])) && + (gsfb.fbm == ZZOglGet_fbm_FrameBits(data[0])) ) { return; } @@ -356,7 +356,7 @@ __forceinline void clampWrite(int i, u32 *data) clampInfo& clamp = ZeroGS::vb[i].clamp; if ((s_uClampData[i] != data[0]) || (((clamp.minv>>8) | (clamp.maxv<<2)) != (data[1]&0x0fff))) { - + ZeroGS::Flush(i); s_uClampData[i] = data[0]; @@ -396,9 +396,9 @@ void __fastcall GIFRegHandlerPRIM(u32 *data) gs.primC = 0; prim->prim = (data[0]) & 0x7; gs._prim[0].prim = (data[0]) & 0x7; - gs._prim[1].prim = (data[0]) & 0x7; + gs._prim[1].prim = (data[0]) & 0x7; gs._prim[1]._val = (data[0]>>3)&0xff; - + ZeroGS::Prim(); } @@ -532,7 +532,7 @@ void tex1Write(int i, u32* data) ZeroGS::Flush(i); ZeroGS::vb[i].bVarsTexSync = FALSE; } - tex1.lcm = (data[0] ) & 0x1; + tex1.lcm = (data[0] ) & 0x1; tex1.mxl = (data[0] >> 2) & 0x7; tex1.mmag = (data[0] >> 5) & 0x1; tex1.mmin = (data[0] >> 6) & 0x7; @@ -731,7 +731,7 @@ void __fastcall GIFRegHandlerSCISSOR_1(u32* data) newscissor.y0 = ((data[1] ) & 0x7ff) << 3; newscissor.y1 = ((data[1] >> 16) & 0x7ff) << 3; - if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || + if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0 ) { ZeroGS::Flush(0); @@ -753,7 +753,7 @@ void __fastcall GIFRegHandlerSCISSOR_2(u32* data) newscissor.y0 = ((data[1] ) & 0x7ff) << 3; newscissor.y1 = ((data[1] >> 16) & 0x7ff) << 3; - if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || + if( newscissor.x1 != scissor.x1 || newscissor.y1 != scissor.y1 || newscissor.x0 != scissor.x0 || newscissor.y0 != scissor.y0 ) { ZeroGS::Flush(1); @@ -876,7 +876,7 @@ void __fastcall GIFRegHandlerZBUF_1(u32* data) zbufInfo& zbuf = ZeroGS::vb[0].zbuf; int psm = (0x30|((data[0] >> 24) & 0xf)); - if( zbuf.zbp == (data[0] & 0x1ff) * 32 && + if( zbuf.zbp == (data[0] & 0x1ff) * 32 && zbuf.psm == psm && zbuf.zmsk == (data[1] & 0x1) ) { return; @@ -905,7 +905,7 @@ void __fastcall GIFRegHandlerZBUF_2(u32* data) zbufInfo& zbuf = ZeroGS::vb[1].zbuf; int psm = (0x30|((data[0] >> 24) & 0xf)); - if( zbuf.zbp == (data[0] & 0x1ff) * 32 && + if( zbuf.zbp == (data[0] & 0x1ff) * 32 && zbuf.psm == psm && zbuf.zmsk == (data[1] & 0x1) ) { return; @@ -983,7 +983,7 @@ void __fastcall GIFRegHandlerTRXDIR(u32* data) case 0: // host->loc ZeroGS::InitTransferHostLocal(); break; - + case 1: // loc->host ZeroGS::InitTransferLocalHost(); @@ -1009,7 +1009,7 @@ void __fastcall GIFRegHandlerTRXDIR(u32* data) } void __fastcall GIFRegHandlerHWREG(u32* data) -{ +{ FUNCLOG if( gs.imageTransfer == 0 ) { ZeroGS::TransferHostLocal(data, 2); @@ -1048,16 +1048,16 @@ void __fastcall GIFRegHandlerFINISH(u32* data) FUNCLOG if(!g_GSMultiThreaded) { - if (gs.CSRw & 0x2) + if (gs.CSRw & 0x2) CSR->FINISH = 1; if (!IMR->FINISHMSK && GSirq) GSirq(); - + // if( gs.CSRw & 2 ) { // //gs.CSRw &= ~2; // //CSR->FINISH = 0; // -// +// // } // CSR->FINISH = 1; // diff --git a/plugins/zzogl-pg/opengl/Util.h b/plugins/zzogl-pg/opengl/Util.h index e3f5fdde78..6564da336b 100644 --- a/plugins/zzogl-pg/opengl/Util.h +++ b/plugins/zzogl-pg/opengl/Util.h @@ -63,7 +63,7 @@ extern "C" char* CALLBACK PS2EgetLibName(void); extern u32 THR_KeyEvent; // value for passing out key events beetwen threads extern bool THR_bShift; -extern std::string s_strIniPath; // Air's new (r2361) new constant for ini file path +extern std::string s_strIniPath; // Air's new (r2361) new constant for ini file path ///////////////////// // define when releasing @@ -167,7 +167,7 @@ typedef struct { #define GSOPTION_LOADED 0x8000 //Configuration values. -typedef struct +typedef struct { u8 mrtdepth; // write color in render target u8 interlace; // intelacing mode 0, 1, 3-off @@ -184,11 +184,11 @@ typedef struct } GSconf; #ifdef __LINUX__ -static u32 __attribute__((unused)) lasttime = 0; +static u32 __attribute__((unused)) lasttime = 0; static u32 __attribute__((unused)) BigTime = 5000; static bool __attribute__((unused)) SPAM_PASS; #else -static u32 lasttime = 0; +static u32 lasttime = 0; static u32 BigTime = 5000; static bool SPAM_PASS; #endif @@ -328,7 +328,7 @@ public: inline T* operator->() { return ptr; } inline T* get() { return ptr; } - inline void release() { + inline void release() { if( ptr != NULL ) { ptr->Release(); ptr = NULL; } } diff --git a/plugins/zzogl-pg/opengl/Win32/Conf.cpp b/plugins/zzogl-pg/opengl/Win32/Conf.cpp index e2b81754c6..57fdfa0573 100644 --- a/plugins/zzogl-pg/opengl/Win32/Conf.cpp +++ b/plugins/zzogl-pg/opengl/Win32/Conf.cpp @@ -58,7 +58,7 @@ void LoadConfig() { if( conf.aa < 0 || conf.aa > 4 ) conf.aa = 0; conf.isWideScreen = ((conf.options & GSOPTION_WIDESCREEN) != 0); - switch(conf.options & GSOPTION_WINDIMS) + switch(conf.options & GSOPTION_WINDIMS) { case GSOPTION_WIN640: conf.width = 640; diff --git a/plugins/zzogl-pg/opengl/Win32/Win32.cpp b/plugins/zzogl-pg/opengl/Win32/Win32.cpp index 2e5177c5d9..6321099c8b 100644 --- a/plugins/zzogl-pg/opengl/Win32/Win32.cpp +++ b/plugins/zzogl-pg/opengl/Win32/Win32.cpp @@ -116,7 +116,7 @@ void OnInitDialog(HWND hW) } void OnOK(HWND hW) { - + u32 newinterlace = IsDlgButtonChecked(hW, IDC_CONFIG_INTERLACE); if( !conf.interlace ) conf.interlace = newinterlace; @@ -216,12 +216,12 @@ s32 CALLBACK GStest() { void CALLBACK GSabout() { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(), + GetActiveWindow(), (DLGPROC)AboutDlgProc); } BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT - DWORD dwReason, + DWORD dwReason, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; return TRUE; // very quick :) diff --git a/plugins/zzogl-pg/opengl/Win32/aviUtil.h b/plugins/zzogl-pg/opengl/Win32/aviUtil.h index e4aea12340..7f7f66f06f 100644 --- a/plugins/zzogl-pg/opengl/Win32/aviUtil.h +++ b/plugins/zzogl-pg/opengl/Win32/aviUtil.h @@ -75,21 +75,21 @@ BOOL AVI_CreateStream(PAVIFILE pfile, PAVISTREAM * ps, int rate, // sample/secon //strhdr.fccHandler = mmioFOURCC('M','S','V','C'); // Microsoft video 1 //strhdr.fccHandler = mmioFOURCC('I','V','5','0'); // Intel video 5.0 //strhdr.dwFlags = AVISTREAMINFO_DISABLED; - //strhdr.dwCaps = - //strhdr.wPriority = - //strhdr.wLanguage = + //strhdr.dwCaps = + //strhdr.wPriority = + //strhdr.wLanguage = strhdr.dwScale = 1; strhdr.dwRate = rate; // rate fps - //strhdr.dwStart = - //strhdr.dwLength = - //strhdr.dwInitialFrames = + //strhdr.dwStart = + //strhdr.dwLength = + //strhdr.dwInitialFrames = strhdr.dwSuggestedBufferSize = buffersize; strhdr.dwQuality = -1; // use the default - //strhdr.dwSampleSize = + //strhdr.dwSampleSize = SetRect(&strhdr.rcFrame, 0, 0, // rectangle for stream (int) rectwidth, (int) rectheight); - //strhdr.dwEditCount = + //strhdr.dwEditCount = //strhdr.dwFormatChangeCount = //strcpy(strhdr.szName, "Full Frames (Uncompressed)"); @@ -155,7 +155,7 @@ string dumpAVICOMPRESSOPTIONS(AVICOMPRESSOPTIONS opts) _snprintf(tmp, 255, "LPVOID lpParms = %d\n", (int)opts.lpParms); returnValue += tmp; - _snprintf(tmp, 255, "DWORD cbParms = %d\n", opts.cbParms); + _snprintf(tmp, 255, "DWORD cbParms = %d\n", opts.cbParms); returnValue += tmp; _snprintf(tmp, 255, "DWORD dwInterleaveEvery = %d\n", opts.dwInterleaveEvery); @@ -167,7 +167,7 @@ string dumpAVICOMPRESSOPTIONS(AVICOMPRESSOPTIONS opts) BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEADER lpbi, const char* _compressor) { - + AVICOMPRESSOPTIONS opts; AVICOMPRESSOPTIONS FAR * aopts[1] = {&opts}; @@ -184,10 +184,10 @@ BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEAD //opts.dwQuality //opts.dwBytesPerSecond //opts.dwFlags = AVICOMPRESSF_KEYFRAMES; - //opts.lpFormat + //opts.lpFormat //opts.cbFormat //opts.lpParms - //opts.cbParms + //opts.cbParms //opts.dwInterleaveEvery /* display the compression options dialog box if specified compressor is unknown */ @@ -200,7 +200,7 @@ BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEAD //printf("%s", dumpAVICOMPRESSOPTIONS(opts)); //MessageBox(NULL, dumpAVICOMPRESSOPTIONS(opts).c_str(), "AVICOMPRESSOPTIONS", MB_OK); - } + } HRESULT hr = AVIMakeCompressedStream(psCompressed, *ps, &opts, NULL); if (hr != AVIERR_OK) { @@ -277,7 +277,7 @@ BOOL AVI_AddFrame(PAVISTREAM psCompressed, int time, LPBITMAPINFOHEADER lpbi) MessageBox(NULL, strMsg, "", MB_OK); return FALSE; } - + return TRUE; } @@ -319,7 +319,7 @@ BOOL AVI_CloseFile(PAVIFILE pfile) { if (pfile) AVIFileClose(pfile); - + return TRUE; } @@ -348,13 +348,13 @@ BOOL AVI_Exit() /* Here are the additional functions we need! */ -static PAVIFILE pfile = NULL; +static PAVIFILE pfile = NULL; static PAVISTREAM ps = NULL; -static PAVISTREAM psCompressed = NULL; +static PAVISTREAM psCompressed = NULL; static int count = 0; -// Initialization... +// Initialization... bool START_AVI(const char* file_name) { if(! AVI_Init()) @@ -371,19 +371,19 @@ bool START_AVI(const char* file_name) return true; } - + bool ADD_FRAME_FROM_DIB_TO_AVI(const char* _compressor, int _frameRate, int width, int height, int bits, void* pdata) { if(count == 0) { - if(! AVI_CreateStream(pfile, &ps, _frameRate, - width*height/bits, + if(! AVI_CreateStream(pfile, &ps, _frameRate, + width*height/bits, width, height, _compressor)) { //printf("Error - AVI_CreateStream()\n"); return false; - } + } BITMAPINFOHEADER bi; memset(&bi, 0, sizeof(bi)); @@ -415,7 +415,7 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(const char* _compressor, int _frameRate, int widt MessageBox(NULL, strMsg, "", MB_OK); return FALSE; } - + count++; return true; } @@ -427,16 +427,16 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRa LPBITMAPINFOHEADER lpbi; if(count == 0) { - lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); - if(! AVI_CreateStream(pfile, &ps, _frameRate, - (unsigned long) lpbi->biSizeImage, - (int) lpbi->biWidth, + lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); + if(! AVI_CreateStream(pfile, &ps, _frameRate, + (unsigned long) lpbi->biSizeImage, + (int) lpbi->biWidth, (int) lpbi->biHeight, _compressor)) { //printf("Error - AVI_CreateStream()\n"); GlobalUnlock(lpbi); return false; - } + } if(! AVI_SetOptions(&ps, &psCompressed, lpbi, _compressor)) { @@ -448,7 +448,7 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRa GlobalUnlock(lpbi); } - lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); + lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib); if(! AVI_AddFrame(psCompressed, count * 1, lpbi)) { //printf("Error - AVI_AddFrame()\n"); @@ -456,12 +456,12 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRa return false; } - GlobalUnlock(lpbi); + GlobalUnlock(lpbi); count++; return true; } -// The end... +// The end... bool STOP_AVI() { if(! AVI_CloseStream(ps, psCompressed, NULL)) @@ -475,7 +475,7 @@ bool STOP_AVI() //printf("Error - AVI_CloseFile()\n"); return false; } - + if(! AVI_Exit()) { //printf("Error - AVI_Exit()\n"); @@ -483,6 +483,6 @@ bool STOP_AVI() } return true; -} +} #endif diff --git a/plugins/zzogl-pg/opengl/Win32/resource.h b/plugins/zzogl-pg/opengl/Win32/resource.h index 13bbdd0ce2..cece1dbb0e 100644 --- a/plugins/zzogl-pg/opengl/Win32/resource.h +++ b/plugins/zzogl-pg/opengl/Win32/resource.h @@ -34,7 +34,7 @@ #define IDC_FILTERS 1014 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 112 diff --git a/plugins/zzogl-pg/opengl/Win32/resrc1.h b/plugins/zzogl-pg/opengl/Win32/resrc1.h index dc91a3b807..6a6f38be94 100644 --- a/plugins/zzogl-pg/opengl/Win32/resrc1.h +++ b/plugins/zzogl-pg/opengl/Win32/resrc1.h @@ -72,7 +72,7 @@ #define IDC_CONFIG_AA16 2004 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 113 diff --git a/plugins/zzogl-pg/opengl/Win32/tsvnrev/svnrev_template.h b/plugins/zzogl-pg/opengl/Win32/tsvnrev/svnrev_template.h index a67a4629bd..ad2a2a8e74 100644 --- a/plugins/zzogl-pg/opengl/Win32/tsvnrev/svnrev_template.h +++ b/plugins/zzogl-pg/opengl/Win32/tsvnrev/svnrev_template.h @@ -14,5 +14,5 @@ // // 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 +#define SVN_REV $WCREV$ +#define SVN_MODS $WCMODS?1:0$ diff --git a/plugins/zzogl-pg/opengl/Win32/tsvnrev/svnrev_unknown.h b/plugins/zzogl-pg/opengl/Win32/tsvnrev/svnrev_unknown.h index 4872e23b20..684d5f9240 100644 --- a/plugins/zzogl-pg/opengl/Win32/tsvnrev/svnrev_unknown.h +++ b/plugins/zzogl-pg/opengl/Win32/tsvnrev/svnrev_unknown.h @@ -3,7 +3,7 @@ // 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). @@ -20,4 +20,4 @@ // doesn't check for the SVN_REV_UNKNOWN define. #define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file +#define SVN_MODS "" diff --git a/plugins/zzogl-pg/opengl/Win32/wglext.h b/plugins/zzogl-pg/opengl/Win32/wglext.h index d54e0a4d50..16c9c70375 100644 --- a/plugins/zzogl-pg/opengl/Win32/wglext.h +++ b/plugins/zzogl-pg/opengl/Win32/wglext.h @@ -7,7 +7,7 @@ extern "C" { /* ** Copyright (c) 2007 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -15,10 +15,10 @@ extern "C" { ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. diff --git a/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp b/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp index 2d4c028a4d..82107d084f 100644 --- a/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp @@ -18,7 +18,7 @@ */ // Realisation of RenderCRTC function ONLY. -// It draw picture direct on screen, so here we have interlacing and frame skipping. +// It draw picture direct on screen, so here we have interlacing and frame skipping. //------------------ Includes #include @@ -58,7 +58,7 @@ extern int s_frameskipping; extern float fFPS; extern unsigned char zgsrevision, zgsbuild, zgsminor; -extern u32 g_SaveFrameNum; +extern u32 g_SaveFrameNum; extern int s_nWriteDepthCount; extern int s_nWireframeCount; extern int s_nWriteDestAlphaTest; @@ -73,7 +73,7 @@ extern int s_nLastResolveReset; extern int g_nDepthUpdateCount; extern int s_nResolveCounts[30]; // resolve counts for last 30 frames static int s_nCurResolveIndex = 0; -int s_nResolved = 0; // number of targets resolved this frame +int s_nResolved = 0; // number of targets resolved this frame extern int g_nDepthUsed; // ffx2 pal movies extern vector s_vecTempTextures; // temporary textures, released at the end of every frame @@ -88,23 +88,23 @@ namespace ZeroGS { extern void ProcessMessages(); void AdjustTransToAspect(Vector& v); - // Interlace texture is lazy 1*(height) array of 1 and 0. + // Interlace texture is lazy 1*(height) array of 1 and 0. // It height (it named s_nInterlaceTexWidth here) hanging we must redone - // the texture. + // the texture. // FIXME: If this function would spammed to often, we could use // width < s_nInterlaceTexWidth as correct for old texture static int s_nInterlaceTexWidth = 0; // width of texture inline u32 CreateInterlaceTex(int width) { - if (width == s_nInterlaceTexWidth && s_ptexInterlace != 0) + if (width == s_nInterlaceTexWidth && s_ptexInterlace != 0) return s_ptexInterlace; SAFE_RELEASE_TEX(s_ptexInterlace); s_nInterlaceTexWidth = width; vector data(width); - for (int i = 0; i < width; ++i) + for (int i = 0; i < width; ++i) data[i] = (i & 1) ? 0xffffffff : 0; - + glGenTextures(1, &s_ptexInterlace); glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_ptexInterlace); glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, width, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); @@ -117,15 +117,15 @@ namespace ZeroGS { //------------------ Code // Adjusts vertex shader BitBltPos vector v to preserve aspect ratio. It used to emulate 4:3 or 16:9. -void ZeroGS::AdjustTransToAspect(Vector& v) +void ZeroGS::AdjustTransToAspect(Vector& v) { double temp; float f; - if (conf.width * nBackbufferHeight > conf.height * nBackbufferWidth) + if (conf.width * nBackbufferHeight > conf.height * nBackbufferWidth) { // limited by width - + // change in ratio f = ((float)nBackbufferWidth / (float)conf.width) / ((float)nBackbufferHeight / (float)conf.height); v.y *= f; @@ -135,10 +135,10 @@ void ZeroGS::AdjustTransToAspect(Vector& v) v.y += (1-(float)modf(v.y*(float)nBackbufferHeight*0.5f+0.05f, &temp))*2.0f/(float)nBackbufferHeight; v.w += (1-(float)modf(v.w*(float)nBackbufferHeight*0.5f+0.05f, &temp))*2.0f/(float)nBackbufferHeight; } - else + else { // limited by height - + f = ((float)nBackbufferHeight / (float)conf.height) / ((float)nBackbufferWidth / (float)conf.width); f -= (float)modf(f*nBackbufferWidth, &temp)/(float)nBackbufferWidth; v.x *= f; @@ -167,14 +167,14 @@ inline bool FrameSkippingHelper() { } g_nFrameRender--; } - + #if defined _DEBUG if (timeGetTime() - TimeLastSkip > 15000 && ShouldSkip) { ERROR_LOG("ZZogl Skipped frames\n"); TimeLastSkip = timeGetTime(); } -#endif +#endif return ShouldSkip; } @@ -184,7 +184,7 @@ inline void FrameSavingHelper() { if( vb[0].prndr != NULL ) { SaveTexture("frame1.tga", GL_TEXTURE_RECTANGLE_NV, vb[0].prndr->ptex, RW(vb[0].prndr->fbw), RH(vb[0].prndr->fbh)); } - + if( vb[1].prndr != NULL && vb[0].prndr != vb[1].prndr ) { SaveTexture("frame2.tga", GL_TEXTURE_RECTANGLE_NV, vb[1].prndr->ptex, RW(vb[1].prndr->fbw), RH(vb[1].prndr->fbh)); } @@ -210,7 +210,7 @@ inline void FrameObtainDispinfo(u32 bInterlace, tex0Info* dispinfo) { GSRegDISPLAY* pd = i ? DISPLAY2 : DISPLAY1; int magh = pd->MAGH+1; int magv = pd->MAGV+1; - + dispinfo[i].tbp0 = pfb->FBP << 5; dispinfo[i].tbw = pfb->FBW << 6; dispinfo[i].tw = (pd->DW + 1) / magh; @@ -241,7 +241,7 @@ inline void RenderStartHelper(u32 bInterlace){ if( conf.mrtdepth && pvs[8] == NULL ) { conf.mrtdepth = 0; s_bWriteDepth = FALSE; -#ifdef DEBUG +#ifdef DEBUG ERROR_LOG("Disabling MRT depth writing\n"); #endif } @@ -264,7 +264,7 @@ inline void RenderStartHelper(u32 bInterlace){ glViewport(0, 0, nBackbufferWidth, nBackbufferHeight); // if interlace, only clear every other vsync - if(!bInterlace ) + if(!bInterlace ) { //u32 color = COLOR_ARGB(0, BGCOLOR->R, BGCOLOR->G, BGCOLOR->B); glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); @@ -275,9 +275,9 @@ inline void RenderStartHelper(u32 bInterlace){ SET_STREAM(); GL_REPORT_ERRORD(); - if( conf.options & GSOPTION_WIREFRAME ) + if( conf.options & GSOPTION_WIREFRAME ) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - + DisableAllgl() ; GL_REPORT_ERRORD(); @@ -302,7 +302,7 @@ inline Vector RenderGetForClip(u32 bInterlace, int interlace, int psm, FRAGMENTS valpha.x = 0; valpha.y = 1; } - + if (bInterlace) { if( interlace == (conf.interlace&1) ) { // pass if odd @@ -328,7 +328,7 @@ inline Vector RenderGetForClip(u32 bInterlace, int interlace, int psm, FRAGMENTS // Put interlaced texture in use for shader prog. // Note: if frame interlaced it's th is halved, so we should x2 it. inline void RenderCreateInterlaceTex(u32 bInterlace, int th, FRAGMENTSHADER* prog) { - if (!bInterlace) + if (!bInterlace) return; int interlacetex = CreateInterlaceTex(2*th); @@ -376,28 +376,28 @@ inline void RenderUpdateStencil(int i, bool* bUsingStencil) { glStencilMask(1<sInvTexDims) { v.x = 1.0f / (float)tw; v.y = 1.0f / (float)th; @@ -502,7 +502,7 @@ inline bool RenderLookForABetterTarget(int fbp, int tbp, list& l return false; } -// First try to draw frame from targets. It's +// First try to draw frame from targets. It's inline bool RenderCheckForTargets(tex0Info& texframe, list& listTargs, int i, bool* bUsingStencil, int interlace, int bInterlace) { // get the start and end addresses of the buffer int bpp = RenderGetBpp(texframe.psm); @@ -515,11 +515,11 @@ inline bool RenderCheckForTargets(tex0Info& texframe, list& list s_RTs.GetTargs(start, end, listTargs); for(list::iterator it = listTargs.begin(); it != listTargs.end(); ) { - + CRenderTarget* ptarg = *it; if( ptarg->fbw == texframe.tbw && !(ptarg->status&CRenderTarget::TS_NeedUpdate) && ((256/bpp)*(texframe.tbp0-ptarg->fbp))%texframe.tbw == 0 ) { - if (RenderLookForABetterTarget(ptarg->fbp, texframe.tbp0, listTargs, it)) + if (RenderLookForABetterTarget(ptarg->fbp, texframe.tbp0, listTargs, it)) continue; if( g_bSaveFinalFrame ) @@ -532,17 +532,17 @@ inline bool RenderCheckForTargets(tex0Info& texframe, list& list if( dh >= 64 ) { - if( ptarg->fbh - dby < texframe.th - movy && !(*bUsingStencil) ) + if( ptarg->fbh - dby < texframe.th - movy && !(*bUsingStencil) ) RenderUpdateStencil(i, bUsingStencil); - + SetShaderCaller("RenderCheckForTargets"); // Texture Vector v = RenderSetTargetBitTex((float)RW(texframe.tw), (float)RH(dh), (float)RW(pfb->DBX), (float)RH(dby), INTERLACE_COUNT ); // dest rect v = RenderSetTargetBitPos(dh, texframe.th, movy, INTERLACE_COUNT); v = RenderSetTargetBitTrans(ptarg->fbh); - v = RenderSetTargetInvTex(bInterlace, texframe.tbw, ptarg->fbh, &ppsCRTCTarg[bInterlace]) ; // FIXME. This is no use - + v = RenderSetTargetInvTex(bInterlace, texframe.tbw, ptarg->fbh, &ppsCRTCTarg[bInterlace]) ; // FIXME. This is no use + Vector valpha = RenderGetForClip(bInterlace, interlace, texframe.psm, &ppsCRTCTarg[bInterlace]); // inside vb[0]'s target area, so render that region only @@ -599,7 +599,7 @@ inline void RenderCheckForMemory(tex0Info& texframe, list& listT ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, Vector(texframe.tw,texframe.th,-0.5f,-0.5f), "g_fBitBltTex"); else ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, Vector(1,1,-0.5f/(float)texframe.tw,-0.5f/(float)texframe.th), "g_fBitBltTex"); - + v = RenderSetTargetBitTrans(texframe.th); v = RenderSetTargetInvTex(bInterlace, texframe.tw, texframe.th, &ppsCRTC[bInterlace]); @@ -622,7 +622,7 @@ inline void AfterRenderDisplayFPS() { // Swaping buffers, so we could use another windows inline void AfterRenderSwapBuffers() { - if (glGetError() != GL_NO_ERROR) + if (glGetError() != GL_NO_ERROR) DEBUG_LOG("glerror before swap!\n"); GLWin.SwapGLBuffers(); @@ -641,7 +641,7 @@ inline void AfterRenderMadeSnapshoot() { char str[255]; sprintf(str, "saved %s\n", strSnapshot.c_str()); AddMessage(str, 500); - } + } } // If needed reset @@ -676,7 +676,7 @@ inline void AfterRenderCountStatistics() { inline void AfterRendererUnimportantJob() { ProcessMessages(); - if( g_bDisplayFPS ) + if( g_bDisplayFPS ) AfterRenderDisplayFPS(); AfterRenderSwapBuffers(); @@ -686,12 +686,12 @@ inline void AfterRendererUnimportantJob() { s_nWireframeCount = 1; } - if( g_bMakeSnapshot ) { + if( g_bMakeSnapshot ) { AfterRenderMadeSnapshoot(); g_bMakeSnapshot = 0; } - if( s_avicapturing ) + if( s_avicapturing ) CaptureFrame(); AfterRenderCountStatistics(); @@ -784,21 +784,21 @@ void ZeroGS::RenderCRTC(int interlace) continue; if (SMODE2->INT && SMODE2->FFMD) - texframe.th >>= 1; + texframe.th >>= 1; - if( i == 0 ) + if( i == 0 ) RenderSetupBlending(); - - if( bUsingStencil ) + + if( bUsingStencil ) RenderSetupStencil(i); if( texframe.psm == 0x12 ) { RenderCRTC24helper(bInterlace, interlace, texframe.psm); continue; } - + // We shader targets between two functions, so declare it here; - list listTargs; + list listTargs; // if we could not draw image from target's do it from memory if ( !RenderCheckForTargets(texframe, listTargs, i, &bUsingStencil, interlace, bInterlace) ) @@ -806,9 +806,9 @@ void ZeroGS::RenderCRTC(int interlace) } GL_REPORT_ERRORD(); - + glDisable(GL_BLEND); - + AfterRendererUnimportantJob(); AfterRendererSwitchBackToTextures(); AfterRendererAutoresetTargets(); diff --git a/plugins/zzogl-pg/opengl/ZZoglCreate.cpp b/plugins/zzogl-pg/opengl/ZZoglCreate.cpp index 19aabf38d8..85f4f45e95 100644 --- a/plugins/zzogl-pg/opengl/ZZoglCreate.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglCreate.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Create and Destroy function. They would be called once per session. +// Create and Destroy function. They would be called once per session. //------------------ Includes #include "GS.h" @@ -101,7 +101,7 @@ namespace ZeroGS{ vector g_vboBuffers; // VBOs for all drawing commands int g_nCurVBOIndex = 0; - inline bool CreateImportantCheck(); + inline bool CreateImportantCheck(); inline void CreateOtherCheck(); inline bool CreateOpenShadersFile(); } @@ -137,7 +137,7 @@ namespace ZeroGS{ //------------------ variables //////////////////////////// // State parameters -float fiRendWidth, fiRendHeight; +float fiRendWidth, fiRendHeight; u8* s_lpShaderResources = NULL; CGprogram pvs[16] = {NULL}; @@ -146,7 +146,7 @@ CGprogram pvs[16] = {NULL}; #ifdef DEVBUILD char* EFFECT_NAME=""; char* EFFECT_DIR=""; -#endif +#endif ///////////////////// // graphics resources @@ -164,7 +164,7 @@ u32 ptexLogo = 0; int nLogoWidth, nLogoHeight; u32 s_ptexInterlace = 0; // holds interlace fields -//------------------ Global Variables +//------------------ Global Variables int g_MaxTexWidth = 4096, g_MaxTexHeight = 4096; u32 s_uFramebuffer = 0; CGprofile cgvProf, cgfProf; @@ -199,7 +199,7 @@ ZeroGS::Create_Window(int _width, int _height) { s_nFullscreen = (conf.options & GSOPTION_FULLSCREEN) ? 1 : 0; conf.mrtdepth = 0; // for now - + return true; } @@ -236,21 +236,21 @@ inline bool ZeroGS::CreateImportantCheck() { return bSuccess; } - + // This is check for less important open gl extensions. inline void ZeroGS::CreateOtherCheck() { if( !IsGLExt("GL_EXT_blend_equation_separate") || glBlendEquationSeparateEXT == NULL ) { ERROR_LOG("*********\nZZogl: OGL WARNING: Need GL_EXT_blend_equation_separate\nZZogl: *********\n"); zgsBlendEquationSeparateEXT = glBlendEquationSeparateDummy; } - else + else zgsBlendEquationSeparateEXT = glBlendEquationSeparateEXT; - + if( !IsGLExt("GL_EXT_blend_func_separate") || glBlendFuncSeparateEXT == NULL ) { ERROR_LOG("*********\nZZogl: OGL WARNING: Need GL_EXT_blend_func_separate\nZZogl: *********\n"); zgsBlendFuncSeparateEXT = glBlendFuncSeparateDummy; } - else + else zgsBlendFuncSeparateEXT = glBlendFuncSeparateEXT; if( !IsGLExt("GL_ARB_draw_buffers") && !IsGLExt("GL_ATI_draw_buffers") ) { @@ -408,7 +408,7 @@ bool ZeroGS::Create(int _width, int _height) int i; Destroy(1); - GSStateReset(); + GSStateReset(); cgSetErrorHandler(HandleCgError, NULL); g_RenderFormatType = RFT_float16; @@ -456,7 +456,7 @@ bool ZeroGS::Create(int _width, int _height) GL_LOADFN(glGenerateMipmapEXT); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); - + GL_REPORT_ERROR(); if( err != GL_NO_ERROR ) bSuccess = false; @@ -511,7 +511,7 @@ bool ZeroGS::Create(int _width, int _height) glDisable(GL_LIGHTING); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations - + glGenTextures(1, &ptexLogo); glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptexLogo); @@ -592,7 +592,7 @@ bool ZeroGS::Create(int _width, int _height) g_internalRGBAFloatFmt = GL_FLOAT_RGBA32_NV; g_internalRGBAFloat16Fmt = GL_FLOAT_RGBA16_NV; glTexImage2D(GL_TEXTURE_2D, 0, g_internalRGBAFloatFmt, BLOCK_TEXWIDTH, BLOCK_TEXHEIGHT, 0, GL_RGBA, GL_FLOAT, &vBilinearData[0]); - ERROR_LOG("ZZogl Fill bilinear blocks\n"); + ERROR_LOG("ZZogl Fill bilinear blocks\n"); B_G(glGetError() == GL_NO_ERROR, return false); } else @@ -614,7 +614,7 @@ bool ZeroGS::Create(int _width, int _height) // fill a simple rect glGenBuffers(1, &vboRect); glBindBuffer(GL_ARRAY_BUFFER, vboRect); - + vector verts(4); VertexGPU* pvert = &verts[0]; pvert->x = -0x7fff; pvert->y = 0x7fff; pvert->z = 0; pvert->s = 0; pvert->t = 0; pvert++; @@ -678,7 +678,7 @@ bool ZeroGS::Create(int _width, int _height) if( err != GL_NO_ERROR ) bSuccess = false; g_cgcontext = cgCreateContext(); - + cgvProf = CG_PROFILE_ARBVP1; cgfProf = CG_PROFILE_ARBFP1; cgGLEnableProfile(cgvProf); @@ -737,7 +737,7 @@ bool ZeroGS::Create(int _width, int _height) GL_BLEND_ALPHA(GL_ONE, GL_ZERO); glBlendColorEXT(0, 0, 0, 0.5f); - + glDisable(GL_CULL_FACE); // points diff --git a/plugins/zzogl-pg/opengl/ZZoglFlush.cpp b/plugins/zzogl-pg/opengl/ZZoglFlush.cpp index 8e2675b2a2..992ca9291e 100644 --- a/plugins/zzogl-pg/opengl/ZZoglFlush.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglFlush.cpp @@ -183,8 +183,8 @@ union { int g_PrevBitwiseTexX = -1, g_PrevBitwiseTexY = -1; // textures stored in SAMP_BITWISEANDX and SAMP_BITWISEANDY // ZZ static alphaInfo s_alphaInfo; // ZZ - -extern u8* g_pbyGSClut; + +extern u8* g_pbyGSClut; //------------------ Namespace @@ -231,7 +231,7 @@ inline void SetAlphaTest(const pixTest& curtest) { if( !curtest.ate && USEALPHATESTING && (s_dwColorWrite != 2 && s_dwColorWrite != 14 )) { glDisable(GL_ALPHA_TEST); } - else { + else { glEnable(GL_ALPHA_TEST); glAlphaFunc(g_dwAlphaCmp[curtest.atst], AlphaReferedValue(curtest.aref)); } @@ -288,7 +288,7 @@ void ZeroGS::ReloadEffects() long BufferNumber = 0; // This is debug function. It's print all buffer info and save current texture into the file, than printf file name. -inline void +inline void VisualBufferMessage(int context) { #if defined(PRIM_LOG) && defined(_DEBUG) BufferNumber++; @@ -302,15 +302,15 @@ VisualBufferMessage(int context) { ERROR_LOG("test: ate:%d, atst: %s, aref: %d, afail: %s, date: %d, datm: %d, zte: %d, ztst: %s, fba: %d\n", curvb.test.ate, patst[curvb.test.atst], curvb.test.aref, pafail[curvb.test.afail], curvb.test.date, curvb.test.datm, curvb.test.zte, pztst[curvb.test.ztst], curvb.fba.fba); ERROR_LOG("alpha: A%d B%d C%d D%d FIX:%d pabe: %d; aem: %d, ta0: %d, ta1: %d\n", curvb.alpha.a, curvb.alpha.b, curvb.alpha.c, curvb.alpha.d, curvb.alpha.fix, gs.pabe, gs.texa.aem, gs.texa.ta[0], gs.texa.ta[1]); - ERROR_LOG("tex0: tbp0=0x%x, tbw=%d, psm=0x%x, tw=%d, th=%d, tcc=%d, tfx=%d, cbp=0x%x, cpsm=0x%x, csm=%d, csa=%d, cld=%d\n", - curvb.tex0.tbp0, curvb.tex0.tbw, curvb.tex0.psm, curvb.tex0.tw, + ERROR_LOG("tex0: tbp0=0x%x, tbw=%d, psm=0x%x, tw=%d, th=%d, tcc=%d, tfx=%d, cbp=0x%x, cpsm=0x%x, csm=%d, csa=%d, cld=%d\n", + curvb.tex0.tbp0, curvb.tex0.tbw, curvb.tex0.psm, curvb.tex0.tw, curvb.tex0.th, curvb.tex0.tcc, curvb.tex0.tfx, curvb.tex0.cbp, curvb.tex0.cpsm, curvb.tex0.csm, curvb.tex0.csa, curvb.tex0.cld); char* Name; // if (g_bSaveTex) { -// if (g_bSaveTex == 1) - Name = NamedSaveTex(&curvb.tex0, 1); -// else +// if (g_bSaveTex == 1) + Name = NamedSaveTex(&curvb.tex0, 1); +// else // Name = NamedSaveTex(&curvb.tex0, 0); ERROR_LOG("TGA name %s\n", Name); free(Name); @@ -348,7 +348,7 @@ inline bool IsFlushNoNeed(VB& curvb, const pixTest& curtest ) { return false; } -// Transfer targets, that are located in current texture. +// Transfer targets, that are located in current texture. inline void FlushTransferRangesHelper(VB& curvb) { if( s_RangeMngr.ranges.size() > 0 ) { // don't want infinite loop, so set nCount to 0. @@ -387,7 +387,7 @@ inline bool FlushCheckForNULLTarget(VB& curvb, int context){ } // O.k. A set of resolutions, we do before real flush. We do RangeManager, FrameCheck and -// ZCheck before this. +// ZCheck before this. inline bool FlushInitialTest(VB& curvb, const pixTest& curtest, int context) { GL_REPORT_ERRORD(); assert( context >= 0 && context <= 1 ); @@ -466,7 +466,7 @@ inline CRenderTarget* FlushReGetTarget(int& tbw, int& tbp0, int& tpsm, VB& curvb else printf ("Hit %x 0x%x %x\n", tbw, tbp0, tpsm); } -#endif +#endif return ptextarg; } @@ -476,7 +476,7 @@ inline CRenderTarget* FlushGetTarget(VB& curvb) { int tbw, tbp0, tpsm; CRenderTarget* ptextarg = NULL; - if (!curvb.curprim.tme) + if (!curvb.curprim.tme) return ptextarg; if (curvb.bNeedTexCheck) { @@ -495,12 +495,12 @@ inline CRenderTarget* FlushGetTarget(VB& curvb) { ptextarg = s_RTs.GetTarg(tbp0, tbw, curvb); if (ptextarg == NULL) ptextarg = FlushReGetTarget(tbw, tbp0, tpsm, curvb); - + if ((ptextarg != NULL) && !(ptextarg->status & CRenderTarget::TS_NeedUpdate)) { if (PSMT_BITMODE(tpsm) == 4) { // handle 8h cluts // don't support clut targets, read from mem // 4hl - kh2 check - from dx version -- arcum42 - if ( tpsm == PSMT4 && s_ClutResolve <= 1 ) + if ( tpsm == PSMT4 && s_ClutResolve <= 1 ) { // xenosaga requires 2 resolves u32 prevcount = curvb.nCount; curvb.nCount = 0; @@ -523,7 +523,7 @@ inline CRenderTarget* FlushGetTarget(VB& curvb) { } } else ptextarg = NULL; - + return ptextarg; } @@ -533,9 +533,9 @@ inline void FlushSetContextTarget(VB& curvb, int context) { SetContextTarget(context); else { assert( curvb.pdepth != NULL ); - + if( curvb.pdepth->status & CRenderTarget::TS_Virtual) { - + if( !curvb.zbuf.zmsk ) { CRenderTarget* ptemp = s_DepthRTs.Promote(GetFrameKey(curvb.pdepth)); assert( ptemp == curvb.pdepth ); @@ -550,7 +550,7 @@ inline void FlushSetContextTarget(VB& curvb, int context) { assert( !(curvb.prndr->status&CRenderTarget::TS_NeedUpdate) ); curvb.prndr->status = 0; - + if( curvb.pdepth != NULL ) { assert( !(curvb.pdepth->status&CRenderTarget::TS_NeedUpdate) ); if( !curvb.zbuf.zmsk ) { @@ -585,11 +585,11 @@ inline void FlushSetColorMask(VB& curvb) { int maskB = ZZOglGet_fbmBlue_FrameBits(curvb.frame.fbm); int maskA = ZZOglGet_fbmAlpha_FrameBits(curvb.frame.fbm); - if (maskR == 0xff) + if (maskR == 0xff) s_dwColorWrite &= ~COLORMASK_RED; - if (maskG == 0xff) + if (maskG == 0xff) s_dwColorWrite &= ~COLORMASK_GREEN; - if (maskB == 0xff) + if (maskB == 0xff) s_dwColorWrite &= ~COLORMASK_BLUE; if ((maskA == 0xff) || (curvb.curprim.abe && (curvb.test.atst == 2 && curvb.test.aref == 128))) s_dwColorWrite &= ~COLORMASK_ALPHA; @@ -609,7 +609,7 @@ inline void FlushDoContextJob(VB& curvb, int context) { FlushSetContextTarget(curvb, context); icurctx = context; - + FlushSetStream(curvb); FlushSetColorMask(curvb); FlushSetScissorRect(curvb); @@ -620,7 +620,7 @@ inline int FlushGetExactcolor(const pixTest curtest) { if (!(g_nPixelShaderVer&SHADER_REDUCED)) // ffx2 breaks when ==7 return ((curtest.ate && curtest.aref <= 128) && (curtest.atst==4));//||curtest.atst==7); - + return 0; } @@ -634,7 +634,7 @@ inline void FlushDecodeClut(VB& curvb, GLuint& ptexclut) { int nClutOffset = 0, clutsize; int entries = PSMT_IS8CLUT(curvb.tex0.psm) ? 256 : 16; - + if (curvb.tex0.csm && curvb.tex0.csa ) printf ("ERROR, csm1\n"); @@ -676,7 +676,7 @@ inline void FlushDecodeClut(VB& curvb, GLuint& ptexclut) { glTexImage2D(GL_TEXTURE_2D, 0, 4, 256, 1, 0, GL_RGBA, PSMT_ISHALF_STORAGE(curvb.tex0)?GL_UNSIGNED_SHORT_5_5_5_1:GL_UNSIGNED_BYTE, &data[0]); s_vecTempTextures.push_back(ptexclut); - + if (g_bSaveTex) SaveTexture("clut.tga", GL_TEXTURE_2D, ptexclut, 256, 1); @@ -694,10 +694,10 @@ inline int FlushGetShaderType(VB& curvb, CRenderTarget* ptextarg, GLuint& ptexcl return 4; } else { - // Valkyrie + // Valkyrie return 2; } - } + } if (PSMT_ISHALF_STORAGE(curvb.tex0) != PSMT_ISHALF(ptextarg->psm) && (!(g_nPixelShaderVer&SHADER_REDUCED) || !curvb.curprim.fge) ) { if (PSMT_ISHALF_STORAGE(curvb.tex0)) { @@ -729,15 +729,15 @@ inline Vector FlushSetPageOffset(FRAGMENTSHADER* pfragment, int shadertype, CRen vpageoffset.z = -0.1f / (ptextarg->fbh); vpageoffset.w = 0.0f; break; - case 4: + case 4: vpageoffset.x = 2; vpageoffset.y = 1; vpageoffset.z = 0; vpageoffset.w = 0.0001f; - break; + break; } // zoe2 - if (PSMT_ISZTEX(ptextarg->psm)) + if (PSMT_ISZTEX(ptextarg->psm)) vpageoffset.w = -1.0f; ZZcgSetParameter4fv(pfragment->fPageOffset, vpageoffset, "g_fPageOffset"); @@ -788,7 +788,7 @@ inline Vector FlushTextureDims(FRAGMENTSHADER* pfragment, int shadertype, VB& cu vTexDims.w = (float)ycoord; } - if (shadertype == 4) + if (shadertype == 4) vTexDims.z += 8.0f; ZZcgSetParameter4fv(pfragment->fTexDims, vTexDims, "g_fTexDims"); @@ -808,7 +808,7 @@ inline void FlushApplyResizeFilter(VB& curvb, u32& dwFilterOpts, CRenderTarget* glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); dwFilterOpts |= 1; } - + if( !curvb.tex1.mmin ) { glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); dwFilterOpts |= 2; @@ -838,7 +838,7 @@ inline FRAGMENTSHADER* FlushUseExistRenderTaget(VB& curvb, CRenderTarget* ptexta } FlushApplyResizeFilter(curvb, dwFilterOpts, ptextarg, context); - + if( g_bSaveTex ) SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_NV, ptextarg == curvb.prndr ? ptextarg->ptexFeedback : ptextarg->ptex, RW(ptextarg->fbw), RH(ptextarg->fbh)); @@ -869,8 +869,8 @@ inline FRAGMENTSHADER* FlushMadeNewTarget(VB& curvb, int exactcolor, int context // We made an shader, so now need to put all common variables. inline void FlushSetTexture(VB& curvb, FRAGMENTSHADER* pfragment, CRenderTarget* ptextarg, int context) { SetTexVariables(context, pfragment); - SetTexInt(context, pfragment, ptextarg == NULL); - + SetTexInt(context, pfragment, ptextarg == NULL); + // have to enable the texture parameters(curtest.atst= if( curvb.ptexClamp[0] != 0 ) { cgGLSetTextureParameter(pfragment->sBitwiseANDX, curvb.ptexClamp[0]); @@ -901,22 +901,22 @@ inline FRAGMENTSHADER* FlushRendererStage(VB& curvb, u32& dwFilterOpts, CRenderT // set the correct pixel shaders if (curvb.curprim.tme) { - if (ptextarg != NULL) + if (ptextarg != NULL) pfragment = FlushUseExistRenderTaget(curvb, ptextarg, dwFilterOpts, exactcolor, context); - else + else pfragment = FlushMadeNewTarget(curvb, exactcolor, context); - + if (pfragment == NULL) { ERROR_LOG("Shader does not found\n"); // return NULL; } - FlushSetTexture(curvb, pfragment, ptextarg, context); + FlushSetTexture(curvb, pfragment, ptextarg, context); } else { pfragment = &ppsRegular[curvb.curprim.fge + 2 * s_bWriteDepth]; } - GL_REPORT_ERRORD(); + GL_REPORT_ERRORD(); // set the shaders SetShaderCaller("FlushRendererStage") ; @@ -928,7 +928,7 @@ inline FRAGMENTSHADER* FlushRendererStage(VB& curvb, u32& dwFilterOpts, CRenderT } inline bool AlphaCanRenderStencil(VB& curvb) { - return g_bUpdateStencil && (PSMT_BITMODE(curvb.prndr->psm) != 1) && + return g_bUpdateStencil && (PSMT_BITMODE(curvb.prndr->psm) != 1) && !ZZOglGet_fbmHighByte(curvb.frame.fbm) && !(g_GameSettings & GAME_NOSTENCIL); } @@ -986,7 +986,7 @@ inline void AlphaRenderFBA(VB& curvb, FRAGMENTSHADER* pfragment, bool s_bDestAlp if ((gs.pabe) || (curvb.fba.fba && !ZZOglGet_fbmHighByte(curvb.frame.fbm)) || (s_bDestAlphaTest && bCanRenderStencil)) { RenderFBA(curvb, pfragment->sOneColor); } - + } inline u32 AlphaRenderAlpha(VB& curvb, const pixTest curtest, FRAGMENTSHADER* pfragment, int exactcolor) { @@ -1001,9 +1001,9 @@ inline u32 AlphaRenderAlpha(VB& curvb, const pixTest curtest, FRAGMENTSHADER* pf // harvest fishing Vector v = vAlphaBlendColor; - if (exactcolor) { - v.y *= 255; - v.w *= 255; + if (exactcolor) { + v.y *= 255; + v.w *= 255; } ZZcgSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor"); } @@ -1055,9 +1055,9 @@ inline void AlphaTest(VB& curvb) { // Zeydlitz change this with a reason! It's "Alpha more than 1 hack." if (curvb.test.ate == 1 && curvb.test.atst == 1 && curvb.test.date == 1) { if (curvb.test.datm == 1) - glAlphaFunc(GL_GREATER, 1.0f); + glAlphaFunc(GL_GREATER, 1.0f); else { - glAlphaFunc(GL_LESS, 1.0f); + glAlphaFunc(GL_LESS, 1.0f); printf ("%d %d %d\n", curvb.test.date, curvb.test.datm, gs.texa.aem); } } @@ -1084,7 +1084,7 @@ inline void AlphaPabe(VB& curvb, FRAGMENTSHADER* pfragment, int exactcolor) { DRAW(); // reset - if (!s_stencilmask) + if (!s_stencilmask) s_stencilfunc = GL_ALWAYS; GL_STENCILFUNC_SET(); } @@ -1093,37 +1093,37 @@ inline void AlphaPabe(VB& curvb, FRAGMENTSHADER* pfragment, int exactcolor) { } // Alfa Failure does not work properly on this cases. True means that no failure job should be done -// First three cases are trivail manual +// First three cases are trivail manual inline bool AlphaFailureIgnore(const pixTest curtest) { - if (!curtest.ate) + if (!curtest.ate) return true; - if (curtest.atst == 1) + if (curtest.atst == 1) return true; - if (curtest.afail == 0) + if (curtest.afail == 0) return true; if (g_GameSettings & GAME_NOALPHAFAIL && ((s_dwColorWrite < 8) || (s_dwColorWrite == 15 && curtest.atst == 5 && (curtest.aref == 64)))) return true; // old and seemingly incorrect code. -// if ((s_dwColorWrite < 8 && s_dwColorWrite !=8) && curtest.afail == 1) +// if ((s_dwColorWrite < 8 && s_dwColorWrite !=8) && curtest.afail == 1) // return true; -// if ((s_dwColorWrite == 0xf) && curtest.atst == 5 && curtest.afail == 1 && !(g_GameSettings & GAME_REGETHACK)) +// if ((s_dwColorWrite == 0xf) && curtest.atst == 5 && curtest.afail == 1 && !(g_GameSettings & GAME_REGETHACK)) // return true; return false; } // more work on alpha failure case inline void AlphaFailureTestJob(VB& curvb, const pixTest curtest, FRAGMENTSHADER* pfragment, int exactcolor, bool bCanRenderStencil, int oldabe) { - // Note, case when ate == 1, atst == 0 and afail > 0 in documentation wrote as failure case. But it seems that + // Note, case when ate == 1, atst == 0 and afail > 0 in documentation wrote as failure case. But it seems that // either doc's are incorrect nor this case have some issues. if (AlphaFailureIgnore(curtest)) { return; } -#ifdef NOALFAFAIL +#ifdef NOALFAFAIL ERROR_LOG("Alpha job here %d %d %d %d %d %d\n", s_dwColorWrite, curtest.atst, curtest.afail, curtest.aref, gs.pabe, s_bWriteDepth); // return; -#endif +#endif SetShaderCaller("AlphaFailureTestJob"); @@ -1142,7 +1142,7 @@ inline void AlphaFailureTestJob(VB& curvb, const pixTest curtest, FRAGMENTSHADE } else { // zbuffer update only - glColorMask(0,0,0,0); + glColorMask(0,0,0,0); } if( gs.pabe && bCanRenderStencil ) { @@ -1170,9 +1170,9 @@ inline void AlphaFailureTestJob(VB& curvb, const pixTest curtest, FRAGMENTSHADE DRAW(); // reset - if (oldabe) + if (oldabe) glEnable(GL_BLEND); - if (!s_stencilmask) + if (!s_stencilmask) s_stencilfunc = GL_ALWAYS; GL_STENCILFUNC_SET(); } @@ -1242,7 +1242,7 @@ inline void AlphaDestinationTest(VB& curvb, FRAGMENTSHADER* pfragment, bool s_bD inline void AlphaSaveTarget(VB& curvb) { #ifdef _DEBUG return; // Do nothing - + if( g_bSaveFlushedFrame & 0xf ) { #ifdef _WIN32 CreateDirectory("frames", NULL); @@ -1276,7 +1276,7 @@ inline void AlphaColorClamping (VB& curvb, const pixTest curtest) { glDisable(GL_DEPTH_TEST); glDepthMask(0); glColorMask(1,1,1,0); - + if( s_bWriteDepth ) { ResetRenderTarget(1); } @@ -1292,7 +1292,7 @@ inline void AlphaColorClamping (VB& curvb, const pixTest curtest) { GL_BLENDEQ_RGB(GL_MAX_EXT); DRAW(); } - + // bios shows white screen if( bAlphaClamping & 2 ) { // max f = 1; @@ -1325,8 +1325,8 @@ inline void FlushUndoFiter(u32 dwFilterOpts) { } } -// This is the most important function! it's draw all collected info oncscreen. -void +// This is the most important function! it's draw all collected info oncscreen. +void ZeroGS::Flush(int context) { FUNCLOG @@ -1337,10 +1337,10 @@ ZeroGS::Flush(int context) return; VisualBufferMessage(context); - + GL_REPORT_ERRORD(); CRenderTarget* ptextarg = FlushGetTarget(curvb); - + SwitchWireframeOff(); FlushDoContextJob(curvb, context); @@ -1353,7 +1353,7 @@ ZeroGS::Flush(int context) if (curtest.date || gs.pabe) SetDestAlphaTest(); - AlphaSetStencil(s_bDestAlphaTest && bCanRenderStencil); + AlphaSetStencil(s_bDestAlphaTest && bCanRenderStencil); AlphaSetDepthTest(curvb, curtest, pfragment); // Error! SetAlphaTest(curtest); u32 oldabe = AlphaSetupBlendTest(curvb); // Unavoidable @@ -1370,7 +1370,7 @@ ZeroGS::Flush(int context) AlphaSaveTarget(curvb); GL_REPORT_ERRORD(); - + AlphaColorClamping (curvb, curtest); FlushUndoFiter(dwFilterOpts); ppf += curvb.nCount+0x100000; @@ -1392,7 +1392,7 @@ inline void ZeroGS::RenderFBA(const VB& curvb, CGparameter sOneColor) glDepthMask(0); glColorMask(0,0,0,0); - if( s_bWriteDepth ) + if( s_bWriteDepth ) ResetRenderTarget(1); SetShaderCaller("RenderFBA"); @@ -1411,12 +1411,12 @@ inline void ZeroGS::RenderFBA(const VB& curvb, CGparameter sOneColor) GL_COLORMASK(s_dwColorWrite); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - if( !curvb.zbuf.zmsk ) + if( !curvb.zbuf.zmsk ) { glDepthMask(1); - + assert( curvb.pdepth != NULL ); - if( s_bWriteDepth ) + if( s_bWriteDepth ) curvb.pdepth->SetRenderTarget(1); } GL_ZTEST(curvb.test.zte); @@ -1426,13 +1426,13 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo { if( !g_bUpdateStencil ) return; - if( (curvb.test.ate) && (curvb.test.afail == 1)) + if( (curvb.test.ate) && (curvb.test.afail == 1)) glDisable(GL_ALPHA_TEST); glDepthMask(0); glColorMask(0,0,0,0); - if (s_bWriteDepth) + if (s_bWriteDepth) ResetRenderTarget(1); SetShaderCaller("RenderAlphaTest"); @@ -1446,8 +1446,8 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo s_stencilfunc = GL_ALWAYS; glEnable(GL_STENCIL_TEST); - - if( !s_bDestAlphaTest ) + + if( !s_bDestAlphaTest ) { // clear everything s_stencilref = 0; @@ -1460,7 +1460,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo glEnable(GL_ALPHA_TEST); } - if( curvb.test.ate && curvb.test.atst>1 && curvb.test.aref > 0x80) + if( curvb.test.ate && curvb.test.atst>1 && curvb.test.aref > 0x80) { v.x = 1; v.y = 1; v.z = 0; v.w = 0; ZZcgSetParameter4fv(sOneColor, v, "g_fOneColor"); @@ -1471,7 +1471,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo glStencilMask(STENCIL_SPECIAL); GL_STENCILFUNC_SET(); glDisable(GL_DEPTH_TEST); - + DRAW(); if( curvb.test.zte ) @@ -1479,7 +1479,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo GL_ALPHATEST(0); GL_COLORMASK(s_dwColorWrite); - if( !curvb.zbuf.zmsk ) + if( !curvb.zbuf.zmsk ) { glDepthMask(1); @@ -1490,7 +1490,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo inline void ZeroGS::RenderStencil(const VB& curvb, u32 dwUsingSpecialTesting) { - //NOTE: This stencil hack for dest alpha testing ONLY works when + //NOTE: This stencil hack for dest alpha testing ONLY works when // the geometry in one DrawPrimitive call does not overlap // mark the stencil buffer for the new data's bits (mark 4 if alpha is >= 0xff) @@ -1500,7 +1500,7 @@ inline void ZeroGS::RenderStencil(const VB& curvb, u32 dwUsingSpecialTesting) s_stencilmask = (curvb.test.date?STENCIL_ALPHABIT:0)|(dwUsingSpecialTesting?STENCIL_SPECIAL:0); s_stencilfunc = s_stencilmask ? GL_EQUAL : GL_ALWAYS; - + s_stencilref = curvb.test.date*curvb.test.datm|STENCIL_PIXELWRITE|(dwUsingSpecialTesting?STENCIL_SPECIAL:0); GL_STENCILFUNC_SET(); } @@ -1568,7 +1568,7 @@ __forceinline void ZeroGS::ProcessFBA(const VB& curvb, CGparameter sOneColor) glDisable(GL_DEPTH_TEST); glDepthMask(0); glColorMask(0,0,0,1); - + if( s_bWriteDepth ) { ResetRenderTarget(1); } @@ -1642,7 +1642,7 @@ void ZeroGS::SetContextTarget(int context) assert( curvb.pdepth->fbh == curvb.prndr->fbh ); if( curvb.pdepth->status & CRenderTarget::TS_Virtual) { - + if( !curvb.zbuf.zmsk ) { CRenderTarget* ptemp = s_DepthRTs.Promote(curvb.pdepth->fbp|(curvb.pdepth->fbw<<16)); assert( ptemp == curvb.pdepth ); @@ -1660,29 +1660,29 @@ void ZeroGS::SetContextTarget(int context) curvb.pdepth->Update(context, curvb.prndr); bSetTarg = 0; } - + GL_REPORT_ERRORD(); if( curvb.prndr->status & CRenderTarget::TS_NeedUpdate ) { -/* if(bSetTarg) { +/* if(bSetTarg) { * printf ( " Here\n "); * if(s_bWriteDepth) { * curvb.pdepth->SetRenderTarget(1); * curvb.pdepth->SetDepthStencilSurface(); * } -* else +* else * curvb.pdepth->SetDepthStencilSurface(); * }*/ curvb.prndr->Update(context, curvb.pdepth); } - else { + else { //if( (vb[0].prndr != vb[1].prndr && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg ) curvb.prndr->SetRenderTarget(0); - //if( bSetTarg && ((vb[0].pdepth != vb[1].pdepth && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg) ) + //if( bSetTarg && ((vb[0].pdepth != vb[1].pdepth && vb[!context].bVarsSetTarg) || !vb[context].bVarsSetTarg) ) curvb.pdepth->SetDepthStencilSurface(); - + if (conf.mrtdepth && ZeroGS::IsWriteDepth()) curvb.pdepth->SetRenderTarget(1); - + if (s_ptexCurSet[0] == curvb.prndr->ptex) s_ptexCurSet[0] = 0; if (s_ptexCurSet[1] == curvb.prndr->ptex) s_ptexCurSet[1] = 0; @@ -1707,7 +1707,7 @@ void ZeroGS::SetTexInt (int context, FRAGMENTSHADER* pfragment, int settexint ) FUNCLOG if (settexint) { tex0Info& tex0 = vb[context].tex0; - + CMemoryTarget* pmemtarg = g_MemTargs.GetMemoryTarget(tex0, 1); if (vb[context].bVarsTexSync) { if (vb[context].pmemtarg != pmemtarg) { @@ -1716,7 +1716,7 @@ void ZeroGS::SetTexInt (int context, FRAGMENTSHADER* pfragment, int settexint ) } } else { - SetTexVariablesInt(context, GetTexFilter(vb[context].tex1), tex0, pmemtarg, pfragment, s_bForceTexFlush); + SetTexVariablesInt(context, GetTexFilter(vb[context].tex1), tex0, pmemtarg, pfragment, s_bForceTexFlush); vb[context].bVarsTexSync = TRUE; INC_TEXVARS(); @@ -1802,7 +1802,7 @@ void ZeroGS::SetTexClamping(int context, FRAGMENTSHADER* pfragment ) { // Fixme should be in Vector lib inline bool equal_vectors( Vector a, Vector b){ - if ( abs(a.x - b.x) + abs(a.y - b.y) + abs(a.z - b.z) + abs(a.w - b.w) < 0.01 ) + if ( abs(a.x - b.x) + abs(a.y - b.y) + abs(a.z - b.z) + abs(a.w - b.w) < 0.01 ) return true; else return false; @@ -1816,7 +1816,7 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment ) { Vector v, v2; tex0Info& tex0 = vb[context].tex0; - + //float fw = (float)tex0.tw; //float fh = (float)tex0.th; @@ -1843,10 +1843,10 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment ) { * 0 0 2 0 0 1 2 0 * * 0 1,!nNeed 1, psm=2, 10 1, psm=1 - * valpha = 0 0 0 1 0 2 0 0 2ta0 2ta1-2ta0 0 0 2ta0 0 0 0 - * 0 0 0 1 0 1 0 0 ta0 ta1-ta0 0 0 ta0 0 0 0 - * 0 0 1 1 0 1 1 1 1 1 ta0 0 1 1 - * 0 0 1 1 0 1 1 0 1 0 ta0 0 1 0 + * valpha = 0 0 0 1 0 2 0 0 2ta0 2ta1-2ta0 0 0 2ta0 0 0 0 + * 0 0 0 1 0 1 0 0 ta0 ta1-ta0 0 0 ta0 0 0 0 + * 0 0 1 1 0 1 1 1 1 1 ta0 0 1 1 + * 0 0 1 1 0 1 1 0 1 0 ta0 0 1 0 */ valpha2.x = ( tex0.tfx == 1 ) ; @@ -1875,26 +1875,26 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment ) { valpha3.z = 0; valpha3.w = 0; valpha4.x = 0; valpha4.y = 0; valpha4.z = 2; valpha4.w = 1; - + break; case 1: valpha3.z = 0; valpha3.w = 1; valpha4.x = 1; valpha4.y = 0; valpha4.z = 0; valpha4.w = 0; - + break; case 2: valpha3.z = 1; valpha3.w = 1.0f; valpha4.x = 0; valpha4.y = tex0.tcc ? 1.0f : 0.0f; - valpha4.z = 2; valpha4.w = 0; - + valpha4.z = 2; valpha4.w = 0; + break; case 3: valpha3.z = 1; valpha3.w = tex0.tcc ? 0.0f : 1.0f; valpha4.x = 0; valpha4.y = tex0.tcc ? 1.0f : 0.0f; valpha4.z = 2; valpha4.w = 0; - + break; } if( tex0.tcc ) { @@ -1907,7 +1907,7 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment ) { } if( nNeedAlpha(psm) ) { - + if( tex0.tfx == 0 ) { // make sure alpha is mult by two when the output is Cv = Ct*Cf valpha3.x = 2*gs.texa.fta[0]; @@ -1919,7 +1919,7 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment ) { valpha3.x = gs.texa.fta[0]; // if 24bit, always choose ta[0] valpha3.y = gs.texa.fta[psm != 1]; - valpha3.y -= valpha.x; + valpha3.y -= valpha.x; } } else { @@ -1948,8 +1948,8 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment ) { } else if (CheckTexArray[tex0.tfx][tex0.tcc][psm!=1][nNeedAlpha(psm)] == -1) { printf ("Bad array, %d %d %d %d\n\tolf valpha %f, %f, %f, %f : valpha2 %f %f %f %f\n\tnew valpha %f, %f, %f, %f : valpha2 %f %f %f %f\n", - tex0.tfx, tex0.tcc, psm, nNeedAlpha(psm), - valpha3.x, valpha3.y, valpha3.z, valpha3.w, valpha4.x, valpha4.y, valpha4.z, valpha4.w, + tex0.tfx, tex0.tcc, psm, nNeedAlpha(psm), + valpha3.x, valpha3.y, valpha3.z, valpha3.w, valpha4.x, valpha4.y, valpha4.z, valpha4.w, valpha.x, valpha.y, valpha.z, valpha.w, valpha2.x, valpha2.y, valpha2.z, valpha2.w); CheckTexArray[tex0.tfx][tex0.tcc][psm!=1][nNeedAlpha(psm)] = -1 ; } @@ -1962,8 +1962,8 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment ) { ZZcgSetParameter4fv(pfragment->fTestBlack, vblack, "g_fTestBlack"); SetTexClamping(context, pfragment); - vb[context].bTexConstsSync = TRUE; - } + vb[context].bTexConstsSync = TRUE; + } if(s_bTexFlush ) { if( PSMT_ISCLUT(tex0.psm) ) @@ -1977,12 +1977,12 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, FUNCLOG Vector v; assert( pmemtarg != NULL && pfragment != NULL && pmemtarg->ptex != NULL); - + if (pmemtarg == NULL || pfragment == NULL || pmemtarg->ptex == NULL ) { printf ("SetTexVariablesInt error\n"); return; - } + } SetShaderCaller("SetTexVariablesInt"); @@ -1998,7 +1998,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, if (pfragment->fRealTexDims) ZZcgSetParameter4fv(pfragment->fRealTexDims, v, "g_fRealTexDims"); else - ZZcgSetParameter4fv(cgGetNamedParameter(pfragment->prog,"g_fRealTexDims"),v, "g_fRealTexDims"); + ZZcgSetParameter4fv(cgGetNamedParameter(pfragment->prog,"g_fRealTexDims"),v, "g_fRealTexDims"); } if( m_Blocks[tex0.psm].bpp == 0 ) { @@ -2029,7 +2029,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, float fpage = tex0.tbp0*(64.0f*g_fitexwidth);// + 0.05f * g_fitexwidth; float fpageint = floorf(fpage); //int starttbp = (int)fpage; - + // 2048 is number of words to span one page //float fblockstride = (2048.0f /(float)(g_texwidth*BLOCK_TEXWIDTH)) * b.vTexDims.x * fbw; @@ -2049,7 +2049,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, ZZcgSetParameter4fv(pfragment->fTexDims, vTexDims, "g_fTexDims"); // ZZcgSetParameter4fv(pfragment->fTexBlock, b.vTexBlock, "g_fTexBlock"); // I change it, and it's working. Seems casting from Vector to float[4] is ok. - ZZcgSetParameter4fv(pfragment->fTexBlock, &b.vTexBlock.x, "g_fTexBlock"); + ZZcgSetParameter4fv(pfragment->fTexBlock, &b.vTexBlock.x, "g_fTexBlock"); ZZcgSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset"); // get hardware texture dims @@ -2072,13 +2072,13 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, ZZcgSetParameter4fv(pfragment->fPageOffset, v, "g_fPageOffset"); - if( force ) + if( force ) s_ptexCurSet[context] = pmemtarg->ptex->tex; - else + else s_ptexNextSet[context] = pmemtarg->ptex->tex; - vb[context].pmemtarg = pmemtarg; - vb[context].bVarsTexSync = FALSE; + vb[context].pmemtarg = pmemtarg; + vb[context].bVarsTexSync = FALSE; } #define SET_ALPHA_COLOR_FACTOR(sign) \ @@ -2162,8 +2162,8 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) /* - * Alpha table - * a + b + d + * Alpha table + * a + b + d * S D * 0 a -a 1 | 0 0 0 * 1 0 0 0 | a -a 1 @@ -2173,11 +2173,11 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) * a b 0 Cs 1 Cd 2 0 * | | * 0 000: a+-a+ 1 | 0+ 0+ 0 = 1 | 010: a+ 0+ 1 | 0+-a+ 0 = 1-(-a)(+)(-a) | 020: a+ 0+ 1 | 0+ 0+ 0 = 1-(-a) (+) 0 - * 1 100: 0+-a+ 1 | a+ 0+ 0 = 1-a (+) a | 110: 0+ 0+ 1 | a+-a+ 0 = 1 | 120: 0+ 0+ 1 | a+ 0+ 0 = 1 (+) a + * 1 100: 0+-a+ 1 | a+ 0+ 0 = 1-a (+) a | 110: 0+ 0+ 1 | a+-a+ 0 = 1 | 120: 0+ 0+ 1 | a+ 0+ 0 = 1 (+) a * 2 200: 0+-a+ 1 | 0+ 0+ 0 = 1-a (+) 0 | 210: 0+ 0+ 1 | 0+-a+ 0 = 1 (-) a | 220: 0+ 0+ 1 | 0+ 0+ 0 = 1 * * d = 1 Cd - * 0 | 1 | 2 + * 0 | 1 | 2 * 0 001: a+-a+ 0 | 0+ 0+ 1 = 0 (+) 1 | 011: a+ 0+ 0 | 0+-a+ 1 = a (+) 1-a | 021: a+ 0+ 0 | 0+ 0+ 1 = a (+) 1 * 1 101: 0+-a+ 0 | a+ 0+ 1 = (-a)(+) 1-(-a) | 111: 0+ 0+ 0 | a+-a+ 1 = 0 (+) 1 | 121: 0+ 0+ 0 | a+ 0+ 1 = 0 (+) 1-(-a) * 2 201: 0+-a+ 0 | 0+ 0+ 1 = a (R-)1 | 211: 0+ 0+ 0 | 0+-a+ 1 = 0 (+) 1-a | 221: 0+ 0+ 0 | 0+ 0+ 1 = 0 (+) 1 @@ -2207,15 +2207,15 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) #define one (bDestAlphaColor == 2) ? GL_ONE : blendalpha[usec] #define zero (bDestAlphaColor == 2) ? GL_ZERO : blendinvalpha[usec] - switch (code) + switch (code) { case 0: // 000 // Cs -- nothing changed case 20: // 110 = 16+4=20 // Cs case 40: { // 220 = 32+8=40 // Cs alphaenable = false; - break; - } - case 2: //002 // 0 -- should be zero + break; + } + case 2: //002 // 0 -- should be zero case 22: //112 // 0 case 42: { //222 = 32+8+2 =42 // 0 s_rgbeq = GL_FUNC_ADD; @@ -2223,16 +2223,16 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_dstrgb = GL_ZERO; break; } - case 1: //001 // Cd -- Should be destination alpha + case 1: //001 // Cd -- Should be destination alpha case 21: //111, // Cd -- 0*Source + 1*Desrinarion - case 41: { //221 = 32+8+1=41 // Cd -- + case 41: { //221 = 32+8+1=41 // Cd -- s_rgbeq = GL_FUNC_ADD; s_srcrgb = GL_ZERO; s_dstrgb = GL_ONE; break; } - case 4: { // 010 // (Cs-Cd)*A+Cs = Cs * (A + 1) - Cd * A - bAlphaClamping = 3; + case 4: { // 010 // (Cs-Cd)*A+Cs = Cs * (A + 1) - Cd * A + bAlphaClamping = 3; SET_ALPHA_COLOR_FACTOR(0); // a = -A s_rgbeq = GL_FUNC_ADD; // Cs*(1-a)+Cd*a @@ -2249,7 +2249,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_rgbeq = GL_FUNC_ADD; s_srcrgb = alpha; s_dstrgb = one_minus_alpha; - + NeedFactor(1); break; } @@ -2262,12 +2262,12 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_dstrgb = alpha; break; - } + } case 8: { //020 // Cs*A+Cs = Cs * (1+A) bAlphaClamping = 2; // max testing SET_ALPHA_COLOR_FACTOR(0); // Zeyflitz change this! a = -A - - s_rgbeq = GL_FUNC_ADD; + + s_rgbeq = GL_FUNC_ADD; s_srcrgb = one_minus_alpha; // Cs*(1-a). s_dstrgb = GL_ZERO; @@ -2285,10 +2285,10 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) } case 10: { //022 // Cs*A bAlphaClamping = 2; // max testing - SET_ALPHA_COLOR_FACTOR(1); + SET_ALPHA_COLOR_FACTOR(1); s_rgbeq = GL_FUNC_ADD; - s_srcrgb = alpha; + s_srcrgb = alpha; s_dstrgb = GL_ZERO; break; } @@ -2298,8 +2298,8 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_rgbeq = GL_FUNC_ADD; s_srcrgb = one_minus_alpha; - s_dstrgb = alpha; - + s_dstrgb = alpha; + NeedFactor(1); break; } @@ -2310,7 +2310,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_rgbeq = GL_FUNC_ADD; s_srcrgb = alpha; s_dstrgb = one_minus_alpha; - + NeedFactor(-1); break; } @@ -2330,7 +2330,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_rgbeq = GL_FUNC_ADD; s_srcrgb = GL_ONE; - s_dstrgb = alpha; + s_dstrgb = alpha; break; } case 25: { //121 // Cd*(1+A) @@ -2350,7 +2350,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_rgbeq = GL_FUNC_ADD; s_srcrgb = GL_ZERO; - s_dstrgb = alpha; + s_dstrgb = alpha; break; } case 32: {// 200 = 32 @@ -2372,7 +2372,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) break; } case 34: //202 - case 38: {//212 + case 38: {//212 bAlphaClamping = 1; // min testing -- negative values s_rgbeq = GL_FUNC_ADD; @@ -2383,7 +2383,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) case 36: {//210 bAlphaClamping = 1; // min testing SET_ALPHA_COLOR_FACTOR(1); - + s_rgbeq = GL_FUNC_SUBTRACT; s_srcrgb = GL_ONE; s_dstrgb = alpha; @@ -2395,9 +2395,9 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) s_rgbeq = GL_FUNC_ADD; s_srcrgb = GL_ZERO; - s_dstrgb = one_minus_alpha; + s_dstrgb = one_minus_alpha; break; - } + } default: { ERROR_LOG ( "Bad alpha code %d | %d %d %d\n", code, a.a, a.b, a.d ); } @@ -2405,13 +2405,13 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) /* int t_rgbeq = GL_FUNC_ADD; int t_srcrgb = GL_ONE; - int t_dstrgb = GL_ZERO; + int t_dstrgb = GL_ZERO; int tAlphaClamping = 0; - if( a.a == a.b ) + if( a.a == a.b ) { // just d remains if( a.d == 0 ) {} - else + else { t_dstrgb = a.d == 1 ? GL_ONE : GL_ZERO; t_srcrgb = GL_ZERO; @@ -2419,27 +2419,27 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) } goto EndSetAlpha; } - else if( a.d == 2 ) + else if( a.d == 2 ) { // zero - if( a.a == 2 ) + if( a.a == 2 ) { // zero all color t_srcrgb = GL_ZERO; t_dstrgb = GL_ZERO; goto EndSetAlpha; // (202) (212) } - else if( a.b == 2 ) + else if( a.b == 2 ) { //b2XAlphaTest = 1; // a) (022) // b) (122) SET_ALPHA_COLOR_FACTOR(1); - if( bDestAlphaColor == 2 ) + if( bDestAlphaColor == 2 ) { t_rgbeq = GL_FUNC_ADD; t_srcrgb = a.a == 0 ? GL_ONE : GL_ZERO; t_dstrgb = a.a == 0 ? GL_ZERO : GL_ONE; } - else + else { tAlphaClamping = 2; t_rgbeq = GL_FUNC_ADD; @@ -2452,14 +2452,14 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) // nothing is zero, so must do some real blending //b2XAlphaTest = 1; //a) (012) //b) (102) tAlphaClamping = 3; - + SET_ALPHA_COLOR_FACTOR(1); - + t_rgbeq = a.a == 0 ? GL_FUNC_SUBTRACT : GL_FUNC_REVERSE_SUBTRACT; t_srcrgb = bDestAlphaColor == 2 ? GL_ONE : blendalpha[usec]; t_dstrgb = bDestAlphaColor == 2 ? GL_ONE : blendalpha[usec]; } - else if( a.a == 2 ) + else if( a.a == 2 ) { // zero //b2XAlphaTest = 1; @@ -2467,7 +2467,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) SET_ALPHA_COLOR_FACTOR(1); - if( a.b == a.d ) + if( a.b == a.d ) { // can get away with 1-A // a.a == a.d == 2!! (200) (211) @@ -2475,7 +2475,7 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) t_srcrgb = (a.b == 0 && bDestAlphaColor != 2) ? blendinvalpha[usec] : GL_ZERO; t_dstrgb = (a.b == 0 || bDestAlphaColor == 2) ? GL_ZERO : blendinvalpha[usec]; } - else + else { // a) (201) b)(210) t_rgbeq = a.b==0 ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_SUBTRACT; @@ -2483,31 +2483,31 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) t_dstrgb = (a.b == 0 || bDestAlphaColor == 2 ) ? GL_ONE : blendalpha[usec]; } } - else if( a.b == 2 ) + else if( a.b == 2 ) { tAlphaClamping = 2; // max testing SET_ALPHA_COLOR_FACTOR(a.a!=a.d); - if( a.a == a.d ) + if( a.a == a.d ) { // can get away with 1+A, but need to set alpha to negative // a)(020) - // b)(121) + // b)(121) t_rgbeq = GL_FUNC_ADD; - if( bDestAlphaColor == 2 ) + if( bDestAlphaColor == 2 ) { t_srcrgb = (a.a == 0) ? GL_ONE_MINUS_SRC_ALPHA : GL_ZERO; t_dstrgb = (a.a == 0) ? GL_ZERO : GL_ONE_MINUS_SRC_ALPHA; } - else + else { t_srcrgb = a.a == 0 ? blendinvalpha[usec] : GL_ZERO; t_dstrgb = a.a == 0 ? GL_ZERO : blendinvalpha[usec]; } } - else + else { //a)(021) //b)(120) //b2XAlphaTest = 1; t_rgbeq = GL_FUNC_ADD; @@ -2515,24 +2515,24 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) t_dstrgb = (a.a == 0 || bDestAlphaColor == 2) ? GL_ONE : blendalpha[usec]; } } - else + else { // all 3 components are valid! tAlphaClamping = 3; // all testing SET_ALPHA_COLOR_FACTOR(a.a!=a.d); - if( a.a == a.d ) + if( a.a == a.d ) { // can get away with 1+A, but need to set alpha to negative // a) 010, // b) 101 t_rgbeq = GL_FUNC_ADD; - if( bDestAlphaColor == 2 ) + if( bDestAlphaColor == 2 ) { // all ones t_srcrgb = a.a == 0 ? GL_ONE_MINUS_SRC_ALPHA : GL_SRC_ALPHA; t_dstrgb = a.a == 0 ? GL_SRC_ALPHA : GL_ONE_MINUS_SRC_ALPHA; } - else + else { t_srcrgb = a.a == 0 ? blendinvalpha[usec] : blendalpha[usec]; t_dstrgb = a.a == 0 ? blendalpha[usec] : blendinvalpha[usec]; @@ -2540,14 +2540,14 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) } else { - t_rgbeq = GL_FUNC_ADD; // a) 011 // b) 100 // - if( bDestAlphaColor == 2 ) + t_rgbeq = GL_FUNC_ADD; // a) 011 // b) 100 // + if( bDestAlphaColor == 2 ) { // all ones t_srcrgb = a.a != 0 ? GL_ONE_MINUS_SRC_ALPHA : GL_SRC_ALPHA; t_dstrgb = a.a != 0 ? GL_SRC_ALPHA : GL_ONE_MINUS_SRC_ALPHA; } - else + else { //b2XAlphaTest = 1; t_srcrgb = a.a != 0 ? blendinvalpha[usec] : blendalpha[usec]; @@ -2562,24 +2562,24 @@ void ZeroGS::SetAlphaVariables(const alphaInfo& a) if (CheckArray[code][(bDestAlphaColor==2)] != -1) { printf ( "A code %d, 0x%x, 0x%x, 0x%x, 0x%x %d\n", code, alpha, one_minus_alpha, one, zero, bDestAlphaColor ); printf ( " Difference %d %d %d %d | 0x%x 0x%x | 0x%x 0x%x | 0x%x 0x%x | %d %d\n", - code, a.a, a.b, a.d, - t_rgbeq, s_rgbeq, t_srcrgb, s_srcrgb, t_dstrgb, s_dstrgb, tAlphaClamping, bAlphaClamping); + code, a.a, a.b, a.d, + t_rgbeq, s_rgbeq, t_srcrgb, s_srcrgb, t_dstrgb, s_dstrgb, tAlphaClamping, bAlphaClamping); CheckArray[code][(bDestAlphaColor==2)] = -1; } } - else + else if (CheckArray[code][(bDestAlphaColor==2)] == 0){ printf ( "Add good code %d %d, psm %d destA %d\n", code, a.c, vb[icurctx].prndr->psm, bDestAlphaColor); CheckArray[code][(bDestAlphaColor==2)] = 1; }*/ - + if( alphaenable ) { zgsBlendFuncSeparateEXT(s_srcrgb, s_dstrgb, s_srcalpha, s_dstalpha); zgsBlendEquationSeparateEXT(s_rgbeq, s_alphaeq); glEnable(GL_BLEND); // always set } - else + else glDisable(GL_BLEND); INC_ALPHAVARS(); @@ -2608,7 +2608,7 @@ void ZeroGS::SetDestAlphaTest() { s_bDestAlphaTest = TRUE; s_nWriteDestAlphaTest = 4; } - + void ZeroGS::SetTexFlush() { FUNCLOG s_bTexFlush = TRUE; @@ -2618,7 +2618,7 @@ void ZeroGS::SetTexFlush() { // if( PSMT_ISCLUT(vb[1].tex0.psm) ) // texClutWrite(1); - if( !s_bForceTexFlush ) + if( !s_bForceTexFlush ) { if (s_ptexCurSet[0] != s_ptexNextSet[0]) s_ptexCurSet[0] = s_ptexNextSet[0]; if (s_ptexCurSet[1] != s_ptexNextSet[1]) s_ptexCurSet[1] = s_ptexNextSet[1]; diff --git a/plugins/zzogl-pg/opengl/ZZoglSave.cpp b/plugins/zzogl-pg/opengl/ZZoglSave.cpp index 4ecca4709d..3694bbb364 100644 --- a/plugins/zzogl-pg/opengl/ZZoglSave.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglSave.cpp @@ -23,7 +23,7 @@ #include "zerogs.h" #include "targets.h" -//----------------------- Defines +//----------------------- Defines #define VBSAVELIMIT ((u32)((u8*)&vb[0].nNextFrameHeight-(u8*)&vb[0])) #define ZEROGS_SAVEVER 0xaa000005 @@ -51,7 +51,7 @@ int ZeroGS::Save(s8* pbydata) s_RTs.ResolveAll(); s_DepthRTs.ResolveAll(); - + strcpy((char*)pbydata, libraryNameX); *(u32*)(pbydata+16) = ZEROGS_SAVEVER; pbydata += 32; @@ -95,10 +95,10 @@ bool ZeroGS::Load(s8* pbydata) GSStateReset(); pbydata += 32; - //int context = *(int*)pbydata; + //int context = *(int*)pbydata; pbydata += 4; u32 savelimit = VBSAVELIMIT; - + savelimit = *(u32*)pbydata; pbydata += 4; memcpy(g_pbyGSMemory, pbydata, 0x00400000); @@ -134,13 +134,13 @@ bool ZeroGS::Load(s8* pbydata) for(int i = 0; i < 2; ++i) { vb[i].Init(VB_BUFFERSIZE); vb[i].bNeedZCheck = vb[i].bNeedFrameCheck = 1; - + vb[i].bSyncVars = 0; vb[i].bNeedTexCheck = 1; memset(vb[i].uCurTex0Data, 0, sizeof(vb[i].uCurTex0Data)); } icurctx = -1; - + glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, s_uFramebuffer ); // switch to the backbuffer SetFogColor(gs.fogcol); diff --git a/plugins/zzogl-pg/opengl/ZZoglShaders.cpp b/plugins/zzogl-pg/opengl/ZZoglShaders.cpp index 28f887d5f1..8b6423730e 100644 --- a/plugins/zzogl-pg/opengl/ZZoglShaders.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglShaders.cpp @@ -23,14 +23,14 @@ #include "zerogs.h" #include "ZeroGSShaders/zerogsshaders.h" #include "zpipe.h" - + // ----------------- Defines -using namespace ZeroGS; +using namespace ZeroGS; //------------------ Constants -// ----------------- Global Variables -namespace ZeroGS { +// ----------------- Global Variables +namespace ZeroGS { FRAGMENTSHADER ppsBitBlt[2], ppsBitBltDepth, ppsOne; FRAGMENTSHADER ppsBaseTexture, ppsConvert16to32, ppsConvert32to16; } @@ -46,14 +46,14 @@ void HandleCgError(CGcontext ctx, CGerror err, void* appdata) { ERROR_LOG("%s->%s: %s\n", ShaderCallerName, ShaderHandleName, cgGetErrorString(err)); const char* listing = cgGetLastListing(g_cgcontext); - if (listing != NULL) + if (listing != NULL) DEBUG_LOG(" last listing: %s\n", listing); } // This is a helper of cgGLSetParameter4fv, made for debugging purposes. // The name could be any string. We must use it on compilation time, because the erronious handler does not // return it. -void ZZcgSetParameter4fv(CGparameter param, const float* v, const char* name) +void ZZcgSetParameter4fv(CGparameter param, const float* v, const char* name) { ShaderHandleName = name; cgGLSetParameter4fv(param, v); @@ -113,14 +113,14 @@ void SetupVertexProgramParameters(CGprogram prog, int context) cgConnectParameter(g_vparamPosXY[context], p); // Set Z-test, log or no log; - if (g_GameSettings&GAME_NOLOGZ) + if (g_GameSettings&GAME_NOLOGZ) { g_vdepth = Vector( 255.0 /256.0f, 255.0/65536.0f, 255.0f/(65535.0f*256.0f), 1.0f/(65536.0f*65536.0f)); vlogz = Vector( 1.0f, 0.0f, 0.0f, 0.0f); } - else + else { - g_vdepth = Vector( 256.0f*65536.0f, 65536.0f, 256.0f, 65536.0f*65536.0f); + g_vdepth = Vector( 256.0f*65536.0f, 65536.0f, 256.0f, 65536.0f*65536.0f); vlogz = Vector( 0.0f, 1.0f, 0.0f, 0.0f); } @@ -131,7 +131,7 @@ void SetupVertexProgramParameters(CGprogram prog, int context) p = cgGetNamedParameter(prog, "g_fZMin"); // Switch to flat-z when needed if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) { //ERROR_LOG ("Use flat-z\n"); - cgGLSetParameter4fv(p, vlogz); + cgGLSetParameter4fv(p, vlogz); } else ERROR_LOG ("Shader file version is outdated! Only is log-Z possible\n"); @@ -242,7 +242,7 @@ bool ZeroGS::LoadExtraEffects() // pvs[2*i+8] = pvs[2*i+8+1] = NULL; // } } - + LOAD_VS(SH_BITBLTVS, pvsBitBlt.prog); pvsBitBlt.sBitBltPos = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltPos"); pvsBitBlt.sBitBltTex = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltTex"); @@ -269,7 +269,7 @@ bool ZeroGS::LoadExtraEffects() LOAD_PS(SH_BITBLTDEPTHPS, ppsBitBltDepth); LOAD_PS(SH_CRTCTARGPS, ppsCRTCTarg[0]); LOAD_PS(SH_CRTCTARGINTERPS, ppsCRTCTarg[1]); - + g_bCRTCBilinear = TRUE; LOAD_PS(SH_CRTCPS, ppsCRTC[0]); if( !bLoadSuccess ) { @@ -284,7 +284,7 @@ bool ZeroGS::LoadExtraEffects() if( !bLoadSuccess ) ERROR_LOG("Failed to create CRTC shaders\n"); - + LOAD_PS(SH_CRTC24PS, ppsCRTC24[0]); LOAD_PS(SH_CRTC24INTERPS, ppsCRTC24[1]); LOAD_PS(SH_ZEROPS, ppsOne); @@ -318,13 +318,13 @@ FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int te texwrap = TEXWRAP_REPEAT_CLAMP; int index = GET_SHADER_INDEX(type, texfilter, texwrap, fog, s_bWriteDepth, testaem, exactcolor, context, 0); - + assert( index < ARRAY_SIZE(ppsTexture) ); FRAGMENTSHADER* pf = ppsTexture+index; - + if( pbFailed != NULL ) *pbFailed = false; - if( pf->prog != NULL ) + if( pf->prog != NULL ) return pf; if( (g_nPixelShaderVer & SHADER_ACCURATE) && mapShaderResources.find(index+NUM_SHADERS*SHADER_ACCURATE) != mapShaderResources.end() ) @@ -357,7 +357,7 @@ FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int te return NULL; } - + #else // not RELEASE_TO_PUBLIC #define LOAD_VS(name, prog, shaderver) { \ @@ -466,9 +466,9 @@ bool ZeroGS::LoadExtraEffects() } LOAD_PS("BitBltDepthPS", ppsBitBltDepth, cgfProf); - LOAD_PS("CRTCTargPS", ppsCRTCTarg[0], cgfProf); + LOAD_PS("CRTCTargPS", ppsCRTCTarg[0], cgfProf); LOAD_PS("CRTCTargInterPS", ppsCRTCTarg[1], cgfProf); - + g_bCRTCBilinear = TRUE; LOAD_PS("CRTCPS", ppsCRTC[0], cgfProf); if( !bLoadSuccess ) { @@ -483,7 +483,7 @@ bool ZeroGS::LoadExtraEffects() if( !bLoadSuccess ) ERROR_LOG("Failed to create CRTC shaders\n"); - + LOAD_PS("CRTC24PS", ppsCRTC24[0], cgfProf); LOAD_PS("CRTC24InterPS", ppsCRTC24[1], cgfProf); LOAD_PS("ZeroPS", ppsOne, cgfProf); LOAD_PS("BaseTexturePS", ppsBaseTexture, cgfProf); @@ -501,7 +501,7 @@ bool ZeroGS::LoadExtraEffects() FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int testaem, int exactcolor, const clampInfo& clamp, int context, bool* pbFailed) { int texwrap; - + assert( texfilter < NUM_FILTERS ); //assert( g_nPixelShaderVer == SHADER_30 ); if( clamp.wms == clamp.wmt ) { @@ -524,9 +524,9 @@ FRAGMENTSHADER* ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int te FRAGMENTSHADER* pf = ppsTexture+index; - if( pf->prog != NULL ) + if( pf->prog != NULL ) return pf; - + pf->prog = LoadShaderFromType(EFFECT_DIR, EFFECT_NAME, type, texfilter, texwrap, fog, s_bWriteDepth, testaem, exactcolor, g_nPixelShaderVer, context); if( pf->prog != NULL ) { diff --git a/plugins/zzogl-pg/opengl/ZZoglShoots.cpp b/plugins/zzogl-pg/opengl/ZZoglShoots.cpp index bed8d7c666..e865e304fa 100644 --- a/plugins/zzogl-pg/opengl/ZZoglShoots.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglShoots.cpp @@ -48,18 +48,18 @@ extern "C" { //Windows have no snprintf #if defined(_WIN32) -# define snprintf sprintf_s +# define snprintf sprintf_s #endif //------------------ Constants -//------------------ Global Variables +//------------------ Global Variables int TexNumber = 0; int s_aviinit = 0; //------------------ Code // Set variables need to made a snapshoot when it's possible -void +void ZeroGS::SaveSnapshot(const char* filename) { g_bMakeSnapshot = 1; @@ -67,7 +67,7 @@ ZeroGS::SaveSnapshot(const char* filename) } // Save curent renderer in jpeg or TGA format -bool +bool ZeroGS::SaveRenderTarget(const char* filename, int width, int height, int jpeg) { bool bflip = height < 0; @@ -87,32 +87,32 @@ ZeroGS::SaveRenderTarget(const char* filename, int width, int height, int jpeg) } } - if (jpeg) + if (jpeg) return SaveJPEG(filename, width, height, &data[0], 70); - + return SaveTGA(filename, width, height, &data[0]); } // Save selected texture as TGA -bool +bool ZeroGS::SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height) { vector data(width*height); glBindTexture(textarget, tex); glGetTexImage(textarget, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); - if (glGetError() != GL_NO_ERROR) + if (glGetError() != GL_NO_ERROR) return false; return SaveTGA(filename, width, height, &data[0]); } // save image as JPEG -bool +bool ZeroGS::SaveJPEG(const char* filename, int image_width, int image_height, const void* pdata, int quality) { u8* image_buffer = new u8[image_width * image_height * 3]; u8* psrc = (u8*)pdata; - + // input data is rgba format, so convert to rgb u8* p = image_buffer; for(int i = 0; i < image_height; ++i) { @@ -253,7 +253,7 @@ struct TGA_HEADER s16 height; // image height in pixels u8 bits; // image bits per pixel 8,16,24,32 u8 descriptor; // image descriptor bits (vh flip bits) - + // pixel data follows header #if defined(_MSC_VER) }; @@ -263,7 +263,7 @@ struct TGA_HEADER #endif // Save image as TGA -bool +bool ZeroGS::SaveTGA(const char* filename, int width, int height, void* pdata) { int err = 0; @@ -273,7 +273,7 @@ ZeroGS::SaveTGA(const char* filename, int width, int height, void* pdata) return false; assert( sizeof(TGA_HEADER) == 18 && sizeof(hdr) == 18 ); - + memset(&hdr, 0, sizeof(hdr)); hdr.imagetype = 2; hdr.bits = 32; @@ -325,7 +325,7 @@ void ZeroGS::CaptureFrame() #ifdef _WIN32 int fps = SMODE1->CMOD == 3 ? 50 : 60; - + bool bSuccess = ADD_FRAME_FROM_DIB_TO_AVI("AAAA", fps, nBackbufferWidth, nBackbufferHeight, 32, &data[0]); if( !bSuccess ) { @@ -340,12 +340,12 @@ void ZeroGS::CaptureFrame() } // It's nearly the same as save texture -void +void ZeroGS::SaveTex(tex0Info* ptex, int usevid) { vector data(ptex->tw*ptex->th); vector srcdata; - + u32* dst = &data[0]; u8* psrc = g_pbyGSMemory; @@ -355,17 +355,17 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid) pmemtarg = g_MemTargs.GetMemoryTarget(*ptex, 0); assert( pmemtarg != NULL ); - + glBindTexture(GL_TEXTURE_RECTANGLE_NV, pmemtarg->ptex->tex); srcdata.resize(pmemtarg->realheight * GPU_TEXWIDTH * pmemtarg->widthmult * 4 * 8); // max of 8 cannels glGetTexImage(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, pmemtarg->fmt, &srcdata[0]); u32 offset = pmemtarg->realy * 4 * GPU_TEXWIDTH; - - if (ptex->psm == PSMT8) + + if (ptex->psm == PSMT8) offset *= PSMT_IS32BIT(ptex->cpsm) ? 4 : 2; - else if (ptex->psm == PSMT4) + else if (ptex->psm == PSMT4) offset *= PSMT_IS32BIT(ptex->cpsm) ? 8 : 4; psrc = &srcdata[0] - offset; @@ -380,14 +380,14 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid) addr = getPixelAddress32(j, i, ptex->tbp0, ptex->tbw); if (addr * 4 < 0x00400000) u = readPixel32(psrc, j, i, ptex->tbp0, ptex->tbw); - else + else u = 0; break; case PSMCT24: addr = getPixelAddress24(j, i, ptex->tbp0, ptex->tbw); if (addr * 4 < 0x00400000) u = readPixel24(psrc, j, i, ptex->tbp0, ptex->tbw); - else + else u = 0; break; case PSMCT16: @@ -396,8 +396,8 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid) u = readPixel16(psrc, j, i, ptex->tbp0, ptex->tbw); u = RGBA16to32(u); } - else - u = 0; + else + u = 0; break; case PSMCT16S: addr = getPixelAddress16(j, i, ptex->tbp0, ptex->tbw); @@ -411,16 +411,16 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid) case PSMT8: addr = getPixelAddress8(j, i, ptex->tbp0, ptex->tbw); if (addr < 0x00400000) { - if (usevid) { - if (PSMT_IS32BIT(ptex->cpsm)) + if (usevid) { + if (PSMT_IS32BIT(ptex->cpsm)) u = *(u32*)(psrc+4*addr); - else + else u = RGBA16to32(*(u16*)(psrc+2*addr)); } else u = readPixel8(psrc, j, i, ptex->tbp0, ptex->tbw); } - else + else u = 0; break; @@ -429,9 +429,9 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid) if( addr < 2*0x00400000 ) { if( usevid ) { - if (PSMT_IS32BIT(ptex->cpsm)) + if (PSMT_IS32BIT(ptex->cpsm)) u = *(u32*)(psrc+4*addr); - else + else u = RGBA16to32(*(u16*)(psrc+2*addr)); } else @@ -445,9 +445,9 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid) if( 4*addr < 0x00400000 ) { if( usevid ) { - if (PSMT_IS32BIT(ptex->cpsm)) + if (PSMT_IS32BIT(ptex->cpsm)) u = *(u32*)(psrc+4*addr); - else + else u = RGBA16to32(*(u16*)(psrc+2*addr)); } else @@ -462,9 +462,9 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid) if( 4*addr < 0x00400000 ) { if( usevid ) { - if (PSMT_IS32BIT(ptex->cpsm)) + if (PSMT_IS32BIT(ptex->cpsm)) u = *(u32*)(psrc+4*addr); - else + else u = RGBA16to32(*(u16*)(psrc+2*addr)); } else @@ -478,9 +478,9 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid) if( 4*addr < 0x00400000 ) { if( usevid ) { - if (PSMT_IS32BIT(ptex->cpsm)) + if (PSMT_IS32BIT(ptex->cpsm)) u = *(u32*)(psrc+4*addr); - else + else u = RGBA16to32(*(u16*)(psrc+2*addr)); } else @@ -537,7 +537,7 @@ ZeroGS::SaveTex(tex0Info* ptex, int usevid) // Do the save texture and return file name of it // Do not forget to call free(), other wise there would be memory leak! -char* +char* ZeroGS::NamedSaveTex(tex0Info* ptex, int usevid){ SaveTex(ptex, usevid); char* Name = (char*)malloc(TGA_FILE_NAME_MAX_LENGTH); @@ -556,6 +556,6 @@ ZeroGS::Stop_Avi(){ #ifdef _WIN32 STOP_AVI(); #else -// Does not support yet +// Does not support yet #endif } diff --git a/plugins/zzogl-pg/opengl/ZZoglVB.cpp b/plugins/zzogl-pg/opengl/ZZoglVB.cpp index a75772f010..0e19a8e3ef 100644 --- a/plugins/zzogl-pg/opengl/ZZoglVB.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglVB.cpp @@ -32,7 +32,7 @@ using namespace ZeroGS; //------------------ Constants -// ----------------- Global Variables +// ----------------- Global Variables int maxmin = 608; // ----------------- Code @@ -53,7 +53,7 @@ ZeroGS::VB::~VB() void ZeroGS::VB::Destroy() { _aligned_free(pBufferData); pBufferData = NULL; nNumVertices = 0; - + prndr = NULL; pdepth = NULL; } @@ -61,15 +61,15 @@ void ZeroGS::VB::Destroy() int ConstraintReson; // Return number of 64-pixels block, that guaranted could be hold in memory -// from gsfb.fbp and tbp (textrure pase), zbuf.zbp (Z-buffer), frame.fbp -// (previous frame). +// from gsfb.fbp and tbp (textrure pase), zbuf.zbp (Z-buffer), frame.fbp +// (previous frame). inline int ZeroGS::VB::FindMinimalMemoryConstrain(int tbp, int maxpos) { int MinConstraint = maxpos; - + // make sure texture is far away from tbp - { - int Constraint = tbp - gsfb.fbp; + { + int Constraint = tbp - gsfb.fbp; if ((0 < Constraint) && (Constraint < MinConstraint)) { MinConstraint = Constraint; ConstraintReson = 1; @@ -79,8 +79,8 @@ ZeroGS::VB::FindMinimalMemoryConstrain(int tbp, int maxpos) { // offroad uses 0x80 fbp which messes up targets // special case when double buffering (hamsterball) // Suikoden 3 require e00 have this issue too. P3 - 0x1000. - if (prndr != NULL) { - int Constraint = frame.fbp - gsfb.fbp; + if (prndr != NULL) { + int Constraint = frame.fbp - gsfb.fbp; if ((0x0 < Constraint) && (Constraint < MinConstraint)) { MinConstraint = Constraint; ConstraintReson = 2; @@ -89,8 +89,8 @@ ZeroGS::VB::FindMinimalMemoryConstrain(int tbp, int maxpos) { // old caching method // zmsk necessary for KH movie - if (!zbuf.zmsk){ - int Constraint = zbuf.zbp - gsfb.fbp; + if (!zbuf.zmsk){ + int Constraint = zbuf.zbp - gsfb.fbp; if ((0 < Constraint) && (Constraint < MinConstraint)) { MinConstraint = Constraint; ConstraintReson = 3; @@ -98,7 +98,7 @@ ZeroGS::VB::FindMinimalMemoryConstrain(int tbp, int maxpos) { } // In 16Bit mode in one Word freame stored 2 pixels - if (PSMT_ISHALF(gsfb.psm)) + if (PSMT_ISHALF(gsfb.psm)) MinConstraint *= 2; return MinConstraint ; @@ -138,9 +138,9 @@ ZeroGS::VB::FindMinimalHeightConstrain(int maxpos) { if (maxmin < MinConstraint) { MinConstraint = maxmin; - ConstraintReson = 5; + ConstraintReson = 5; } - + if (gsfb.fbh < MinConstraint) { MinConstraint = gsfb.fbh; ConstraintReson = 6; @@ -155,11 +155,11 @@ ZeroGS::VB::FindMinimalHeightConstrain(int maxpos) { return MinConstraint; } -// 32 bit frames have additional constraints to frame +// 32 bit frames have additional constraints to frame // maxpos was maximum length of frame at normal constraints -inline void -ZeroGS::VB::CheckFrame32bitRes(int maxpos) -{ +inline void +ZeroGS::VB::CheckFrame32bitRes(int maxpos) +{ int fbh = frame.fbh; if ( frame.fbh >= 512 ) { @@ -168,7 +168,7 @@ ZeroGS::VB::CheckFrame32bitRes(int maxpos) frame.fbh = maxmin; ConstraintReson = 8; } - + // ffxii hack to stop resolving if( frame.fbp >= 0x3000 && fbh >= 0x1a0 ) { int endfbp = frame.fbp + frame.fbw * fbh / (PSMT_ISHALF(gsfb.psm) ? 128 : 64); @@ -184,16 +184,16 @@ ZeroGS::VB::CheckFrame32bitRes(int maxpos) if (frame.fbh < fbh) ConstraintReson = 9; } - + } -// This is the main code of frame resising. +// This is the main code of frame resising. // It's check several reasons for resize and resize if it needs. -// 4Mb memory in 64 bit (4 bytes) words. +// 4Mb memory in 64 bit (4 bytes) words. // |------------------------|---------------------|----------|----------|---------------------| // 0 gsfb.fbp zbuff.zpb tbp frame.fbp 2^20/64 -inline int -ZeroGS::VB::CheckFrameAddConstraints(int tbp) +inline int +ZeroGS::VB::CheckFrameAddConstraints(int tbp) { if ( gsfb.fbw <= 0 ) { ERROR_LOG_SPAM("render target null, no constraints. Ignoring\n"); @@ -204,13 +204,13 @@ ZeroGS::VB::CheckFrameAddConstraints(int tbp) int maxmemorypos = 0x4000 - gsfb.fbp; ConstraintReson = 0; - maxmemorypos = FindMinimalMemoryConstrain(tbp, maxmemorypos); + maxmemorypos = FindMinimalMemoryConstrain(tbp, maxmemorypos); maxmemorypos = FindZbufferMemoryConstrain(tbp, maxmemorypos); - + int maxpos = 64 * maxmemorypos ; maxpos /= gsfb.fbw; //? atelier iris crashes without it - if( maxpos > 256 ) + if( maxpos > 256 ) maxpos &= ~0x1f; //int noscissorpos = maxpos; @@ -220,15 +220,15 @@ ZeroGS::VB::CheckFrameAddConstraints(int tbp) frame = gsfb; frame.fbh = maxpos; - if( !PSMT_ISHALF(frame.psm) || !(g_GameSettings&GAME_FULL16BITRES) ) + if( !PSMT_ISHALF(frame.psm) || !(g_GameSettings&GAME_FULL16BITRES) ) CheckFrame32bitRes( maxpos ) ; #ifdef DEVBUILD if (frame.fbh == 0xe2) ERROR_LOG ("Const: %x %x %d| %x %d %x %x\n", frame.fbh, frame.fbw, ConstraintReson, noscissorpos, ConstrainR1, tbp, frame.fbp); -#endif +#endif -// Fixme: Reserved psm for framebuffers +// Fixme: Reserved psm for framebuffers // gsfb.psm &= 0xf; // shadow tower return 0 ; @@ -237,8 +237,8 @@ ZeroGS::VB::CheckFrameAddConstraints(int tbp) // Check if after resising new depth target is need to be used. // it return 2 if new deapth target used. bool Chose is used to proprely check // renderer target status -inline int -ZeroGS::VB::CheckFrameResolveDepth(int tbp) +inline int +ZeroGS::VB::CheckFrameResolveDepth(int tbp) { int result = 0 ; CDepthTarget* pprevdepth = pdepth; @@ -246,7 +246,7 @@ ZeroGS::VB::CheckFrameResolveDepth(int tbp) // just z changed frameInfo f = CreateFrame(zbuf.zbp, prndr->fbw, prndr->fbh, zbuf.psm, (zbuf.psm == 0x31) ? 0xff000000 : 0); - + CDepthTarget* pnewdepth = (CDepthTarget*)s_DepthRTs.GetTarg(f, CRenderTargetMngr::TO_DepthBuffer|CRenderTargetMngr::TO_StrictHeight| (zbuf.zmsk?CRenderTargetMngr::TO_Virtual:0), get_maxheight(zbuf.zbp, gsfb.fbw, 0)); @@ -263,7 +263,7 @@ ZeroGS::VB::CheckFrameResolveDepth(int tbp) // Check if after resings new render target is need to be used. Also perform deptaget check // Return 1 if only render target is changed and 3 -- if both. -inline int +inline int ZeroGS::VB::CheckFrameResolveRender(int tbp) { int result = 0 ; @@ -303,8 +303,8 @@ ZeroGS::VB::CheckFrameResolveRender(int tbp) { } // After frame resetting it is possible that 16 to 32 or 32 to 16 (color bits) conversion should be made. -inline void -ZeroGS::VB::CheckFrame16vs32Convesion() +inline void +ZeroGS::VB::CheckFrame16vs32Convesion() { if( prndr->status & CRenderTarget::TS_NeedConvert32) { if( pdepth->pdepth != 0 ) @@ -322,7 +322,7 @@ ZeroGS::VB::CheckFrame16vs32Convesion() } } -// a lot of times, target is too big and overwrites the texture using, +// a lot of times, target is too big and overwrites the texture using, // if tbp != 0, use it to bound void ZeroGS::VB::CheckFrame(int tbp) { @@ -356,10 +356,10 @@ void ZeroGS::VB::CheckFrame(int tbp) } else if (bNeedZCheck) { bNeedZCheck = 0; - if (prndr != NULL && gsfb.fbw > 0 ) + if (prndr != NULL && gsfb.fbw > 0 ) CheckFrameResolveDepth(tbp); } - + if( prndr != NULL ) SetContextTarget(ictx); } @@ -375,7 +375,7 @@ inline void ZeroGS::VB::FlushTexUnchangedClutDontUpdate() { // The second of easy branch. We does not change storage model, so we don't need to // update anything except texture itself inline void ZeroGS::VB::FlushTexClutDontUpdate() { - if (!ZZOglClutStorageUnchanged(uCurTex0Data, uNextTex0Data)) + if (!ZZOglClutStorageUnchanged(uCurTex0Data, uNextTex0Data)) ZeroGS::Flush(ictx); // clut memory isn't going to be loaded so can ignore, but at least update CSA and CPSM! @@ -388,7 +388,7 @@ inline void ZeroGS::VB::FlushTexClutDontUpdate() { bVarsTexSync = FALSE; } - + // Set texture variables after big change inline void ZeroGS::VB::FlushTexSetNewVars(u32 psm) { tex0.tbp0 = ZZOglGet_tbp0_TexBits(uNextTex0Data[0]); @@ -396,7 +396,7 @@ inline void ZeroGS::VB::FlushTexSetNewVars(u32 psm) { tex0.psm = psm; tex0.tw = ZZOglGet_tw_TexBitsExp(uNextTex0Data[0]); tex0.th = ZZOglGet_th_TexBitsExp(uNextTex0Data[0], uNextTex0Data[1]); - + tex0.tcc = ZZOglGet_tcc_TexBits(uNextTex0Data[1]); tex0.tfx = ZZOglGet_tfx_TexBits(uNextTex0Data[1]); @@ -417,8 +417,8 @@ void ZeroGS::VB::FlushTexData() // don't update unless necessary if (ZZOglAllExceptClutIsSame(uCurTex0Data, uNextTex0Data)) { // Don't need to do anything if there is no clutting and VB tex data was not changed - if( !PSMT_ISCLUT(psm) ) - return ; + if( !PSMT_ISCLUT(psm) ) + return ; // have to write the CLUT again if only CLD was changed if( ZZOglClutMinusCLDunchanged(uCurTex0Data, uNextTex0Data) ) { @@ -443,7 +443,7 @@ void ZeroGS::VB::FlushTexData() FlushTexSetNewVars(psm); - if( PSMT_ISCLUT(psm) ) + if( PSMT_ISCLUT(psm) ) ZeroGS::CluttingForFlushedTex(&tex0, uNextTex0Data[1], ictx ) ; } diff --git a/plugins/zzogl-pg/opengl/ZeroGSShaders/zerogsshaders.cpp b/plugins/zzogl-pg/opengl/ZeroGSShaders/zerogsshaders.cpp index f073da1a8a..2ebb2f929f 100644 --- a/plugins/zzogl-pg/opengl/ZeroGSShaders/zerogsshaders.cpp +++ b/plugins/zzogl-pg/opengl/ZeroGSShaders/zerogsshaders.cpp @@ -66,7 +66,7 @@ void LoadShader(int index, const char* pshader, CGprofile prof, vector buffer; buffer.reserve(10000000); // 10mb buffer.resize(sizeof(SHADERHEADER)*num); - i = 0; + i = 0; for(map::iterator it = mapShaders.begin(); it != mapShaders.end(); ++it, ++i) { SHADERHEADER h; h.index = it->first | it->second.type; diff --git a/plugins/zzogl-pg/opengl/ZeroGSShaders/zpipe.cpp b/plugins/zzogl-pg/opengl/ZeroGSShaders/zpipe.cpp index c259407e32..d830f864c7 100644 --- a/plugins/zzogl-pg/opengl/ZeroGSShaders/zpipe.cpp +++ b/plugins/zzogl-pg/opengl/ZeroGSShaders/zpipe.cpp @@ -34,10 +34,10 @@ int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed strm.next_in = (Bytef *)src ; strm.next_out = (Bytef *)dst ; - ret = deflate(&strm, Z_FINISH) ; + ret = deflate(&strm, Z_FINISH) ; have = bytes_to_compress - strm.avail_out ; *bytes_after_compressed = have ; - + assert(ret == Z_STREAM_END); /* stream will be complete */ /* clean up and return */ @@ -45,7 +45,7 @@ int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed return Z_OK; } -int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes) +int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes) { z_stream strm; @@ -78,7 +78,7 @@ int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompr (void)inflateEnd(&strm); return ret; } - + assert(strm.avail_in == 0); /* all input will be used */ if( outbytes != NULL ) diff --git a/plugins/zzogl-pg/opengl/common.h b/plugins/zzogl-pg/opengl/common.h index 698c45c5b9..cd0bac0a97 100644 --- a/plugins/zzogl-pg/opengl/common.h +++ b/plugins/zzogl-pg/opengl/common.h @@ -217,7 +217,7 @@ extern const uint32_t inverse[256]; #else # define FASTDIV(a,b) ((a)/(b)) #endif - + #ifdef ARCH_X86 // avoid +32 for shift optimization (gcc should do that ...) static inline int32_t NEG_SSR32( int32_t a, int8_t s){ @@ -257,7 +257,7 @@ typedef struct PutBitContext { int64_t data_out_size; /* in bytes */ } PutBitContext; -void init_put_bits(PutBitContext *s, +void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size, void *opaque, void (*write_data)(void *, uint8_t *, int)); @@ -340,7 +340,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) #endif // DEBUG_LOG("put_bits=%d %x\n", n, value); assert(n == 32 || value < (1U << n)); - + bit_buf = s->bit_buf; bit_left = s->bit_left; @@ -398,9 +398,9 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) # else int index= s->index; uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5); - - value<<= 32-n; - + + value<<= 32-n; + ptr[0] |= be2me_32(value>>(index&31)); ptr[1] = be2me_32(value<<(32-(index&31))); //if(n>24) DEBUG_LOG("%d %d\n", n, value); @@ -428,7 +428,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) # else int index= s->index; uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3)); - + ptr[0] |= be2me_32(value<<(32-n-(index&7) )); ptr[1] = 0; //if(n>24) DEBUG_LOG("%d %d\n", n, value); @@ -677,9 +677,9 @@ static inline int get_bits_count(GetBitContext *s){ /** * read mpeg1 dc style vlc (sign bit + mantisse with no MSB). - * if MSB not set it is negative + * if MSB not set it is negative * @param n length in bits - * @author BERO + * @author BERO */ static inline int get_xbits(GetBitContext *s, int n){ register int tmp; @@ -845,11 +845,11 @@ static inline int get_vlc(GetBitContext *s, VLC *vlc) { int code; VLC_TYPE (*table)[2]= vlc->table; - + OPEN_READER(re, s) UPDATE_CACHE(re, s) - GET_VLC(code, re, s, table, vlc->bits, 3) + GET_VLC(code, re, s, table, vlc->bits, 3) CLOSE_READER(re, s) return code; @@ -857,17 +857,17 @@ static inline int get_vlc(GetBitContext *s, VLC *vlc) /** * parses a vlc code, faster then get_vlc() - * @param bits is the number of bits which will be read at once, must be + * @param bits is the number of bits which will be read at once, must be * identical to nb_bits in init_vlc() * @param max_depth is the number of times bits bits must be readed to completly - * read the longest vlc code + * read the longest vlc code * = (max_vlc_length + bits - 1) / bits */ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth) { int code; - + OPEN_READER(re, s) UPDATE_CACHE(re, s) @@ -883,7 +883,7 @@ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], static inline void print_bin(int bits, int n){ int i; - + for(i=n-1; i>=0; i--){ DEBUG_LOG("%d", (bits>>i)&1); } @@ -893,7 +893,7 @@ static inline void print_bin(int bits, int n){ static inline int get_bits_trace(GetBitContext *s, int n, char *file, char *func, int line){ int r= get_bits(s, n); - + print_bin(r, n); DEBUG_LOG("%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line); return r; @@ -904,16 +904,16 @@ static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits int r= get_vlc2(s, table, bits, max_depth); int len= get_bits_count(s) - pos; int bits2= show>>(24-len); - + print_bin(bits2, len); - + DEBUG_LOG("%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line); return r; } static inline int get_xbits_trace(GetBitContext *s, int n, char *file, char *func, int line){ int show= show_bits(s, n); int r= get_xbits(s, n); - + print_bin(show, n); DEBUG_LOG("%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line); return r; @@ -1029,9 +1029,9 @@ static inline int ff_sqrt(int a) int ret=0; int s; int ret_sq=0; - + if(a<128) return ff_sqrt_tab[a]; - + for(s=15; s>=0; s--){ int b= ret_sq + (1<<(s*2)) + (ret<= 0 ) { // reset since settings changed - vb[icurctx].bVarsTexSync = 0; + vb[icurctx].bVarsTexSync = 0; vb[icurctx].bVarsSetTarg = 0; } - vb[0].bVarsTexSync = 0; + vb[0].bVarsTexSync = 0; } void ZeroGS::CRenderTarget::ConvertTo16() @@ -587,14 +587,14 @@ void ZeroGS::CRenderTarget::ConvertTo16() FUNCLOG u32 ptexConv; - + // ERROR_LOG("ZZogl: Convert to 16, report if something missing\n"); // create new target if ( ! InitialiseDefaultTexture ( &ptexConv, RW(fbw), RH(fbh)*2 ) ) { ERROR_LOG("Failed to create target for ConvertTo16 %dx%d\n", RW(fbw), RH(fbh)*2); return; } - + DisableAllgl(); SetShaderCaller("CRenderTarget::ConvertTo16"); @@ -630,7 +630,7 @@ void ZeroGS::CRenderTarget::ConvertTo16() assert( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT ); BindToSample ( &ptex ) ; - + cgGLSetTextureParameter(ppsConvert32to16.sFinal, ptex); cgGLEnableTextureParameter(ppsConvert32to16.sFinal); @@ -674,7 +674,7 @@ void ZeroGS::CRenderTarget::ConvertTo16() // TODO, reset depth? if( ZeroGS::icurctx >= 0 ) { // reset since settings changed - vb[icurctx].bVarsTexSync = 0; + vb[icurctx].bVarsTexSync = 0; vb[icurctx].bVarsSetTarg = 0; } vb[0].bVarsTexSync = 0; @@ -691,10 +691,10 @@ void ZeroGS::CRenderTarget::_CreateFeedback() return; } } - + DisableAllgl(); SetShaderCaller("CRenderTarget::_CreateFeedback"); - + // assume depth already set ResetRenderTarget(1); @@ -747,7 +747,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback() // TODO, reset depth? if( ZeroGS::icurctx >= 0 ) { // reset since settings changed - vb[icurctx].bVarsTexSync = 0; + vb[icurctx].bVarsTexSync = 0; } assert( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT ); @@ -758,7 +758,7 @@ void ZeroGS::CRenderTarget::SetRenderTarget(int targ) FUNCLOG glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+targ, GL_TEXTURE_RECTANGLE_NV, ptex, 0 ); - + // if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT) // ERROR_LOG_SPAM("Too bad Framebuffer not compele, glitches could appear onscreen!\n"); } @@ -819,20 +819,20 @@ void ZeroGS::CDepthTarget::Destroy() glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0 ); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0 ); GL_REPORT_ERRORD(); - + if( pstencil != 0 ) { if( pstencil != pdepth ) glDeleteRenderbuffersEXT( 1, &pstencil ); pstencil = 0; } - + if( pdepth != 0 ) { glDeleteRenderbuffersEXT( 1, &pdepth ); pdepth = 0; } GL_REPORT_ERRORD(); } - + CRenderTarget::Destroy(); } @@ -848,7 +848,7 @@ void ZeroGS::CDepthTarget::Resolve() else { // flush if necessary FlushIfNecesary ( this ) ; - if( !(status & TS_Virtual) ) + if( !(status & TS_Virtual) ) status |= TS_Resolved; } @@ -861,12 +861,12 @@ void ZeroGS::CDepthTarget::Resolve(int startrange, int endrange) { FUNCLOG - if( g_nDepthUsed > 0 && conf.mrtdepth && !(status&TS_Virtual) && ZeroGS::IsWriteDepth() ) + if( g_nDepthUsed > 0 && conf.mrtdepth && !(status&TS_Virtual) && ZeroGS::IsWriteDepth() ) CRenderTarget::Resolve(startrange, endrange); else { // flush if necessary FlushIfNecesary ( this ) ; - if( !(status & TS_Virtual) ) + if( !(status & TS_Virtual) ) status |= TS_Resolved; } @@ -892,9 +892,9 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr) texframe.th = fbh; texframe.psm = psm; CMemoryTarget* pmemtarg = g_MemTargs.GetMemoryTarget(texframe, 1); - + DisableAllgl () ; - + ZeroGS::VB& curvb = vb[context]; if (curvb.test.zte == 0) return; @@ -911,8 +911,8 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr) cgGLSetTextureParameter(ppsBitBltDepth.sMemory, pmemtarg->ptex->tex); cgGLEnableTextureParameter(ppsBaseTexture.sFinal); - Vector v = DefaultBitBltPos() ; - v = DefaultBitBltTex() ; + Vector v = DefaultBitBltPos() ; + v = DefaultBitBltTex() ; v.x = 1; v.y = 2; @@ -921,10 +921,10 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr) ZZcgSetParameter4fv(ppsBitBltDepth.sOneColor, v, "g_fOneColor"); Vector vdepth = g_vdepth; - if (psm == PSMT24Z) + if (psm == PSMT24Z) vdepth.w = 0; - else if (psm != PSMT32Z) { - vdepth.z = vdepth.w = 0; + else if (psm != PSMT32Z) { + vdepth.z = vdepth.w = 0; } assert( ppsBitBltDepth.sBitBltZ != 0 ); @@ -1013,14 +1013,14 @@ void ZeroGS::CRenderTargetMngr::DestroyAllTargs(int start, int end, int fbw) if( !it->second->IsDepth() ) { // only resolve if the widths are the same or it->second has bit outside the range // shadow of colossus swaps between fbw=256,fbh=256 and fbw=512,fbh=448. This kills the game if doing || it->second->end > end - + // kh hack, sometimes kh movies do this to clear the target, so have a static count that periodically checks end static int count = 0; - + if( it->second->fbw == fbw || (it->second->fbw != fbw && (it->second->start < start || ((count++&0xf)?0:it->second->end > end) )) ) it->second->Resolve(); else { - FlushIfNecesary ( it->second ) ; + FlushIfNecesary ( it->second ) ; it->second->status |= CRenderTarget::TS_Resolved; } } @@ -1028,13 +1028,13 @@ void ZeroGS::CRenderTargetMngr::DestroyAllTargs(int start, int end, int fbw) if( it->second->fbw == fbw ) it->second->Resolve(); else { - FlushIfNecesary ( it->second ) ; + FlushIfNecesary ( it->second ) ; it->second->status |= CRenderTarget::TS_Resolved; } } - + DestroyAllTargetsHelper( it->second ) ; - + u32 dummykey = GetFrameKeyDummy(it->second); if( mapDummyTargs.find(dummykey) == mapDummyTargs.end() ) { mapDummyTargs[dummykey] = it->second; @@ -1058,14 +1058,14 @@ void ZeroGS::CRenderTargetMngr::DestroyIntersecting(CRenderTarget* prndr) { FUNCLOG assert( prndr != NULL ); - + int start, end; GetRectMemAddress(start, end, prndr->psm, 0, 0, prndr->fbw, prndr->fbh, prndr->fbp, prndr->fbw); - + for(MAPTARGETS::iterator it = mapTargets.begin(); it != mapTargets.end();) { if( it->second != prndr && it->second->start < end && start < it->second->end ) { it->second->Resolve(); - + DestroyAllTargetsHelper( it->second ) ; u32 dummykey = GetFrameKeyDummy(it->second); @@ -1118,7 +1118,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op it = mapTargets.insert(MAPTARGETS::value_type(key, itnew->second)).first; // readd mapTargets.erase(itnew); // delete old - + bfound = true; } } @@ -1193,7 +1193,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op it->second->lastused = timeGetTime(); return Promote(it->first&~TARGET_VIRTUAL_KEY); } - + // check if there exists a more recent target that this target could update from // only update if target isn't mirrored bool bCheckHalfCovering = (g_GameSettings&GAME_FULL16BITRES) && PSMT_ISHALF(it->second->psm) && it->second->fbh +32 < frame.fbh; @@ -1201,7 +1201,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op for(MAPTARGETS::iterator itnew = mapTargets.begin(); itnew != mapTargets.end(); ++itnew) { if( itnew->second != it->second && itnew->second->ptex != it->second->ptex && itnew->second->ptexFeedback != it->second->ptex && itnew->second->lastused > it->second->lastused && !(itnew->second->status & CRenderTarget::TS_NeedUpdate) ) { - + // if new target totally encompasses the current one if( itnew->second->start <= it->second->start && itnew->second->end >= it->second->end ) { it->second->status |= CRenderTarget::TS_NeedUpdate; @@ -1245,7 +1245,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op for(MAPTARGETS::iterator it = mapTargets.begin(); it != mapTargets.end(); ++it) { if( it->second->start < end && start < it->second->end ) { if ((g_GameSettings&GAME_FASTUPDATE) || - ((frame.fbw == it->second->fbw) && + ((frame.fbw == it->second->fbw) && // check depth targets only if partialdepth option ((it->second->fbp != frame.fbp) || ((g_GameSettings & GAME_PARTIALDEPTH) && (opts & CRenderTargetMngr::TO_DepthBuffer))))) { @@ -1267,7 +1267,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op // printf ("A %d %d %d %d\n", frame.psm, frame.fbw, pbesttarg->psm, pbesttarg->fbw); vb[0].frame.fbw = pbesttarg->fbw; - // Something should be here, but what? + // Something should be here, but what? } if( besttarg == 0 ) { @@ -1312,7 +1312,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op for(MAPTARGETS::iterator it1 = mapDummyTargs.begin(); it1 != mapDummyTargs.end(); ++it1) printf ("\t %x %x %x %x\n", it1->second->fbw, it1->second->fbh, it1->second->psm, it1->second->fbp); for(MAPTARGETS::iterator it1 = mapTargets.begin(); it1 != mapTargets.end(); ++it1) - printf ("\t ! %x %x %x %x\n", it1->second->fbw, it1->second->fbh, it1->second->psm, it1->second->fbp); + printf ("\t ! %x %x %x %x\n", it1->second->fbw, it1->second->fbh, it1->second->psm, it1->second->fbp); printf ("\t\t %x %x %x %x\n", it->second->fbw, it->second->fbh, it->second->psm, it->second->fbp); #endif ptarg = it->second; @@ -1332,7 +1332,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op for(MAPTARGETS::iterator it1 = mapDummyTargs.begin(); it1 != mapDummyTargs.end(); ++it1) printf ("\t %x %x %x %x\n", it1->second->fbw, it1->second->fbh, it1->second->psm, it1->second->fbp); for(MAPTARGETS::iterator it1 = mapTargets.begin(); it1 != mapTargets.end(); ++it1) - printf ("\t ! %x %x %x %x\n", it1->second->fbw, it1->second->fbh, it1->second->psm, it1->second->fbp); + printf ("\t ! %x %x %x %x\n", it1->second->fbw, it1->second->fbh, it1->second->psm, it1->second->fbp); #endif // create anew ptarg = (opts&TO_DepthBuffer) ? new CDepthTarget : new CRenderTarget; @@ -1383,7 +1383,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op } } } - + if( (opts & CRenderTargetMngr::TO_Virtual) ) { ptarg->status = CRenderTarget::TS_Virtual; key |= TARGET_VIRTUAL_KEY; @@ -1492,7 +1492,7 @@ bool ZeroGS::CMemoryTarget::ValidateClut(const tex0Info& tex0) int clutsize = 0; int entries = PSMT_IS8CLUT(tex0.psm) ? 256 : 16; - if (PSMT_IS32BIT(tex0.cpsm)) { // 32 bit + if (PSMT_IS32BIT(tex0.cpsm)) { // 32 bit nClutOffset = 64 * tex0.csa; clutsize = min(entries, 256-tex0.csa*16)*4; } @@ -1503,7 +1503,7 @@ bool ZeroGS::CMemoryTarget::ValidateClut(const tex0Info& tex0) assert( clutsize == clut.size() ); - if( PSMT_IS32BIT(cpsm)) { + if( PSMT_IS32BIT(cpsm)) { if( memcmp_mmx(&clut[0], g_pbyGSClut+nClutOffset, clutsize) ) return false; } @@ -1536,7 +1536,7 @@ bool ZeroGS::CMemoryTarget::ValidateTex(const tex0Info& tex0, int starttex, int // lock and compare assert( ptex != NULL && ptex->memptr != NULL); - + int result = memcmp_mmx(ptex->memptr + (checkstarty-realy)*4*GPU_TEXWIDTH, g_pbyGSMemory+checkstarty*4*GPU_TEXWIDTH, (checkendy-checkstarty)*4*GPU_TEXWIDTH); if( result == 0 || !bDeleteBadTex ) { @@ -1573,107 +1573,107 @@ bool ZeroGS::CMemoryTarget::ValidateTex(const tex0Info& tex0, int starttex, int template static __forceinline void BuildClut(u32 psm, u32 height, T* pclut, u8* psrc, T* pdst) { - switch(psm) - { - case PSMT8: - for(u32 i = 0; i < height; ++i) + switch(psm) + { + case PSMT8: + for(u32 i = 0; i < height; ++i) { - for(int j = 0; j < GPU_TEXWIDTH/2; ++j) + for(int j = 0; j < GPU_TEXWIDTH/2; ++j) { - pdst[0] = pclut[psrc[0]]; - pdst[1] = pclut[psrc[1]]; - pdst[2] = pclut[psrc[2]]; - pdst[3] = pclut[psrc[3]]; - pdst[4] = pclut[psrc[4]]; - pdst[5] = pclut[psrc[5]]; - pdst[6] = pclut[psrc[6]]; - pdst[7] = pclut[psrc[7]]; - pdst += 8; - psrc += 8; - } - } - break; + pdst[0] = pclut[psrc[0]]; + pdst[1] = pclut[psrc[1]]; + pdst[2] = pclut[psrc[2]]; + pdst[3] = pclut[psrc[3]]; + pdst[4] = pclut[psrc[4]]; + pdst[5] = pclut[psrc[5]]; + pdst[6] = pclut[psrc[6]]; + pdst[7] = pclut[psrc[7]]; + pdst += 8; + psrc += 8; + } + } + break; - case PSMT4: - for(u32 i = 0; i < height; ++i) - { - for(int j = 0; j < GPU_TEXWIDTH; ++j) + case PSMT4: + for(u32 i = 0; i < height; ++i) + { + for(int j = 0; j < GPU_TEXWIDTH; ++j) { - pdst[0] = pclut[psrc[0]&15]; - pdst[1] = pclut[psrc[0]>>4]; - pdst[2] = pclut[psrc[1]&15]; - pdst[3] = pclut[psrc[1]>>4]; - pdst[4] = pclut[psrc[2]&15]; - pdst[5] = pclut[psrc[2]>>4]; - pdst[6] = pclut[psrc[3]&15]; - pdst[7] = pclut[psrc[3]>>4]; - - pdst += 8; - psrc += 4; - } - } - break; - - case PSMT8H: - for(u32 i = 0; i < height; ++i) - { - for(int j = 0; j < GPU_TEXWIDTH/8; ++j) - { - pdst[0] = pclut[psrc[3]]; - pdst[1] = pclut[psrc[7]]; - pdst[2] = pclut[psrc[11]]; - pdst[3] = pclut[psrc[15]]; - pdst[4] = pclut[psrc[19]]; - pdst[5] = pclut[psrc[23]]; - pdst[6] = pclut[psrc[27]]; - pdst[7] = pclut[psrc[31]]; - pdst += 8; - psrc += 32; - } - } - break; - - case PSMT4HH: - for(u32 i = 0; i < height; ++i) - { - for(int j = 0; j < GPU_TEXWIDTH/8; ++j) - { - pdst[0] = pclut[psrc[3]>>4]; - pdst[1] = pclut[psrc[7]>>4]; - pdst[2] = pclut[psrc[11]>>4]; - pdst[3] = pclut[psrc[15]>>4]; - pdst[4] = pclut[psrc[19]>>4]; - pdst[5] = pclut[psrc[23]>>4]; - pdst[6] = pclut[psrc[27]>>4]; - pdst[7] = pclut[psrc[31]>>4]; - pdst += 8; - psrc += 32; - } - } - break; - - case PSMT4HL: - for(u32 i = 0; i < height; ++i) - { - for(int j = 0; j < GPU_TEXWIDTH/8; ++j) - { - pdst[0] = pclut[psrc[3]&15]; - pdst[1] = pclut[psrc[7]&15]; + pdst[0] = pclut[psrc[0]&15]; + pdst[1] = pclut[psrc[0]>>4]; + pdst[2] = pclut[psrc[1]&15]; + pdst[3] = pclut[psrc[1]>>4]; + pdst[4] = pclut[psrc[2]&15]; + pdst[5] = pclut[psrc[2]>>4]; + pdst[6] = pclut[psrc[3]&15]; + pdst[7] = pclut[psrc[3]>>4]; + + pdst += 8; + psrc += 4; + } + } + break; + + case PSMT8H: + for(u32 i = 0; i < height; ++i) + { + for(int j = 0; j < GPU_TEXWIDTH/8; ++j) + { + pdst[0] = pclut[psrc[3]]; + pdst[1] = pclut[psrc[7]]; + pdst[2] = pclut[psrc[11]]; + pdst[3] = pclut[psrc[15]]; + pdst[4] = pclut[psrc[19]]; + pdst[5] = pclut[psrc[23]]; + pdst[6] = pclut[psrc[27]]; + pdst[7] = pclut[psrc[31]]; + pdst += 8; + psrc += 32; + } + } + break; + + case PSMT4HH: + for(u32 i = 0; i < height; ++i) + { + for(int j = 0; j < GPU_TEXWIDTH/8; ++j) + { + pdst[0] = pclut[psrc[3]>>4]; + pdst[1] = pclut[psrc[7]>>4]; + pdst[2] = pclut[psrc[11]>>4]; + pdst[3] = pclut[psrc[15]>>4]; + pdst[4] = pclut[psrc[19]>>4]; + pdst[5] = pclut[psrc[23]>>4]; + pdst[6] = pclut[psrc[27]>>4]; + pdst[7] = pclut[psrc[31]>>4]; + pdst += 8; + psrc += 32; + } + } + break; + + case PSMT4HL: + for(u32 i = 0; i < height; ++i) + { + for(int j = 0; j < GPU_TEXWIDTH/8; ++j) + { + pdst[0] = pclut[psrc[3]&15]; + pdst[1] = pclut[psrc[7]&15]; pdst[2] = pclut[psrc[11]&15]; - pdst[3] = pclut[psrc[15]&15]; - pdst[4] = pclut[psrc[19]&15]; - pdst[5] = pclut[psrc[23]&15]; - pdst[6] = pclut[psrc[27]&15]; - pdst[7] = pclut[psrc[31]&15]; - pdst += 8; - psrc += 32; - } - } - break; - - default: - assert(0); - } + pdst[3] = pclut[psrc[15]&15]; + pdst[4] = pclut[psrc[19]&15]; + pdst[5] = pclut[psrc[23]&15]; + pdst[6] = pclut[psrc[27]&15]; + pdst[7] = pclut[psrc[31]&15]; + pdst += 8; + psrc += 32; + } + } + break; + + default: + assert(0); + } } #define TARGET_THRESH 0x500 @@ -1686,7 +1686,7 @@ inline list::iterator ZeroGS::CMemoryTargetMngr::DestroyTargetIte // find the target and destroy list::iterator itprev = it; ++it; listClearedTargets.splice(listClearedTargets.end(), listTargets, itprev); - + if( listClearedTargets.size() > TEXDESTROY_THRESH ) { listClearedTargets.pop_front(); } @@ -1701,7 +1701,7 @@ int MemoryTarget_CompareTarget (list::iterator& it, const tex0Inf if( PSMT_ISCLUT(tex0.psm) ) { assert( it->clut.size() > 0 ); - + if( it->psm != tex0.psm || it->cpsm != tex0.cpsm || it->clut.size() != clutsize ) { return 1; } @@ -1716,9 +1716,9 @@ int MemoryTarget_CompareTarget (list::iterator& it, const tex0Inf return 2; } } - + } - else + else if ( PSMT_IS16BIT(tex0.psm) != PSMT_IS16BIT(it->psm) ) { return 1; } @@ -1731,7 +1731,7 @@ void MemoryTarget_GetClutVariables (int& nClutOffset, int& clutsize, const tex0I if( PSMT_ISCLUT(tex0.psm) ) { int entries = PSMT_IS8CLUT(tex0.psm) ? 256 : 16; - if (PSMT_IS32BIT(tex0.cpsm)) { + if (PSMT_IS32BIT(tex0.cpsm)) { nClutOffset = 64 * tex0.csa; clutsize = min(entries, 256-tex0.csa*16)*4; } @@ -1793,7 +1793,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::MemoryTarget_SearchExistTarget it->usedstamp = curstamp; it->validatecount = 0; - + return &(*it); } #ifdef SORT_TARGETS @@ -1809,65 +1809,65 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::MemoryTarget_SearchExistTarget static __forceinline int NumberOfChannels(int psm) { int channels = 1; - - if (PSMT_ISCLUT(psm)) + + if (PSMT_ISCLUT(psm)) { - if (psm == PSMT8) + if (psm == PSMT8) channels = 4; - else if (psm == PSMT4) + else if (psm == PSMT4) channels = 8; } - else + else { - if (PSMT_IS16BIT(psm)) + if (PSMT_IS16BIT(psm)) { // 16z needs to be a8r8g8b8 channels = 2; } } - + return channels; } -ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::MemoryTarget_ClearedTargetsSearch(int fmt, int widthmult, int channels, int height) +ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::MemoryTarget_ClearedTargetsSearch(int fmt, int widthmult, int channels, int height) { CMemoryTarget* targ = NULL; - if (listClearedTargets.size() > 0) + if (listClearedTargets.size() > 0) { list::iterator itbest = listClearedTargets.begin(); - - while(itbest != listClearedTargets.end()) + + while(itbest != listClearedTargets.end()) { - if ((height <= itbest->realheight) && (itbest->fmt == fmt) && (itbest->widthmult == widthmult) && (itbest->channels == channels)) + if ((height <= itbest->realheight) && (itbest->fmt == fmt) && (itbest->widthmult == widthmult) && (itbest->channels == channels)) { // check channels int targchannels = NumberOfChannels(itbest->psm); - + if (targchannels == channels) break; } ++itbest; } - if (itbest != listClearedTargets.end()) + if (itbest != listClearedTargets.end()) { listTargets.splice(listTargets.end(), listClearedTargets, itbest); targ = &listTargets.back(); targ->validatecount = 0; } - else + else { // create a new listTargets.push_back(CMemoryTarget()); targ = &listTargets.back(); } } - else + else { listTargets.push_back(CMemoryTarget()); targ = &listTargets.back(); } - + return targ; } @@ -1888,9 +1888,9 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info u32 fmt = GL_UNSIGNED_BYTE; if (PSMT_ISHALF_STORAGE(tex0)) fmt = GL_UNSIGNED_SHORT_1_5_5_5_REV; - + int widthmult = 1; - if ((g_MaxTexHeight < 4096) && (end-start > g_MaxTexHeight)) widthmult = 2; + if ((g_MaxTexHeight < 4096) && (end-start > g_MaxTexHeight)) widthmult = 2; int channels = 1; channels = NumberOfChannels(tex0.psm); @@ -1898,26 +1898,26 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info targ = MemoryTarget_ClearedTargetsSearch(fmt, widthmult, channels, end - start); // fill local clut - if (PSMT_ISCLUT(tex0.psm)) + if (PSMT_ISCLUT(tex0.psm)) { assert( clutsize > 0 ); targ->cpsm = tex0.cpsm; targ->clut.reserve(256*4); // no matter what targ->clut.resize(clutsize); - - if (PSMT_IS32BIT(tex0.cpsm)) + + if (PSMT_IS32BIT(tex0.cpsm)) { memcpy_amd(&targ->clut[0], g_pbyGSClut+nClutOffset, clutsize); } - else + else { u16* pClutBuffer = (u16*)(g_pbyGSClut + nClutOffset); u16* pclut = (u16*)&targ->clut[0]; int left = ((u32)nClutOffset & 2) ? 0 : ((nClutOffset&0x3ff)/2)+clutsize-512; if( left > 0 ) clutsize -= left; - while(clutsize > 0) + while(clutsize > 0) { pclut[0] = pClutBuffer[0]; pclut++; @@ -1925,11 +1925,11 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info clutsize -= 2; } - if( left > 0) + if( left > 0) { pClutBuffer = (u16*)(g_pbyGSClut + 2); - while(left > 0) + while(left > 0) { pclut[0] = pClutBuffer[0]; left -= 2; @@ -1940,7 +1940,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info } } - if( targ->ptex != NULL ) + if( targ->ptex != NULL ) { assert( end-start <= targ->realheight && targ->fmt == fmt && targ->widthmult == widthmult ); @@ -1952,7 +1952,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info targ->height = end-start; } - if (targ->ptex == NULL) + if (targ->ptex == NULL) { // not initialized yet targ->fmt = fmt; @@ -1963,7 +1963,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info targ->cpsm = tex0.cpsm; targ->widthmult = widthmult; targ->channels = channels; - + // alloc the mem targ->ptex = new CMemoryTarget::TEXTURE(); targ->ptex->ref = 1; @@ -1972,9 +1972,9 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info #ifndef RELEASE_TO_PUBLIC g_TransferredToGPU += GPU_TEXWIDTH * channels * 4 * targ->height; #endif - + // fill with data - if( targ->ptex->memptr == NULL ) + if( targ->ptex->memptr == NULL ) { targ->ptex->memptr = (u8*)_aligned_malloc(4 * GPU_TEXWIDTH * targ->realheight, 16); assert(targ->ptex->ref > 0 ); @@ -1983,40 +1983,40 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info memcpy_amd(targ->ptex->memptr, g_pbyGSMemory + 4 * GPU_TEXWIDTH * targ->realy, 4 * GPU_TEXWIDTH * targ->height); vector texdata; u8* ptexdata = NULL; - - if (PSMT_ISCLUT(tex0.psm)) + + if (PSMT_ISCLUT(tex0.psm)) { texdata.resize( (tex0.cpsm <= 1?4:2) *GPU_TEXWIDTH*channels*widthmult*(targ->realheight+widthmult-1)/widthmult); ptexdata = &texdata[0]; u8* psrc = (u8*)(g_pbyGSMemory + 4 * GPU_TEXWIDTH * targ->realy); - if (PSMT_IS32BIT(tex0.cpsm)) + if (PSMT_IS32BIT(tex0.cpsm)) { u32* pclut = (u32*)&targ->clut[0]; u32* pdst = (u32*)ptexdata; BuildClut(tex0.psm, targ->height, pclut, psrc, pdst); } - else + else { u16* pclut = (u16*)&targ->clut[0]; u16* pdst = (u16*)ptexdata; - + BuildClut(tex0.psm, targ->height, pclut, psrc, pdst); } } - else + else { - if (tex0.psm == PSMT16Z || tex0.psm == PSMT16SZ) + if (tex0.psm == PSMT16Z || tex0.psm == PSMT16SZ) { texdata.resize(4*GPU_TEXWIDTH*channels*widthmult*(targ->realheight+widthmult-1)/widthmult #if defined(ZEROGS_SSE2) - + 15 // reserve additional elements for alignment if SSE2 used. + + 15 // reserve additional elements for alignment if SSE2 used. // better do it now, so less resizing would be needed -#endif +#endif ); - + ptexdata = &texdata[0]; // needs to be 8 bit, use xmm for unpacking @@ -2024,27 +2024,27 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info u16* src = (u16*)(g_pbyGSMemory + 4 * GPU_TEXWIDTH * targ->realy); #if defined(ZEROGS_SSE2) - if (((u32)(uptr)dst)%16 != 0) + if (((u32)(uptr)dst)%16 != 0) { - // This is not unusual situation, when vector does not 16bit alignment, that is destructive for SSE2 + // This is not unusual situation, when vector does not 16bit alignment, that is destructive for SSE2 // instruction movdqa [%eax], xmm0 // The idea would be resise vector to 15 elements, that set ptxedata to aligned position. // Later we would move eax by 16, so only we should verify is first element align // FIXME. As I see, texdata used only once here, it does not have any impact on other code. // Probably, usage of _aligned_maloc() would be preferable. - int disalignment = 16 - ((u32)(uptr)dst)%16 ; // This is value of shift. It could be 0 < disalignment <= 15 + int disalignment = 16 - ((u32)(uptr)dst)%16 ; // This is value of shift. It could be 0 < disalignment <= 15 ptexdata = &texdata[disalignment]; // Set pointer to aligned element - dst = (u16*)ptexdata; - GS_LOG("Made alignment for texdata, 0x%x\n", dst ); + dst = (u16*)ptexdata; + GS_LOG("Made alignment for texdata, 0x%x\n", dst ); assert( ((u32)(uptr)dst)%16 == 0 ); // Assert, because at future could be vectors with uncontigious spaces } int iters = targ->height*GPU_TEXWIDTH/16; SSE2_UnswizzleZ16Target( dst, src, iters ) ; #else // ZEROGS_SSE2 - for(int i = 0; i < targ->height; ++i) + for(int i = 0; i < targ->height; ++i) { - for(int j = 0; j < GPU_TEXWIDTH; ++j) + for(int j = 0; j < GPU_TEXWIDTH; ++j) { dst[0] = src[0]; dst[1] = 0; dst[2] = src[1]; dst[3] = 0; @@ -2054,7 +2054,7 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info } #endif // ZEROGS_SSE2 } - else + else { ptexdata = targ->ptex->memptr; } @@ -2067,20 +2067,20 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info if (targ->ptex->tex == 0) glGenTextures(1, &targ->ptex->tex); glBindTexture(GL_TEXTURE_RECTANGLE_NV, targ->ptex->tex); - glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, fmt==GL_UNSIGNED_BYTE?4:GL_RGB5_A1, GPU_TEXWIDTH*channels*widthmult, + glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, fmt==GL_UNSIGNED_BYTE?4:GL_RGB5_A1, GPU_TEXWIDTH*channels*widthmult, (targ->realheight+widthmult-1)/widthmult, 0, GL_RGBA, fmt, ptexdata); int realheight = targ->realheight; - while(glGetError() != GL_NO_ERROR) + while(glGetError() != GL_NO_ERROR) { // release resources until can create if (listClearedTargets.size() > 0) { listClearedTargets.pop_front(); } - else + else { - if (listTargets.size() == 0) + if (listTargets.size() == 0) { ERROR_LOG("Failed to create %dx%x texture\n", GPU_TEXWIDTH*channels*widthmult, (realheight+widthmult-1)/widthmult); channels = 1; @@ -2161,7 +2161,7 @@ void ZeroGS::CMemoryTargetMngr::ClearRange(int nbStartY, int nbEndY) // continue; // } // } -// +// // ++it; // } // } @@ -2175,7 +2175,7 @@ void ZeroGS::CMemoryTargetMngr::DestroyCleared() it = listClearedTargets.erase(it); continue; } - + ++it; } @@ -2202,7 +2202,7 @@ void ZeroGS::CMemoryTargetMngr::DestroyOldest() list::iterator it, itbest; it = itbest = listTargets.begin(); - + while(it != listTargets.end()) { if( it->usedstamp < itbest->usedstamp ) itbest = it; @@ -2237,14 +2237,14 @@ u32 ZeroGS::CBitwiseTextureMngr::GetTexInt(u32 bitvalue, u32 ptexDoNotDelete) } } - if (glGetError() != GL_NO_ERROR ) + if (glGetError() != GL_NO_ERROR ) ERROR_LOG ("Error before creation of bitmask texture\n"); // create a new tex u32 ptex; glGenTextures(1, &ptex); - if (glGetError() != GL_NO_ERROR ) + if (glGetError() != GL_NO_ERROR ) ERROR_LOG ("Error on generation of bitmask texture\n"); vector data(GPU_TEXMASKWIDTH+1); @@ -2254,12 +2254,12 @@ u32 ZeroGS::CBitwiseTextureMngr::GetTexInt(u32 bitvalue, u32 ptexDoNotDelete) glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptex); - if (glGetError() != GL_NO_ERROR ) + if (glGetError() != GL_NO_ERROR ) ERROR_LOG ("Error on binding bitmask texture\n"); glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_LUMINANCE16, GPU_TEXMASKWIDTH+1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_SHORT, &data[0]); - if (glGetError() != GL_NO_ERROR ) + if (glGetError() != GL_NO_ERROR ) ERROR_LOG ("Error on puting bitmask texture\n"); // Removing clamping, as it seems lead to numerous troubles at some drivers @@ -2290,7 +2290,7 @@ static __forceinline void RangeSanityCheck() { #ifdef _DEBUG // sanity check - for(int i = 0; i < (int)ranges.size()-1; ++i) + for(int i = 0; i < (int)ranges.size()-1; ++i) { assert( ranges[i].end < ranges[i+1].start ); } @@ -2301,25 +2301,25 @@ void ZeroGS::CRangeManager::Insert(int start, int end) { FUNCLOG int imin = 0, imax = (int)ranges.size(), imid; - + RangeSanityCheck(); - - switch(ranges.size()) + + switch(ranges.size()) { case 0: ranges.push_back(RANGE(start, end)); return; case 1: - if (end < ranges.front().start) + if (end < ranges.front().start) { ranges.insert(ranges.begin(), RANGE(start, end)); } - else if (start > ranges.front().end) + else if (start > ranges.front().end) { ranges.push_back(RANGE(start, end)); } - else + else { if (start < ranges.front().start) ranges.front().start = start; if (end > ranges.front().end) ranges.front().end = end; @@ -2329,22 +2329,22 @@ void ZeroGS::CRangeManager::Insert(int start, int end) } // find where start is - while(imin < imax) + while(imin < imax) { imid = (imin+imax)>>1; assert( imid < (int)ranges.size() ); - if ((ranges[imid].end >= start) && ((imid == 0) || (ranges[imid-1].end < start))) + if ((ranges[imid].end >= start) && ((imid == 0) || (ranges[imid-1].end < start))) { imin = imid; break; } - else if (ranges[imid].start > start) + else if (ranges[imid].start > start) { imax = imid; } - else + else { imin = imid + 1; } @@ -2352,31 +2352,31 @@ void ZeroGS::CRangeManager::Insert(int start, int end) int startindex = imin; - if (startindex >= (int)ranges.size()) + if (startindex >= (int)ranges.size()) { // non intersecting assert( start > ranges.back().end ); ranges.push_back(RANGE(start, end)); return; } - if (startindex == 0 && end < ranges.front().start) + if (startindex == 0 && end < ranges.front().start) { ranges.insert(ranges.begin(), RANGE(start, end)); RangeSanityCheck(); return; } - imin = 0; + imin = 0; imax = (int)ranges.size(); // find where end is - while(imin < imax) + while(imin < imax) { imid = (imin + imax) >> 1; assert(imid < (int)ranges.size()); - if ((ranges[imid].end <= end) && ((imid == ranges.size() - 1) || (ranges[imid+1].start > end))) + if ((ranges[imid].end <= end) && ((imid == ranges.size() - 1) || (ranges[imid+1].start > end))) { imin = imid; break; @@ -2385,7 +2385,7 @@ void ZeroGS::CRangeManager::Insert(int start, int end) { imax = imid; } - else + else { imin = imid + 1; } @@ -2393,7 +2393,7 @@ void ZeroGS::CRangeManager::Insert(int start, int end) int endindex = imin; - if (startindex > endindex) + if (startindex > endindex) { // create a new range ranges.insert(ranges.begin() + startindex, RANGE(start, end)); @@ -2401,13 +2401,13 @@ void ZeroGS::CRangeManager::Insert(int start, int end) return; } - if (endindex >= (int)ranges.size() - 1) + if (endindex >= (int)ranges.size() - 1) { // pop until startindex is reached int lastend = ranges.back().end; int numpop = (int)ranges.size() - startindex - 1; - - while(numpop-- > 0 ) + + while(numpop-- > 0 ) { ranges.pop_back(); } @@ -2420,7 +2420,7 @@ void ZeroGS::CRangeManager::Insert(int start, int end) return; } - if( endindex == 0 ) + if( endindex == 0 ) { assert( end >= ranges.front().start ); if (start < ranges.front().start) ranges.front().start = start; @@ -2431,14 +2431,14 @@ void ZeroGS::CRangeManager::Insert(int start, int end) // somewhere in the middle if (ranges[startindex].start < start) start = ranges[startindex].start; - if (startindex < endindex) + if (startindex < endindex) { ranges.erase(ranges.begin() + startindex, ranges.begin() + endindex ); } if (start < ranges[startindex].start) ranges[startindex].start = start; if (end > ranges[startindex].end) ranges[startindex].end = end; - + RangeSanityCheck(); } @@ -2538,7 +2538,7 @@ void FlushTransferRanges(const tex0Info* ptex) if( !(g_GameSettings & GAME_NOQUICKRESOLVE) ) { if( ptarg->fbp != vb[0].gsfb.fbp ) {//&& (vb[0].prndr == NULL || ptarg->fbp != vb[0].prndr->fbp) ) { - + if( ptarg->fbp != vb[1].gsfb.fbp ) { //&& (vb[1].prndr == NULL || ptarg->fbp != vb[1].prndr->fbp) ) { // this render target currently isn't used and is not in the texture's way, so can safely ignore // resolving it. Also the range has to be big enough compared to the target to really call it resolved @@ -2582,7 +2582,7 @@ void FlushTransferRanges(const tex0Info* ptex) if( start < ptarg->end && end > ptarg->start ) { // suikoden5 is faster with check, but too big of a value and kh screens mess up - /* Zeydlitz remove this check, it does not do anything good + /* Zeydlitz remove this check, it does not do anything good if ((end - start > 0x8000) && (!(g_GameSettings & GAME_GUSTHACK) || (end-start > 0x40000))) { // intersects, do only one sided resolves if( end-start > 4*ptarg->fbw ) { // at least it be greater than one scanline (spiro is faster) @@ -2595,7 +2595,7 @@ void FlushTransferRanges(const tex0Info* ptex) } } }*/ - + ptarg->status |= CRenderTarget::TS_Resolved; if( (!ptarg->IsDepth() || (!(g_GameSettings & GAME_NODEPTHUPDATE) || end-start > 0x1000)) && ((end-start > 0x40000) || !(g_GameSettings & GAME_GUSTHACK))) ptarg->status |= CRenderTarget::TS_NeedUpdate; @@ -2629,7 +2629,7 @@ void InitTransferHostLocal() gs.imageEndX = gs.imageX + gs.imageWnew; gs.imageEndY = gs.imageY + gs.imageHnew; - assert( gs.imageEndX < 2048 && gs.imageEndY < 2048 ); + assert( gs.imageEndX < 2048 && gs.imageEndY < 2048 ); // hack! viewful joe if( gs.dstbuf.psm == 63 ) @@ -2766,7 +2766,7 @@ void TransferHostLocal(const void* pbyMem, u32 nQWordSize) //{ // assert( gs.imageTransfer == 0 ); // u8* pstart = g_pbyGSMemory + gs.dstbuf.bp*256; -// +// // const u8* pendbuf = (const u8*)pbyMem + nQWordSize*4; // int i = gs.imageY, j = gs.imageX; // @@ -2912,26 +2912,26 @@ void TransferLocalHost(void* pbyMem, u32 nQWordSize, int& x, int& y, u8 *pstart, int i = x, j = y; T* pbuf = (T*)pbyMem; u32 nSize = nQWordSize*16/sizeof(T); - - for(; i < gs.imageEndY; ++i) + + for(; i < gs.imageEndY; ++i) { - for(; j < gs.imageEndX && nSize > 0; ++j, --nSize) + for(; j < gs.imageEndX && nSize > 0; ++j, --nSize) { *pbuf++ = rp(pstart, j%2048, i%2048, gs.srcbuf.bw); } - - if( j >= gs.imageEndX ) - { - assert( j == gs.imageEndX); - j = gs.trxpos.sx; + + if( j >= gs.imageEndX ) + { + assert( j == gs.imageEndX); + j = gs.trxpos.sx; } - else - { - assert( nSize == 0 ); - break; + else + { + assert( nSize == 0 ); + break; } } - + } void TransferLocalHost_24(void* pbyMem, u32 nQWordSize, int& x, int& y, u8 *pstart, _readPixel_0 rp) @@ -2939,28 +2939,28 @@ void TransferLocalHost_24(void* pbyMem, u32 nQWordSize, int& x, int& y, u8 *psta int i = x, j = y; u8* pbuf = (u8*)pbyMem; u32 nSize = nQWordSize*16/3; - - for(; i < gs.imageEndY; ++i) - { - for(; j < gs.imageEndX && nSize > 0; ++j, --nSize) - { - u32 p = rp(pstart, j%2048, i%2048, gs.srcbuf.bw); - pbuf[0] = (u8)p; - pbuf[1] = (u8)(p>>8); - pbuf[2] = (u8)(p>>16); - pbuf += 3; - } - - if( j >= gs.imageEndX ) - { - assert( j == gs.imageEndX); - j = gs.trxpos.sx; - } - else - { - assert( nSize == 0 ); - break; - } + + for(; i < gs.imageEndY; ++i) + { + for(; j < gs.imageEndX && nSize > 0; ++j, --nSize) + { + u32 p = rp(pstart, j%2048, i%2048, gs.srcbuf.bw); + pbuf[0] = (u8)p; + pbuf[1] = (u8)(p>>8); + pbuf[2] = (u8)(p>>16); + pbuf += 3; + } + + if( j >= gs.imageEndX ) + { + assert( j == gs.imageEndX); + j = gs.trxpos.sx; + } + else + { + assert( nSize == 0 ); + break; + } } } @@ -2996,7 +2996,7 @@ void TransferLocalHost(void* pbyMem, u32 nQWordSize) } } -// dir depends on trxpos.dir +// dir depends on trxpos.dir void TransferLocalLocal() { FUNCLOG @@ -3010,7 +3010,7 @@ void TransferLocalLocal() WARN_LOG("Transfer error, dst width exceeds\n"); int srcstart, srcend, dststart, dstend; - + GetRectMemAddress(srcstart, srcend, gs.srcbuf.psm, gs.trxpos.sx, gs.trxpos.sy, gs.imageWnew, gs.imageHnew, gs.srcbuf.bp, gs.srcbuf.bw); GetRectMemAddress(dststart, dstend, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw); @@ -3135,15 +3135,15 @@ void TransferLocalLocal() case PSMT8: if( gs.dstbuf.psm == PSMT8 ) { - TRANSFERLOCALLOCAL(8, 8, 4); + TRANSFERLOCALLOCAL(8, 8, 4); } else { - TRANSFERLOCALLOCAL(8, 8H, 4); + TRANSFERLOCALLOCAL(8, 8H, 4); } break; case PSMT4: - + switch(gs.dstbuf.psm ) { case PSMT4: TRANSFERLOCALLOCAL_4(4, 4); break; case PSMT4HL: TRANSFERLOCALLOCAL_4(4, 4HL); break; @@ -3153,10 +3153,10 @@ void TransferLocalLocal() case PSMT8H: if( gs.dstbuf.psm == PSMT8 ) { - TRANSFERLOCALLOCAL(8H, 8, 4); + TRANSFERLOCALLOCAL(8H, 8, 4); } else { - TRANSFERLOCALLOCAL(8H, 8H, 4); + TRANSFERLOCALLOCAL(8H, 8H, 4); } break; @@ -3314,46 +3314,46 @@ void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h src += RH(Pitch(fbw))/sizeof(Tsrc); \ } \ } \ - + void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, bool mode = true) { FUNCLOG - + int start, end; - + s_nResolved += 2; - + // align the rect to the nearest page // note that fbp is always aligned on page boundaries GetRectMemAddress(start, end, psm, 0, 0, fbw, fbh, fbp, fbw); - if (GetRenderFormat() == RFT_byte8) + if (GetRenderFormat() == RFT_byte8) { // start the conversion process A8R8G8B8 -> psm - switch(psm) + switch(psm) { case PSMCT32: case PSMCT24: RESOLVE_32_BIT(32, u32, u32, (u32)); break; - + case PSMCT16: RESOLVE_32_BIT(16, u16, u32, RGBA32to16); break; - + case PSMCT16S: RESOLVE_32_BIT(16S, u16, u32, RGBA32to16); break; - + case PSMT32Z: case PSMT24Z: RESOLVE_32_BIT(32Z, u32, u32, (u32)); break; - + case PSMT16Z: RESOLVE_32_BIT(16Z, u16, u32, (u16)); break; - + case PSMT16SZ: RESOLVE_32_BIT(16SZ, u16, u32, (u16)); break; @@ -3361,30 +3361,30 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo } else // float16 { - switch(psm) + switch(psm) { case PSMCT32: case PSMCT24: RESOLVE_32_BIT(32, u32, Vector_16F, Float16ToARGB); break; - + case PSMCT16: RESOLVE_32_BIT(16, u16, Vector_16F, Float16ToARGB16); break; - + case PSMCT16S: RESOLVE_32_BIT(16S, u16, Vector_16F, Float16ToARGB16); break; - + case PSMT32Z: case PSMT24Z: RESOLVE_32_BIT(32Z, u32, Vector_16F, Float16ToARGB_Z); break; - + case PSMT16Z: RESOLVE_32_BIT(16Z, u16, Vector_16F, Float16ToARGB16_Z); break; - + case PSMT16SZ: RESOLVE_32_BIT(16SZ, u16, Vector_16F, Float16ToARGB16_Z); break; @@ -3498,7 +3498,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(16S, u16, u32, 16, 16, 8, RGBA32to16, Frame, 0, 0); } - + break; case PSMT32Z: case PSMT24Z: @@ -3511,7 +3511,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(32Z, u32, u32, 32, 8, 8, (u32), Frame, 0, 0); } - + break; case PSMT16Z: if( s_AAy ) { @@ -3523,7 +3523,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(16Z, u16, u32, 16, 16, 8, (u16), Frame, 0, 0); } - + break; case PSMT16SZ: if( s_AAy ) { @@ -3535,7 +3535,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(16SZ, u16, u32, 16, 16, 8, (u16), Frame, 0, 0); } - + break; } } @@ -3552,7 +3552,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(32, u32, Vector_16F, 32, 8, 8, Float16ToARGB, Frame16, 0, 0); } - + break; case PSMCT16: if( s_AAy ) { @@ -3564,7 +3564,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(16, u16, Vector_16F, 16, 16, 8, Float16ToARGB16, Frame16, 0, 0); } - + break; case PSMCT16S: if( s_AAy ) { @@ -3576,7 +3576,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(16S, u16, Vector_16F, 16, 16, 8, Float16ToARGB16, Frame16, 0, 0); } - + break; case PSMT32Z: case PSMT24Z: @@ -3589,7 +3589,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(32Z, u32, Vector_16F, 32Z, 8, 8, Float16ToARGB_Z, Frame16, 0, 0); } - + break; case PSMT16Z: if( s_AAy ) { @@ -3601,7 +3601,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(16Z, u16, Vector_16F, 16Z, 16, 8, Float16ToARGB16_Z, Frame16, 0, 0); } - + break; case PSMT16SZ: if( s_AAy ) { @@ -3613,7 +3613,7 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo else { RESOLVE_32BIT(16SZ, u16, Vector_16F, 16Z, 16, 8, Float16ToARGB16_Z, Frame16, 0, 0); } - + break; } } diff --git a/plugins/zzogl-pg/opengl/targets.h b/plugins/zzogl-pg/opengl/targets.h index 5849fbc245..ebe5e6a73c 100644 --- a/plugins/zzogl-pg/opengl/targets.h +++ b/plugins/zzogl-pg/opengl/targets.h @@ -37,23 +37,23 @@ namespace ZeroGS { { public: typedef map MAPTARGETS; - + enum TargetOptions { TO_DepthBuffer = 1, TO_StrictHeight = 2, // height returned has to be the same as requested TO_Virtual = 4 }; - + ~CRenderTargetMngr() { Destroy(); } - + void Destroy(); static MAPTARGETS::iterator GetOldestTarg(MAPTARGETS& m); - + CRenderTarget* GetTarg(const frameInfo& frame, u32 Options, int maxposheight); inline CRenderTarget* GetTarg(int fbp, int fbw, VB& curvb) { MAPTARGETS::iterator it = mapTargets.find (GetFrameKey(fbp, fbw, curvb)); -/* if (fbp == 0x3600 && fbw == 0x100 && it == mapTargets.end()) +/* if (fbp == 0x3600 && fbw == 0x100 && it == mapTargets.end()) { printf("%x\n", GetFrameKey(fbp, fbw, curvb)) ; printf("%x %x\n", fbp, fbw); @@ -62,33 +62,33 @@ namespace ZeroGS { }*/ return it != mapTargets.end() ? it->second : NULL; } - + // gets all targets with a range void GetTargs(int start, int end, list& listTargets) const; - + // resolves all targets within a range __forceinline void Resolve(int start, int end); __forceinline void ResolveAll() { for(MAPTARGETS::iterator it = mapTargets.begin(); it != mapTargets.end(); ++it ) it->second->Resolve(); } - + void DestroyAllTargs(int start, int end, int fbw); void DestroyIntersecting(CRenderTarget* prndr); - + // promotes a target from virtual to real inline CRenderTarget* Promote(u32 key) { assert( !(key & TARGET_VIRTUAL_KEY) ); - + // promote to regular targ CRenderTargetMngr::MAPTARGETS::iterator it = mapTargets.find(key|TARGET_VIRTUAL_KEY); assert( it != mapTargets.end() ); - + CRenderTarget* ptarg = it->second; mapTargets.erase(it); - + DestroyIntersecting(ptarg); - + it = mapTargets.find(key); if( it != mapTargets.end() ) { DestroyTarg(it->second); @@ -96,16 +96,16 @@ namespace ZeroGS { } else mapTargets[key] = ptarg; - + if( g_GameSettings & GAME_RESOLVEPROMOTED ) ptarg->status = CRenderTarget::TS_Resolved; else ptarg->status = CRenderTarget::TS_NeedUpdate; return ptarg; } - + static void DestroyTarg(CRenderTarget* ptarg); - + MAPTARGETS mapTargets, mapDummyTargs; }; @@ -168,10 +168,10 @@ namespace ZeroGS { // works in semi logN void Insert(int start, int end); - inline void Clear() { - ranges.resize(0); + inline void Clear() { + ranges.resize(0); } - + vector ranges; // organized in ascending order, non-intersecting }; @@ -188,7 +188,7 @@ namespace ZeroGS { else return (tbw >> ( s_AAz - s_AAx )); } - + // Real rendered height, depends on AA and AAneg. inline int RH(int tbh) { if (s_AAy >= s_AAw) @@ -236,14 +236,14 @@ inline u32 GetFrameKey (int fbp, int fbw, VB& curvb) { inline u16 ShiftHeight (int fbh, int fbp, int fbhCalc) { return fbh; -} +} //FIXME: this code for P4 ad KH1. It should not be such strange! //Dummy targets was deleted from mapTargets, but not erased. inline u32 GetFrameKeyDummy (const frameInfo& frame) { // if (frame.fbp > 0x2000 && ZZOgl_fbh_Calc(frame) < 0x400 && ZZOgl_fbh_Calc(frame) != frame.fbh) // printf ("Z %x %x %x %x\n", frame.fbh, frame.fbhCalc, frame.fbp, ZZOgl_fbh_Calc(frame)); - // height over 1024 would shrink to 1024, so dummy targets with calculated size more than 0x400 should be + // height over 1024 would shrink to 1024, so dummy targets with calculated size more than 0x400 should be // distinct by real height. But in FFX there is 3e0 height target, so I put 0x300 as limit if (/*frame.fbp > 0x2000 && */ZZOgl_fbh_Calc(frame) < 0x300) return (((frame.fbw) << 16) | ZZOgl_fbh_Calc(frame)); diff --git a/plugins/zzogl-pg/opengl/x86.cpp b/plugins/zzogl-pg/opengl/x86.cpp index dc263de1e9..f41a8dd0bb 100644 --- a/plugins/zzogl-pg/opengl/x86.cpp +++ b/plugins/zzogl-pg/opengl/x86.cpp @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ @@ -548,11 +548,11 @@ End: void __fastcall WriteCLUT_T16_I8_CSM1_c(u32* _vm, u32* _clut) { - const static u32 map[] = + const static u32 map[] = { 0, 2, 8, 10, 16, 18, 24, 26, 4, 6, 12, 14, 20, 22, 28, 30, - 1, 3, 9, 11, 17, 19, 25, 27, + 1, 3, 9, 11, 17, 19, 25, 27, 5, 7, 13, 15, 21, 23, 29, 31 }; @@ -561,7 +561,7 @@ void __fastcall WriteCLUT_T16_I8_CSM1_c(u32* _vm, u32* _clut) int left = ((u32)(uptr)clut&2) ? 512 : 512-(((u32)(uptr)clut)&0x3ff)/2; - for(int j = 0; j < 8; j++, vm += 32, clut += 64, left -= 32) + for(int j = 0; j < 8; j++, vm += 32, clut += 64, left -= 32) { if(left == 32) { assert( left == 32 ); @@ -591,7 +591,7 @@ void __fastcall WriteCLUT_T32_I8_CSM1_c(u32* vm, u32* clut) u64* dst = (u64*)clut; for(int j = 0; j < 2; j++, src += 32) { - for(int i = 0; i < 4; i++, dst+=16, src+=8) + for(int i = 0; i < 4; i++, dst+=16, src+=8) { dst[0] = src[0]; dst[1] = src[2]; @@ -646,7 +646,7 @@ void __fastcall WriteCLUT_T32_I4_CSM1_c(u32* vm, u32* clut) void SSE2_UnswizzleZ16Target( u16* dst, u16* src, int iters ) { -#if defined(_MSC_VER) +#if defined(_MSC_VER) __asm { mov edx, iters pxor xmm7, xmm7 @@ -699,44 +699,44 @@ Z16Loop: __asm__(".intel_syntax\n" "pxor %%xmm7, %%xmm7\n" - + "Z16Loop:\n" // unpack 64 bytes at a time "movdqa %%xmm0, [%0]\n" "movdqa %%xmm2, [%0+16]\n" "movdqa %%xmm4, [%0+32]\n" "movdqa %%xmm6, [%0+48]\n" - + "movdqa %%xmm1, %%xmm0\n" "movdqa %%xmm3, %%xmm2\n" "movdqa %%xmm5, %%xmm4\n" - + "punpcklwd %%xmm0, %%xmm7\n" "punpckhwd %%xmm1, %%xmm7\n" "punpcklwd %%xmm2, %%xmm7\n" "punpckhwd %%xmm3, %%xmm7\n" - + // start saving "movdqa [%1], %%xmm0\n" "movdqa [%1+16], %%xmm1\n" - + "punpcklwd %%xmm4, %%xmm7\n" "punpckhwd %%xmm5, %%xmm7\n" - + "movdqa [%1+32], %%xmm2\n" "movdqa [%1+48], %%xmm3\n" - + "movdqa %%xmm0, %%xmm6\n" "punpcklwd %%xmm6, %%xmm7\n" - + "movdqa [%1+64], %%xmm4\n" "movdqa [%1+80], %%xmm5\n" "punpckhwd %%xmm0, %%xmm7\n" - + "movdqa [%1+96], %%xmm6\n" "movdqa [%1+112], %%xmm0\n" - + "add %0, 64\n" "add %1, 128\n" "sub %2, 1\n" diff --git a/plugins/zzogl-pg/opengl/x86.h b/plugins/zzogl-pg/opengl/x86.h index 4fb6c4ee74..c3bc5d74b6 100644 --- a/plugins/zzogl-pg/opengl/x86.h +++ b/plugins/zzogl-pg/opengl/x86.h @@ -6,15 +6,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ diff --git a/plugins/zzogl-pg/opengl/zerogs.cpp b/plugins/zzogl-pg/opengl/zerogs.cpp index 51b70a261a..13b81486d5 100644 --- a/plugins/zzogl-pg/opengl/zerogs.cpp +++ b/plugins/zzogl-pg/opengl/zerogs.cpp @@ -39,7 +39,7 @@ #include "ZeroGSShaders/zerogsshaders.h" #include "targets.h" -//----------------------- Defines +//----------------------- Defines //-------------------------- Typedefs typedef void (APIENTRYP _PFNSWAPINTERVAL) (int); @@ -54,8 +54,8 @@ extern int g_nFrame, g_nRealFrame; //-------------------------- Variables #ifdef _WIN32 -HDC hDC=NULL; // Private GDI Device Context -HGLRC hRC=NULL; // Permanent Rendering Context +HDC hDC=NULL; // Private GDI Device Context +HGLRC hRC=NULL; // Permanent Rendering Context #endif bool g_bIsLost = 0; // ZZ @@ -100,7 +100,7 @@ CGparameter g_vparamPosXY[2] = {0}, g_fparamFogColor = 0; map mapShaderResources; -bool s_bTexFlush = FALSE; +bool s_bTexFlush = FALSE; int s_nLastResolveReset = 0; int s_nWireframeCount = 0; int s_nResolveCounts[30] = {0}; // resolve counts for last 30 frames @@ -118,12 +118,12 @@ namespace ZeroGS Vector g_vdepth, vlogz; // = Vector( 255.0 /256.0f, 255.0/65536.0f, 255.0f/(65535.0f*256.0f), 1.0f/(65536.0f*65536.0f)); -// Vector g_vdepth = Vector( 65536.0f*65536.0f, 256.0f*65536.0f, 65536.0f, 256.0f); +// Vector g_vdepth = Vector( 65536.0f*65536.0f, 256.0f*65536.0f, 65536.0f, 256.0f); - extern CRangeManager s_RangeMngr; // manages overwritten memory + extern CRangeManager s_RangeMngr; // manages overwritten memory GLenum GetRenderTargetFormat() { return GetRenderFormat()==RFT_byte8?4:g_internalRGBAFloat16Fmt; } - // returns the first and last addresses aligned to a page that cover + // returns the first and last addresses aligned to a page that cover void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw); // bool LoadEffects(); @@ -134,7 +134,7 @@ namespace ZeroGS void ChangeDeviceSize(int nNewWidth, int nNewHeight); void ProcessMessages(); - void RenderCustom(float fAlpha); // intro anim + void RenderCustom(float fAlpha); // intro anim struct MESSAGE { @@ -204,7 +204,7 @@ void ZeroGS::HandleGLError() // check the error status of this framebuffer */ GLenum error = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - // if error != GL_FRAMEBUFFER_COMPLETE_EXT, there's an error of some sort + // if error != GL_FRAMEBUFFER_COMPLETE_EXT, there's an error of some sort if( error != 0 ) { int w, h; GLint fmt; @@ -286,9 +286,9 @@ void ZeroGS::DrawText(const char* pstr, int left, int top, u32 color) FUNCLOG cgGLDisableProfile(cgvProf); cgGLDisableProfile(cgfProf); - + glColor3f(((color>>16)&0xff)/255.0f, ((color>>8)&0xff)/255.0f, (color&0xff)/255.0f); - + font_p->printString(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight,0); cgGLEnableProfile(cgvProf); cgGLEnableProfile(cgfProf); @@ -325,7 +325,7 @@ void ZeroGS::Reset() FUNCLOG s_RTs.ResolveAll(); s_DepthRTs.ResolveAll(); - + vb[0].nCount = 0; vb[1].nCount = 0; @@ -371,16 +371,16 @@ void ZeroGS::ChangeDeviceSize(int nNewWidth, int nNewHeight) } -void ZeroGS::SetNegAA(int mode) { +void ZeroGS::SetNegAA(int mode) { FUNCLOG // need to flush all targets s_RTs.ResolveAll(); s_RTs.Destroy(); s_DepthRTs.ResolveAll(); s_DepthRTs.Destroy(); - + s_AAz = s_AAw = 0; // This is code for x0, x2, x4, x8 and x16 anti-aliasing. - if (mode > 0) + if (mode > 0) { s_AAz = (mode+1) / 2; // ( 1, 0 ) ; ( 1, 1 ) -- it's used as binary shift, so x << s_AAz, y << s_AAw s_AAw = mode / 2; @@ -397,15 +397,15 @@ void ZeroGS::SetAA(int mode) { FUNCLOG float f; - + // need to flush all targets s_RTs.ResolveAll(); s_RTs.Destroy(); s_DepthRTs.ResolveAll(); s_DepthRTs.Destroy(); - + s_AAx = s_AAy = 0; // This is code for x0, x2, x4, x8 and x16 anti-aliasing. - if (mode > 0) + if (mode > 0) { s_AAx = (mode+1) / 2; // ( 1, 0 ) ; ( 1, 1 ) ; ( 2, 1 ) ; ( 2, 2 ) -- it's used as binary shift, so x >> s_AAx, y >> s_AAy s_AAy = mode / 2; @@ -416,7 +416,7 @@ void ZeroGS::SetAA(int mode) vb[0].prndr = NULL; vb[0].pdepth = NULL; vb[0].bNeedFrameCheck = 1; vb[0].bNeedZCheck = 1; vb[1].prndr = NULL; vb[1].pdepth = NULL; vb[1].bNeedFrameCheck = 1; vb[1].bNeedZCheck = 1; - + f = mode > 0 ? 2.0f : 1.0f; glPointSize(f); } @@ -449,7 +449,7 @@ void ZeroGS::ProcessMessages() if( listMsgs.size() > 0 ) { int left = 25, top = 15; list::iterator it = listMsgs.begin(); - + while( it != listMsgs.end() ) { DrawText(it->str, left+1, top+1, 0xff000000); DrawText(it->str, left, top, 0xffffff30); @@ -537,7 +537,7 @@ void ZeroGS::Restore() ////////////////////////// -__forceinline void MOVZ(VertexGPU *p, u32 gsz, const VB& curvb) +__forceinline void MOVZ(VertexGPU *p, u32 gsz, const VB& curvb) { p->z = curvb.zprimmask==0xffff?min((u32)0xffff, gsz):gsz; } @@ -549,41 +549,41 @@ __forceinline void MOVFOG(VertexGPU *p, Vertex gsf) int Values[100]={0,}; -__forceinline void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) -{ - int index = Index; - +__forceinline void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) +{ + int index = Index; + p->x = (((int)gs.gsvertex[index].x - curvb.offset.x)>>1)&0xffff; p->y = (((int)gs.gsvertex[index].y - curvb.offset.y)>>1)&0xffff; - + /*x = ((int)gs.gsvertex[index].x - curvb.offset.x); y = ((int)gs.gsvertex[index].y - curvb.offset.y); p.x = (x&0x7fff) | (x < 0 ? 0x8000 : 0); p.y = (y&0x7fff) | (y < 0 ? 0x8000 : 0);*/ - + p->f = ((s16)gs.gsvertex[index].f<<7)|0x7f; MOVZ(p, gs.gsvertex[index].z, curvb); p->rgba = prim->iip ? gs.gsvertex[index].rgba : gs.rgba; -// This code is somehow icorrect -// if ((gs.texa.aem) && ((p->rgba & 0xffffff ) == 0)) +// This code is somehow icorrect +// if ((gs.texa.aem) && ((p->rgba & 0xffffff ) == 0)) // p->rgba = 0; if (g_GameSettings & GAME_TEXAHACK) { - u32 B = (( p->rgba & 0xfe000000 ) >> 1) + + u32 B = (( p->rgba & 0xfe000000 ) >> 1) + (0x01000000 * curvb.fba.fba) ; p->rgba = ( p->rgba & 0xffffff ) + B; } - if (prim->tme ) + if (prim->tme ) { - if( prim->fst ) + if( prim->fst ) { p->s = (float)gs.gsvertex[index].u * fiTexWidth[prim->ctxt]; p->t = (float)gs.gsvertex[index].v * fiTexHeight[prim->ctxt]; p->q = 1; } - else + else { p->s = gs.gsvertex[index].s; p->t = gs.gsvertex[index].t; @@ -593,11 +593,11 @@ __forceinline void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) } static __forceinline void OUTPUT_VERT(VertexGPU vert, u32 id) -{ +{ #ifdef PRIM_LOG - PRIM_LOG("%c%d(%d): xyzf=(%4d,%4d,0x%x,%3d), rgba=0x%8.8x, stq = (%2.5f,%2.5f,%2.5f)\n", + PRIM_LOG("%c%d(%d): xyzf=(%4d,%4d,0x%x,%3d), rgba=0x%8.8x, stq = (%2.5f,%2.5f,%2.5f)\n", id==0?'*':' ', id, prim->prim, vert.x/8, vert.y/8, vert.z, vert.f/128, - vert.rgba, Clamp(vert.s, -10, 10), Clamp(vert.t, -10, 10), Clamp(vert.q, -10, 10)); + vert.rgba, Clamp(vert.s, -10, 10), Clamp(vert.t, -10, 10), Clamp(vert.q, -10, 10)); #endif } @@ -713,10 +713,10 @@ void ZeroGS::KickTriangleFan() OUTPUT_VERT(p[2], 2); } -__forceinline void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb) +__forceinline void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb) { - SET_VERTEX(p, next, curvb); - MOVZ(p, v.z, curvb); + SET_VERTEX(p, next, curvb); + MOVZ(p, v.z, curvb); MOVFOG(p, v); } @@ -725,7 +725,7 @@ void ZeroGS::KickSprite() FUNCLOG assert( gs.primC >= 2 ); VB& curvb = vb[prim->ctxt]; - + if (curvb.bNeedTexCheck) curvb.FlushTexData(); if ((vb[!prim->ctxt].nCount > 0) && (vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp)) @@ -740,7 +740,7 @@ void ZeroGS::KickSprite() int last = (gs.primIndex+2)%ARRAY_SIZE(gs.gsvertex); // sprite is too small and AA shows lines (tek4) - if ( s_AAx ) + if ( s_AAx ) { gs.gsvertex[last].x += 4; if( s_AAy ) gs.gsvertex[last].y += 4; @@ -751,19 +751,19 @@ void ZeroGS::KickSprite() //return; VertexGPU* p = curvb.pBufferData+curvb.nCount; - + SetKickVertex(&p[0], gs.gsvertex[last], next, curvb); SetKickVertex(&p[3], gs.gsvertex[last], next, curvb); SetKickVertex(&p[1], gs.gsvertex[last], last, curvb); SetKickVertex(&p[4], gs.gsvertex[last], last, curvb); SetKickVertex(&p[2], gs.gsvertex[last], next, curvb); - + p[2].s = p[1].s; p[2].x = p[1].x; SetKickVertex(&p[5], gs.gsvertex[last], last, curvb); p[5].s = p[0].s; - p[5].x = p[0].x; + p[5].x = p[0].x; curvb.nCount += 6; @@ -830,12 +830,12 @@ void ZeroGS::ExtWrite() // case 6: ASSERT(0); return false; // ffx2 menu // case 7: ASSERT(0); return false; // default: __assume(0); - + bool IsDirty(u32 highdword, u32 psm, int cld, int cbp) { int cpsm = ZZOglGet_cpsm_TexBits(highdword); int csm = ZZOglGet_csm_TexBits(highdword); - + if (cpsm > 1 || csm) { // Mana Khemia triggers this. @@ -885,7 +885,7 @@ Start: movq mm7, [edx+56] pcmpeqd mm6, [ecx+40] pcmpeqd mm7, [ecx+56] - + pand mm0, mm4 pand mm6, mm7 pand mm0, mm6 @@ -902,11 +902,11 @@ Continue: test ebx, 0x10 jz AddEcx - sub ecx, 448 // go back and down one column, + sub ecx, 448 // go back and down one column, AddEcx: add ecx, 256 // go to the right block - + jne Continue1 add ecx, 256 // skip whole block Continue1: @@ -991,7 +991,7 @@ bool ZeroGS::CheckChangeInClut(u32 highdword, u32 psm) FUNCLOG int cld = ZZOglGet_cld_TexBits(highdword); int cbp = ZZOglGet_cbp_TexBits(highdword); - + // processing the CLUT after tex0/2 are written //ERROR_LOG("high == 0x%x; cld == %d\n", highdword, cld); switch(cld) { @@ -1020,9 +1020,9 @@ void ZeroGS::texClutWrite(int ctx) tex0Info& tex0 = vb[ctx].tex0; assert( PSMT_ISCLUT(tex0.psm) ); - + // processing the CLUT after tex0/2 are written - switch(tex0.cld) + switch(tex0.cld) { case 0: return; case 1: break; // tex0.cld is usually 1. @@ -1044,7 +1044,7 @@ void ZeroGS::texClutWrite(int ctx) int entries = PSMT_IS8CLUT(tex0.psm) ? 256 : 16; - if (tex0.csm) + if (tex0.csm) { switch (tex0.cpsm) { @@ -1055,33 +1055,33 @@ void ZeroGS::texClutWrite(int ctx) u16* src = (u16*)g_pbyGSMemory + tex0.cbp*128; u16 *dst = (u16*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0)); - for (int i = 0; i < entries; ++i) + for (int i = 0; i < entries; ++i) { *dst = src[getPixelAddress16_0(gs.clut.cou+i, gs.clut.cov, gs.clut.cbw)]; dst += 2; - + // check for wrapping if (((u32)(uptr)dst & 0x3ff) == 0) dst = (u16*)(g_pbyGSClut+2); } break; } - + case PSMCT16S: { u16* src = (u16*)g_pbyGSMemory + tex0.cbp*128; u16 *dst = (u16*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0)); - for (int i = 0; i < entries; ++i) + for (int i = 0; i < entries; ++i) { *dst = src[getPixelAddress16S_0(gs.clut.cou+i, gs.clut.cov, gs.clut.cbw)]; dst += 2; - + // check for wrapping if (((u32)(uptr)dst & 0x3ff) == 0) dst = (u16*)(g_pbyGSClut+2); } break; } - + case PSMCT32: case PSMCT24: { @@ -1089,17 +1089,17 @@ void ZeroGS::texClutWrite(int ctx) u32 *dst = (u32*)(g_pbyGSClut+64*tex0.csa); // check if address exceeds src - if( src+getPixelAddress32_0(gs.clut.cou+entries-1, gs.clut.cov, gs.clut.cbw) >= (u32*)g_pbyGSMemory + 0x00100000 ) + if( src+getPixelAddress32_0(gs.clut.cou+entries-1, gs.clut.cov, gs.clut.cbw) >= (u32*)g_pbyGSMemory + 0x00100000 ) ERROR_LOG("texClutWrite out of bounds\n"); - else - for(int i = 0; i < entries; ++i) + else + for(int i = 0; i < entries; ++i) { *dst = src[getPixelAddress32_0(gs.clut.cou+i, gs.clut.cov, gs.clut.cbw)]; dst++; } break; } - + default: { #ifndef RELEASE_TO_PUBLIC @@ -1109,7 +1109,7 @@ void ZeroGS::texClutWrite(int ctx) } } } - else + else { switch (tex0.cpsm) { @@ -1117,17 +1117,17 @@ void ZeroGS::texClutWrite(int ctx) case PSMCT32: if( entries == 16 ) WriteCLUT_T32_I4_CSM1((u32*)(g_pbyGSMemory + tex0.cbp*256), (u32*)(g_pbyGSClut+64*tex0.csa)); - else + else WriteCLUT_T32_I8_CSM1((u32*)(g_pbyGSMemory + tex0.cbp*256), (u32*)(g_pbyGSClut+64*tex0.csa)); break; - + default: if( entries == 16 ) WriteCLUT_T16_I4_CSM1((u32*)(g_pbyGSMemory + 256 * tex0.cbp), (u32*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0))); else // sse2 for 256 is more complicated, so use regular WriteCLUT_T16_I8_CSM1_c((u32*)(g_pbyGSMemory + 256 * tex0.cbp), (u32*)(g_pbyGSClut+32*(tex0.csa&15)+(tex0.csa>=16?2:0))); break; - + } } } diff --git a/plugins/zzogl-pg/opengl/zerogs.h b/plugins/zzogl-pg/opengl/zerogs.h index fb72085776..21e019c0ce 100644 --- a/plugins/zzogl-pg/opengl/zerogs.h +++ b/plugins/zzogl-pg/opengl/zerogs.h @@ -116,7 +116,7 @@ using namespace std; ZeroGS::HandleGLError(); \ } \ } - + #ifdef _DEBUG # define GL_REPORT_ERRORD() \ { \ @@ -175,7 +175,7 @@ extern void ZZcgSetParameter4fv(CGparameter param, const float* v, const char* n #define VB_BUFFERSIZE 0x400 // Used in logaripmic Z-test, as (1-o(1))/log(MAX_U32). -const float g_filog32 = 0.999f / (32.0f * logf(2.0f)); +const float g_filog32 = 0.999f / (32.0f * logf(2.0f)); //------------------------ Inlines ------------------------- @@ -204,8 +204,8 @@ inline const char *error_name(int err) { // inline for extemely ofthen used sequence // This is turning off all gl functions. Safe to do updates. -inline void -DisableAllgl () { +inline void +DisableAllgl () { glDisable(GL_SCISSOR_TEST); glDisable(GL_BLEND); glDisable(GL_ALPHA_TEST); @@ -217,7 +217,7 @@ DisableAllgl () { // Calculate maximum height for target inline int -get_maxheight(int fbp, int fbw, int psm) +get_maxheight(int fbp, int fbw, int psm) { int ret; @@ -239,7 +239,7 @@ nNeedAlpha(u8 psm) { // Get color storage model psm, that is important on flush stage. inline u8 GetTexCPSM(const tex0Info& tex) { - if (PSMT_ISCLUT(tex.psm)) + if (PSMT_ISCLUT(tex.psm)) return tex.cpsm; else return tex.psm; @@ -261,7 +261,7 @@ struct FRAGMENTSHADER FRAGMENTSHADER() : prog(0), sMemory(0), sFinal(0), sBitwiseANDX(0), sBitwiseANDY(0), sInterlace(0), sCLUT(0), sOneColor(0), sBitBltZ(0), fTexAlpha2(0), fTexOffset(0), fTexDims(0), fTexBlock(0), fClampExts(0), fTexWrapMode(0), fRealTexDims(0), fTestBlack(0), fPageOffset(0), fTexAlpha(0) {} - + CGprogram prog; CGparameter sMemory, sFinal, sBitwiseANDX, sBitwiseANDY, sInterlace, sCLUT; CGparameter sOneColor, sBitBltZ, sInvTexDims; @@ -276,13 +276,13 @@ struct FRAGMENTSHADER p = cgGetNamedParameter(prog, name); if (p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE) var = p; } - + bool set_texture(GLuint texobj, const char *name) { CGparameter p; - + p = cgGetNamedParameter(prog, name); - if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) + if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) { cgGLSetTextureParameter(p, texobj); cgGLEnableTextureParameter(p); @@ -290,26 +290,26 @@ struct FRAGMENTSHADER } return false; } - + bool connect(CGparameter &tex, const char *name) { CGparameter p; - + p = cgGetNamedParameter(prog, name); - if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) + if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) { cgConnectParameter(tex, p); return true; } return false; } - + bool set_texture(CGparameter &tex, const char *name) { CGparameter p; - + p = cgGetNamedParameter(prog, name); - if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) + if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) { //cgGLEnableTextureParameter(p); tex = p; @@ -317,14 +317,14 @@ struct FRAGMENTSHADER } return false; } - + bool set_shader_const(Vector v, const char *name) { CGparameter p; - + p = cgGetNamedParameter(prog, name); - - if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) + + if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) { cgGLSetParameter4fv(p, v); return true; @@ -354,7 +354,7 @@ extern HGLRC hRC; // Permanent Rendering Context extern bool g_bIsLost; // Context is lost -- could not draw extern u32 ptexBlocks; // holds information on block tiling -extern u32 ptexConv16to32; +extern u32 ptexConv16to32; extern u32 ptexBilinearBlocks; extern u32 ptexConv32to16; extern int g_MaxTexWidth, g_MaxTexHeight; @@ -372,7 +372,7 @@ extern int s_nWriteDestAlphaTest; ////////////////////////// // State parameters -extern float fiRendWidth, fiRendHeight; +extern float fiRendWidth, fiRendHeight; extern int g_PrevBitwiseTexX, g_PrevBitwiseTexY; // textures stored in SAMP_BITWISEANDX and SAMP_BITWISEANDY extern bool s_bDestAlphaTest; extern int s_ClutResolve; @@ -392,7 +392,7 @@ extern char* EFFECT_DIR; extern u32 g_nGenVars, g_nTexVars, g_nAlphaVars, g_nResolve; extern bool g_bSaveTrans, g_bUpdateEffect, g_bSaveTex, g_bSaveResolved; -#endif +#endif extern RasterFont* font_p; extern u32 s_uFramebuffer; @@ -473,15 +473,15 @@ extern u8* g_pbyGSClut; // the temporary clut buffer extern CGparameter g_vparamPosXY[2], g_fparamFogColor; namespace ZeroGS { - + typedef void (*DrawFn)(); - + enum RenderFormatType { RFT_byte8 = 0, // A8R8G8B8 RFT_float16 = 1, // A32R32B32G32 }; - + // managers render-to-texture targets class CRenderTarget { @@ -491,48 +491,48 @@ namespace ZeroGS { virtual bool Create(const frameInfo& frame); virtual void Destroy(); - + // set the GPU_POSXY variable, scissor rect, and current render target void SetTarget(int fbplocal, const Rect2& scissor, int context); void SetViewport(); - + // copies/creates the feedback contents inline void CreateFeedback() { if( ptexFeedback == 0 || !(status&TS_FeedbackReady) ) _CreateFeedback(); } - + virtual void Resolve(); virtual void Resolve(int startrange, int endrange); // resolves only in the allowed range virtual void Update(int context, CRenderTarget* pdepth); virtual void ConvertTo32(); // converts a psm==2 target, to a psm==0 virtual void ConvertTo16(); // converts a psm==0 target, to a psm==2 - + virtual bool IsDepth() { return false; } void SetRenderTarget(int targ); - + void* psys; // system data used for comparison u32 ptex; - + int fbp, fbw, fbh, fbhCalc; // if fbp is negative, virtual target (not mapped to any real addr) int start, end; // in bytes u32 lastused; // time stamp since last used Vector vposxy; - + u32 fbm; u16 status; u8 psm; u8 resv0; Rect scissorrect; - u8 created; // Check for object destruction/creating for r201. - + u8 created; // Check for object destruction/creating for r201. + //int startresolve, endresolve; u32 nUpdateTarg; // use this target to update the texture if non 0 (one time only) - + // this is optionally used when feedback effects are used (render target is used as a texture when rendering to itself) u32 ptexFeedback; - + enum TargetStatus { TS_Resolved = 1, TS_NeedUpdate = 2, @@ -545,32 +545,32 @@ namespace ZeroGS { inline Vector DefaultBitBltTex() ; private: void _CreateFeedback(); - inline bool InitialiseDefaultTexture ( u32 *p_ptr, int fbw, int fbh ) ; + inline bool InitialiseDefaultTexture ( u32 *p_ptr, int fbw, int fbh ) ; }; - + // manages zbuffers class CDepthTarget : public CRenderTarget { public: CDepthTarget(); virtual ~CDepthTarget(); - + virtual bool Create(const frameInfo& frame); virtual void Destroy(); - + virtual void Resolve(); virtual void Resolve(int startrange, int endrange); // resolves only in the allowed range virtual void Update(int context, CRenderTarget* prndr); - + virtual bool IsDepth() { return true; } - + void SetDepthStencilSurface(); - + u32 pdepth; // 24 bit, will contain the stencil buffer if possible u32 pstencil; // if not 0, contains the stencil buffer int icount; // internal counter }; - + // manages contiguous chunks of memory (width is always 1024) class CMemoryTarget { @@ -580,12 +580,12 @@ namespace ZeroGS { inline TEXTURE() : tex(0), memptr(NULL), ref(0) {} inline ~TEXTURE() { glDeleteTextures(1, &tex); _aligned_free(memptr); } u32 tex; - u8* memptr; // GPU memory used for comparison + u8* memptr; // GPU memory used for comparison int ref; }; - + inline CMemoryTarget() : ptex(NULL), starty(0), height(0), realy(0), realheight(0), usedstamp(0), psm(0), cpsm(0), channels(0), clearminy(0), clearmaxy(0), validatecount(0) {} - + inline CMemoryTarget(const CMemoryTarget& r) { ptex = r.ptex; if( ptex != NULL ) ptex->ref++; @@ -604,53 +604,53 @@ namespace ZeroGS { validatecount = r.validatecount; fmt = r.fmt; } - + ~CMemoryTarget() { Destroy(); } - + inline void Destroy() { if( ptex != NULL && ptex->ref > 0 ) { if( --ptex->ref <= 0 ) delete ptex; } - + ptex = NULL; } - + // returns true if clut data is synced bool ValidateClut(const tex0Info& tex0); // returns true if tex data is synced bool ValidateTex(const tex0Info& tex0, int starttex, int endtex, bool bDeleteBadTex); - + // realy is offset in pixels from start of valid region // so texture in memory is [realy,starty+height] // valid texture is [starty,starty+height] // offset in mem [starty-realy, height] TEXTURE* ptex; // can be 16bit - + int starty, height; // assert(starty >= realy) int realy, realheight; // this is never touched once allocated u32 usedstamp; u8 psm, cpsm; // texture and clut format. For psm, only 16bit/32bit differentiation matters u32 fmt; - + int widthmult; int channels; int clearminy, clearmaxy; // when maxy > 0, need to check for clearing int validatecount; // count how many times has been validated, if too many, destroy - + vector clut; // if nonzero, texture uses CLUT }; - - + + struct VB { VB(); ~VB(); - + void Destroy(); - + inline bool CheckPrim() { static const int PRIMMASK = 0x0e; // for now ignore 0x10 (AA) if( (PRIMMASK & prim->_val) != (PRIMMASK & curprim._val) || primtype[prim->prim] != primtype[curprim.prim] ) @@ -659,7 +659,7 @@ namespace ZeroGS { } void CheckFrame(int tbp); - + // context specific state Point offset; Rect2 scissor; @@ -672,7 +672,7 @@ namespace ZeroGS { clampInfo clamp; pixTest test; u32 ptexClamp[2]; // textures for x and y dir region clamping - + public: void FlushTexData(); inline int CheckFrameAddConstraints(int tbp); @@ -683,9 +683,9 @@ namespace ZeroGS { inline int FindMinimalHeightConstrain(int maxpos); inline int CheckFrameResolveRender(int tbp); - inline void CheckFrame16vs32Convesion(); + inline void CheckFrame16vs32Convesion(); inline int CheckFrameResolveDepth(int tbp); - + inline void FlushTexUnchangedClutDontUpdate() ; inline void FlushTexClutDontUpdate() ; inline void FlushTexClutting() ; @@ -706,7 +706,7 @@ namespace ZeroGS { } } - void Init(int nVerts) { + void Init(int nVerts) { if( pBufferData == NULL && nVerts > 0 ) { pBufferData = (VertexGPU*)_aligned_malloc(sizeof(VertexGPU)*nVerts, 256); nNumVertices = nVerts; @@ -719,7 +719,7 @@ namespace ZeroGS { u8 bNeedZCheck; u8 bNeedTexCheck; u8 dummy0; - + union { struct { u8 bTexConstsSync; // only pixel shader constants that context owns @@ -729,21 +729,21 @@ namespace ZeroGS { }; u32 bSyncVars; }; - + int ictx; VertexGPU* pBufferData; // current allocated data int nNumVertices; // size of pBufferData in terms of VertexGPU objects int nCount; primInfo curprim; // the previous prim the current buffers are set to - + zbufInfo zbuf; frameInfo gsfb; // the real info set by FRAME cmd frameInfo frame; int zprimmask; // zmask for incoming points u32 uCurTex0Data[2]; // current tex0 data - u32 uNextTex0Data[2]; // tex0 data that has to be applied if bNeedTexCheck is 1 + u32 uNextTex0Data[2]; // tex0 data that has to be applied if bNeedTexCheck is 1 //int nFrameHeights[8]; // frame heights for the past frame changes int nNextFrameHeight; @@ -756,7 +756,7 @@ namespace ZeroGS { // Return, if tcc, aem or psm mode told us, than Alpha test should be used // if tcc == 0 than no alpha used, aem used for alpha expanding and I am not sure // that it's correct, psm -- color mode, - inline bool + inline bool IsAlphaTestExpansion(VB& curvb){ return (curvb.tex0.tcc && gs.texa.aem && nNeedAlpha(GetTexCPSM(curvb.tex0))); } @@ -772,7 +772,7 @@ namespace ZeroGS { extern int g_nCurVBOIndex; // Shaders variables - extern Vector g_vdepth; + extern Vector g_vdepth; extern Vector vlogz; extern VERTEXSHADER pvsBitBlt; extern FRAGMENTSHADER ppsBitBlt[2], ppsBitBltDepth, ppsOne; @@ -861,7 +861,7 @@ namespace ZeroGS { void FlushSysMem(const RECT* prc); void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, bool mode); - // returns the first and last addresses aligned to a page that cover + // returns the first and last addresses aligned to a page that cover void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw); // inits the smallest rectangle in ptexMem that covers this region in ptexMem @@ -882,13 +882,13 @@ namespace ZeroGS { void CaptureFrame(); // Perform clutting for flushed texture. Better check if it need prior call - inline void + inline void CluttingForFlushedTex(tex0Info* tex0, u32 Data, int ictx) { tex0->cbp = ZZOglGet_cbp_TexBits(Data); tex0->cpsm = ZZOglGet_cpsm_TexBits(Data); tex0->csm = ZZOglGet_csm_TexBits(Data); tex0->csa = ZZOglGet_csa_TexBits(Data); - tex0->cld = ZZOglGet_cld_TexBits(Data); + tex0->cld = ZZOglGet_cld_TexBits(Data); ZeroGS::texClutWrite(ictx); } diff --git a/plugins/zzogl-pg/opengl/zerogsmath.h b/plugins/zzogl-pg/opengl/zerogsmath.h index 83481ffb5b..dbfef2085b 100644 --- a/plugins/zzogl-pg/opengl/zerogsmath.h +++ b/plugins/zzogl-pg/opengl/zerogsmath.h @@ -76,7 +76,7 @@ public: inline Vector& operator += (const Vector& r) { x += r.x; y += r.y; z += r.z; w += r.w; return *this; } inline Vector& operator -= (const Vector& r) { x -= r.x; y -= r.y; z -= r.z; w -= r.w; return *this; } inline Vector& operator *= (const Vector& r) { x *= r.x; y *= r.y; z *= r.z; w *= r.w; return *this; } - + inline Vector& operator *= (const dReal k) { x *= k; y *= k; z *= k; w *= k; return *this; } inline Vector& operator /= (const dReal _k) { dReal k=1/_k; x *= k; y *= k; z *= k; w *= k; return *this; } @@ -115,7 +115,7 @@ struct TRIANGLE const Vector& operator[](int i) const { return (&v1)[i]; } Vector& operator[](int i) { return (&v1)[i]; } - /// assumes CCW ordering of vertices + /// assumes CCW ordering of vertices inline Vector ComputeNormal() { Vector normal; cross3(normal, v2-v1, v3-v1); @@ -200,7 +200,7 @@ inline T* multtrans(T* pf1, R* pf2, int r1, int c1, int c2, S* pfres, bool badd template inline T* multtrans_to2(T* pf1, R* pf2, int r1, int c1, int r2, S* pfres, bool badd = false); -// multiplies rxc matrix pf1 and cxc matrix pf2 and stores the result in pf1, +// multiplies rxc matrix pf1 and cxc matrix pf2 and stores the result in pf1, // the function needs a temporary buffer the size of c doubles, if pftemp == NULL, // the function will allocate the necessary memory, otherwise pftemp should be big // enough to store all the entries @@ -242,7 +242,7 @@ bool eig2(const dReal* pfmat, dReal* peigs, dReal& fv1x, dReal& fv1y, dReal& fv2 fv2x = -fv1y; fv2y = fv1x; return true; } - + // two roots d = sqrtf(d); a = -0.5f * (b + d); @@ -290,7 +290,7 @@ template inline T* _mult3(T* pfres, const T* pf1, const T* pf2) inline dReal* mult3(dReal* pfres, const dReal* pf1, const dReal* pf2) { return _mult3(pfres, pf1, pf2); } inline double* mult3(double* pfres, const double* pf1, const double* pf2) { return _mult3(pfres, pf1, pf2); } -template +template inline T* _mult4(T* pfres, const T* p1, const T* p2) { assert( pfres != NULL && p1 != NULL && p2 != NULL ); @@ -326,7 +326,7 @@ inline T* _mult4(T* pfres, const T* p1, const T* p2) inline dReal* mult4(dReal* pfres, const dReal* pf1, const dReal* pf2) { return _mult4(pfres, pf1, pf2); } inline double* mult4(double* pfres, const double* pf1, const double* pf2) { return _mult4(pfres, pf1, pf2); } -template +template inline T* _multtrans3(T* pfres, const T* pf1, const T* pf2) { T* pfres2; @@ -350,7 +350,7 @@ inline T* _multtrans3(T* pfres, const T* pf1, const T* pf2) return pfres; } -template +template inline T* _multtrans4(T* pfres, const T* pf1, const T* pf2) { T* pfres2; @@ -737,7 +737,7 @@ template inline T* multto1(T* pf1, T* pf2, int r, int c, T* pftemp) int j, k; bool bdel = false; - + if( pftemp == NULL ) { pftemp = new T[c]; bdel = true; @@ -748,7 +748,7 @@ template inline T* multto1(T* pf1, T* pf2, int r, int c, T* pftemp) j = 0; while(j < c) { - + pftemp[j] = 0.0; k = 0; @@ -774,7 +774,7 @@ template inline T* multto2(T* pf1, S* pf2, int r2, int c2, S* int i, j, k; bool bdel = false; - + if( pftemp == NULL ) { pftemp = new S[r2]; bdel = true; @@ -785,7 +785,7 @@ template inline T* multto2(T* pf1, S* pf2, int r2, int c2, S* while(j < c2) { i = 0; while(i < r2) { - + pftemp[i] = 0.0; k = 0; diff --git a/plugins/zzogl-pg/opengl/zpipe.cpp b/plugins/zzogl-pg/opengl/zpipe.cpp index 703ab487b8..15eb93f16a 100644 --- a/plugins/zzogl-pg/opengl/zpipe.cpp +++ b/plugins/zzogl-pg/opengl/zpipe.cpp @@ -34,10 +34,10 @@ int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed strm.next_in = (Bytef *)src ; strm.next_out = (Bytef *)dst ; - ret = deflate(&strm, Z_FINISH) ; + ret = deflate(&strm, Z_FINISH) ; have = bytes_to_compress - strm.avail_out ; *bytes_after_compressed = have ; - + assert(ret == Z_STREAM_END); /* stream will be complete */ /* clean up and return */ @@ -45,7 +45,7 @@ int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed return Z_OK; } -int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes) +int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes) { z_stream strm; @@ -78,7 +78,7 @@ int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompr (void)inflateEnd(&strm); return ret; } - + assert(strm.avail_in == 0); /* all input will be used */ if( outbytes != NULL )