Fix a segfault issue in ConvertTo16 on ZeroGS, and make a few changes in spu2-x for later use.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@631 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-02-28 08:00:56 +00:00
parent b66db6ffd3
commit 0fb4e4ea07
10 changed files with 131 additions and 36 deletions

View File

@ -0,0 +1,60 @@
/* ZeroSPU2
* Copyright (C) 2006-2007 zerofrog
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Modified by arcum42@gmail.com
#ifndef __LINUX_H__
#define __LINUX_H__
#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/soundcard.h>
#include <unistd.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 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
#define ALSA_PCM_NEW_SW_PARAMS_API
#ifdef ALSA_MEM_DEF
#define ALSA_MEM_EXTERN
#else
#define ALSA_MEM_EXTERN extern
#endif
#define SOUNDSIZE 500000
#define SAMPLE_RATE 48000L
#define ERROR_LOG printf
// Pull in from Alsa.cpp
extern int AlsaSetupSound();
extern void AlsaRemoveSound();
extern int AlsaSoundGetBytesBuffered();
extern void AlsaSoundFeedVoiceData(unsigned char* pSound,long lBytes);
extern int SetupSound();
extern void RemoveSound();
extern int SoundGetBytesBuffered();
extern void SoundFeedVoiceData(unsigned char* pSound,long lBytes);
#endif // __LINUX_H__

View File

@ -22,6 +22,36 @@
#include "Spu2.h"
#include "Dialogs.h"
bool DebugEnabled=false;
bool _MsgToConsole=false;
bool _MsgKeyOnOff=false;
bool _MsgVoiceOff=false;
bool _MsgDMA=false;
bool _MsgAutoDMA=false;
bool _MsgOverruns=false;
bool _MsgCache=false;
bool _AccessLog=false;
bool _DMALog=false;
bool _WaveLog=false;
bool _CoresDump=false;
bool _MemDump=false;
bool _RegDump=false;
wchar_t AccessLogFileName[255];
wchar_t WaveLogFileName[255];
wchar_t DMA4LogFileName[255];
wchar_t DMA7LogFileName[255];
wchar_t CoresDumpFileName[255];
wchar_t MemDumpFileName[255];
wchar_t RegDumpFileName[255];
#ifdef SPU2X_DEVBUILD
static const int LATENCY_MAX = 3000;
#else

View File

@ -154,9 +154,9 @@ struct CONFIG_WAVEOUT
}
};
extern CONFIG_DSOUNDOUT Config_DSoundOut;
/*extern CONFIG_DSOUNDOUT Config_DSoundOut;
extern CONFIG_WAVEOUT Config_WaveOut;
extern CONFIG_XAUDIO2 Config_XAudio2;
extern CONFIG_XAUDIO2 Config_XAudio2;*/
//////

View File

@ -22,6 +22,6 @@
#ifndef DIALOG_H_INCLUDED
#define DIALOG_H_INCLUDED
#include "../spu2.h"
#include "../Spu2.h"
#endif

View File

@ -1,7 +1,7 @@
# Create a shared library libSPU2X
AUTOMAKE_OPTIONS = foreign
noinst_LIBRARIES = libSPU2X.a
INCLUDES = -I@srcdir@/common -I@srcdir@/3rdparty -I@srcdir@/Linux
INCLUDES = -I@srcdir@/../../../common/include -I@srcdir@/3rdparty -I@srcdir@/../../../3rdparty -I@srcdir@/Linux
libSPU2X_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0)
libSPU2X_a_CFLAGS = $(shell pkg-config --cflags gtk+-2.0)
@ -22,10 +22,10 @@ EXEEXT=$(preext)@so_ext@
traplib_PROGRAMS=libSPU2X
libSPU2X_SOURCES=
libSPU2X_DEPENDENCIES = libSPU2X.a 3rdparty/SoundTouch/libSoundTouch.a
libSPU2X_DEPENDENCIES = libSPU2X.a libSoundTouch.a
libSPU2X_LDFLAGS= @SHARED_LDFLAGS@
libSPU2X_LDFLAGS+=-Wl,-soname,@SPU2X_SONAME@
libSPU2X_LDADD=$(llibSPU2X_a_OBJECTS) 3rdparty/SoundTouch/libSoundTouch.a
libSPU2X_LDADD=$(libSPU2X_a_OBJECTS) libSoundTouch.a
libSPU2X_a_SOURCES = ADSR.cpp DllInterface.cpp Mixer.cpp RegTable.cpp SaveStateSPU.cpp ConvertUTF.cpp \
Spu2.cpp Timestretcher.cpp utf8.cpp Debug.cpp Decoder.cpp \
@ -33,6 +33,6 @@ Dma.cpp Lowpass.cpp RegLog.cpp Reverb.cpp SndOut.cpp Spu2replay.cpp Wavedump_w
libSPU2X_a_SOURCES += BaseTypes.h Debug.h Dma.h Lowpass.h RegTable.h SndOut.h ConvertUTF.h \
Spu2.h Spu2replay.h defs.h regs.h spdif.h utf8.h
libSPU2X_a_SOURCES += Linux/Config.h Linux/Config.cpp Linux/Linux.h Linux/Alsa.cpp Linux/Alsa.h Linux/Dialogs.cpp Linux/Dialogs.h
libSPU2X_a_SOURCES += Linux/Config.h Linux/Config.cpp Linux/ConfigSoundTouch.cpp Linux/Linux.h Linux/Alsa.cpp Linux/Alsa.h Linux/Dialogs.cpp Linux/Dialogs.h
SUBDIRS = 3rdparty/SoundTouch
#SUBDIRS = 3rdparty/SoundTouch

View File

@ -91,9 +91,11 @@ public:
SndOutModule* mods[]=
{
&NullOut,
#ifdef _MSC_VER
XAudio2Out,
DSoundOut,
WaveOut,
#endif
NULL // signals the end of our list
};

View File

@ -374,10 +374,12 @@ public:
};
#ifdef _MSC_VER
//internal
extern SndOutModule* WaveOut;
extern SndOutModule* DSoundOut;
extern SndOutModule* XAudio2Out;
#endif
extern SndOutModule* mods[];

View File

@ -2,6 +2,21 @@
curdir=`pwd`
echo
echo SPU2-X is Windows only. Aborting.
if [ 1 == 0 ]
then
if [ $# -gt 0 ] && [ $1 = "all" ]
then
cd ../../../3rdparty/SoundTouch/
sh build.sh $@
cd $curdir
rm libSoundTouch.a
cp ../../../3rdparty/SoundTouch/libSoundTouch.a ./
echo
echo -----------------
echo Building SPU2-X
echo -----------------
@ -10,13 +25,6 @@ if test "${SPU2XOPTIONS+set}" != set ; then
export SPU2XOPTIONS=""
fi
echo SPU2-X is Windows only. Aborting.
if [ 1 == 0 ]
then
if [ $# -gt 0 ] && [ $1 = "all" ]
then
aclocal
automake -a
autoconf
@ -32,5 +40,5 @@ if [ $? -ne 0 ]
then
exit 1
fi
#cp libSPU2X*.so* ${PCSX2PLUGINS}
fi
#cp libSPU2X*.so* ${PCSX2PLUGINS}

View File

@ -12,17 +12,11 @@ AC_PROG_RANLIB
dnl necessary for compiling assembly
AM_PROG_AS
SPU2X_CURRENT=0
SPU2X_REVISION=1
SPU2X_AGE=0
SPU2X_SONAME=libSPU2X.so.[$SPU2X_CURRENT].[$SPU2X_REVISION].[$SPU2X_AGE]
SPU2X_RELEASE=[$SPU2X_CURRENT].[$SPU2X_REVISION].[$SPU2X_AGE]
AC_SUBST(SPU2X_CURRENT)
AC_SUBST(SPU2X_REVISION)
AC_SUBST(SPU2X_AGE)
AC_SUBST(SPU2X_RELEASE)
AC_SUBST(SPU2X_SONAME)
AC_SUBST(SPU2X_CURRENT, 0)
AC_SUBST(SPU2X_REVISION, 1)
AC_SUBST(SPU2X_AGE, 0)
AC_SUBST(SPU2X_RELEASE,[$SPU2X_CURRENT].[$SPU2X_REVISION].[$SPU2X_AGE])
AC_SUBST(SPU2X_SONAME,libSPU2X.so.[$SPU2X_CURRENT].[$SPU2X_REVISION].[$SPU2X_AGE])
CFLAGS=
CPPFLAGS=
@ -66,9 +60,6 @@ dnl gtk
AC_MSG_CHECKING(gtk2+)
AC_CHECK_PROG(GTK_CONFIG, pkg-config, pkg-config)
LIBS+=$(pkg-config --libs gtk+-2.0)
dnl bindir = pcsx2exe
dnl Check for 64bit CPU
AC_MSG_CHECKING(for a x86-64 CPU)
dnl if test "$build_os" == "target_os"
@ -96,19 +87,20 @@ fi
AC_MSG_RESULT($cpu64)
AM_CONDITIONAL(X86_64, test x$cpu64 = xyes)
dnl bindir = pcsx2exe
dnl assuming linux environment
so_ext=".so.$SPU2X_RELEASE"
SHARED_LDFLAGS="-shared"
AC_SUBST(so_ext)
AC_SUBST(SHARED_LDFLAGS)
AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [ have_iconv="0" ])
AC_CHECK_LIB(stdc++,main,[LIBS="$LIBS -lstdc++"])
AC_CHECK_LIB(dl,main,[LIBS="$LIBS -ldl"])
AC_CHECK_LIB(asound,main,[LIBS="$LIBS -lasound"])
AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [ have_iconv="0" ])
AC_OUTPUT([
3rdparty/SoundTouch/Makefile
Makefile
])

View File

@ -333,9 +333,10 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
cgGLEnableTextureParameter(ppsBaseTexture.sFinal);
//assert( ittarg->second->fbw == fbw );
int offset = (fbp-ittarg->second->fbp)*64/fbw;
if( psm & 2 ) // 16 bit
offset *= 2;
int offset = (fbp-ittarg->second->fbp)*64/fbw;
// 16 bit
if (psm & 2) offset *= 2;
v.x = (float)(fbw << s_AAx);
v.y = (float)(fbh << s_AAy);
@ -667,7 +668,7 @@ void ZeroGS::CRenderTarget::ConvertTo16()
SAFE_RELEASE_TEX(ptexFeedback);
ptex = ptexConv;
free(psys);
_aligned_free(psys);
psys = _aligned_malloc( (fbh<<s_AAy) * (fbw<<s_AAx) * (GetRenderFormat() == RFT_float16 ? 8 : 4), 16 );
if( conf.options & GSOPTION_WIREFRAME ) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);