From 0b3c069d3b5887a7b19d612d419b4397f53c40e4 Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Wed, 29 Dec 2010 02:39:14 +0000 Subject: - dfsound (unix): Added mute option and freqresponse to the config utility. - gxvideo: Fixed FTBFS. - Fixed Run BIOS (Issue #7806). - Updated gettext scripts. - Credit where it's due. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@61576 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- plugins/dfsound/cfg.c | 7 +- plugins/dfsound/spu.c | 808 ++++++++++++------------- plugins/dfsound/spucfg-0.1df/dfsound.glade2 | 15 +- plugins/dfsound/spucfg-0.1df/main.c | 20 +- plugins/dfxvideo/draw.c | 7 +- plugins/gxvideo/draw.h | 1 + plugins/peopsxgl/gpucfg/gpucfg-newstyle2.glade | 71 ++- 7 files changed, 509 insertions(+), 420 deletions(-) (limited to 'plugins') diff --git a/plugins/dfsound/cfg.c b/plugins/dfsound/cfg.c index 70e06685..9414eee5 100644 --- a/plugins/dfsound/cfg.c +++ b/plugins/dfsound/cfg.c @@ -112,7 +112,7 @@ void ReadConfigFile(void) strcpy(t,"\nVolume");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} if(p) iVolume=4-atoi(p+len); if(iVolume<1) iVolume=1; - if(iVolume>4) iVolume=4; + if(iVolume>5) iVolume=5; strcpy(t,"\nXAPitch");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} if(p) iXAPitch=atoi(p+len); @@ -145,6 +145,11 @@ void ReadConfigFile(void) if(p) iDisStereo=atoi(p+len); if(iDisStereo<0) iDisStereo=0; if(iDisStereo>1) iDisStereo=1; + + strcpy(t,"\nFreqResponse");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} + if(p) iFreqResponse=atoi(p+len); + if(iFreqResponse<0) iFreqResponse=0; + if(iFreqResponse>1) iFreqResponse=1; free(pB); } diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index 7cb81265..9e9f1bbb 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -23,11 +23,11 @@ #include "cfg.h" #include "dsoundoss.h" #include "regs.h" - -#ifdef _WINDOWS -#include "debug.h" -#include "record.h" -#endif + +#ifdef _WINDOWS +#include "debug.h" +#include "record.h" +#endif #ifdef ENABLE_NLS #include @@ -38,8 +38,8 @@ #define _(x) (x) #define N_(x) (x) #endif - -#if defined (_WINDOWS) + +#if defined (_WINDOWS) static char * libraryName = N_("DirectSound Driver"); #elif defined (USEMACOSX) static char * libraryName = N_("Mac OS X Sound"); @@ -79,16 +79,16 @@ int iRecordMode=0; int iUseReverb=2; int iUseInterpolation=2; int iDisStereo=0; -int iFreqResponse=0; +int iFreqResponse=0; // MAIN infos struct for each channel SPUCHAN s_chan[MAXCHAN+1]; // channel + 1 infos (1 is security for fmod handling) REVERBInfo rvb; -unsigned long dwNoiseVal=1; // global noise generator -unsigned long dwNoiseCount; // global noise generator -unsigned long dwNoiseClock; // global noise generator +unsigned long dwNoiseVal=1; // global noise generator +unsigned long dwNoiseCount; // global noise generator +unsigned long dwNoiseClock; // global noise generator int iSpuAsyncWait=0; unsigned short spuCtrl=0; // some vars to store psx reg infos @@ -99,15 +99,15 @@ int bEndThread=0; // thread handlers int bThreadEnded=0; int bSpuInit=0; int bSPUIsOpen=0; - -#ifdef _WINDOWS -HWND hWMain=0; // window handle -HWND hWDebug=0; -HWND hWRecord=0; -static HANDLE hMainThread; + +#ifdef _WINDOWS +HWND hWMain=0; // window handle +HWND hWDebug=0; +HWND hWRecord=0; +static HANDLE hMainThread; #else static pthread_t thread = (pthread_t)-1; // thread id (linux) -#endif +#endif unsigned long dwNewChannel=0; // flags for faster testing, if new channel starts @@ -261,11 +261,11 @@ INLINE void StartSound(int ch) { StartADSR(ch); StartREVERB(ch); - + // fussy timing issues - do in VoiceOn //s_chan[ch].pCurr=s_chan[ch].pStart; // set sample start - //s_chan[ch].bStop=0; - //s_chan[ch].bOn=1; + //s_chan[ch].bStop=0; + //s_chan[ch].bOn=1; s_chan[ch].s_1=0; // init mixing vars s_chan[ch].s_2=0; @@ -319,102 +319,102 @@ INLINE void FModChangeFrequency(int ch,int ns) //////////////////////////////////////////////////////////////////////// -/* -Noise Algorithm -- Dr.Hell (Xebra PS1 emu) -- 100% accurate (waveform + frequency) -- http://drhell.web.fc2.com - - -Level change cycle -Freq = 0x8000 >> (NoiseClock >> 2); - -Frequency of half cycle -Half = ((NoiseClock & 3) * 2) / (4 + (NoiseClock & 3)); -- 0 = (0*2)/(4+0) = 0/4 -- 1 = (1*2)/(4+1) = 2/5 -- 2 = (2*2)/(4+2) = 4/6 -- 3 = (3*2)/(4+3) = 6/7 - -------------------------------- - -5*6*7 = 210 -4 - 0*0 = 0 -5 - 42*2 = 84 -6 - 35*4 = 140 -7 - 30*6 = 180 -*/ - -// Noise Waveform - Dr. Hell (Xebra) -char NoiseWaveAdd [64] = { - 1, 0, 0, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 1, 1, 0, - 0, 1, 1, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 1, 0, 0, 1 -}; - -unsigned short NoiseFreqAdd[5] = { - 0, 84, 140, 180, 210 -}; - -INLINE void NoiseClock() -{ - unsigned int level; - - level = 0x8000 >> (dwNoiseClock >> 2); - level <<= 16; - - dwNoiseCount += 0x10000; - - // Dr. Hell - fraction - dwNoiseCount += NoiseFreqAdd[ dwNoiseClock & 3 ]; - if( (dwNoiseCount&0xffff) >= NoiseFreqAdd[4] ) { - dwNoiseCount += 0x10000; - dwNoiseCount -= NoiseFreqAdd[ dwNoiseClock & 3 ]; - } - - if( dwNoiseCount >= level ) - { - while( dwNoiseCount >= level ) - dwNoiseCount -= level; - - // Dr. Hell - form - dwNoiseVal = (dwNoiseVal<<1) | NoiseWaveAdd[ (dwNoiseVal>>10) & 63 ]; - } -} - -INLINE int iGetNoiseVal(int ch) -{ - int fa; - - fa = (short) dwNoiseVal; - - // no clip need - //if(fa>32767L) fa=32767L; - //if(fa<-32767L) fa=-32767L; - - // don't upset VAG decoder - //if(iUseInterpolation<2) // no gauss/cubic interpolation? - //pChannel->SB[29] = fa; // -> store noise val in "current sample" slot - - // boost volume - no more! - //return fa * 3 / 2; - return fa; -} - +/* +Noise Algorithm +- Dr.Hell (Xebra PS1 emu) +- 100% accurate (waveform + frequency) +- http://drhell.web.fc2.com + + +Level change cycle +Freq = 0x8000 >> (NoiseClock >> 2); + +Frequency of half cycle +Half = ((NoiseClock & 3) * 2) / (4 + (NoiseClock & 3)); +- 0 = (0*2)/(4+0) = 0/4 +- 1 = (1*2)/(4+1) = 2/5 +- 2 = (2*2)/(4+2) = 4/6 +- 3 = (3*2)/(4+3) = 6/7 + +------------------------------- + +5*6*7 = 210 +4 - 0*0 = 0 +5 - 42*2 = 84 +6 - 35*4 = 140 +7 - 30*6 = 180 +*/ + +// Noise Waveform - Dr. Hell (Xebra) +char NoiseWaveAdd [64] = { + 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1 +}; + +unsigned short NoiseFreqAdd[5] = { + 0, 84, 140, 180, 210 +}; + +INLINE void NoiseClock() +{ + unsigned int level; + + level = 0x8000 >> (dwNoiseClock >> 2); + level <<= 16; + + dwNoiseCount += 0x10000; + + // Dr. Hell - fraction + dwNoiseCount += NoiseFreqAdd[ dwNoiseClock & 3 ]; + if( (dwNoiseCount&0xffff) >= NoiseFreqAdd[4] ) { + dwNoiseCount += 0x10000; + dwNoiseCount -= NoiseFreqAdd[ dwNoiseClock & 3 ]; + } + + if( dwNoiseCount >= level ) + { + while( dwNoiseCount >= level ) + dwNoiseCount -= level; + + // Dr. Hell - form + dwNoiseVal = (dwNoiseVal<<1) | NoiseWaveAdd[ (dwNoiseVal>>10) & 63 ]; + } +} + +INLINE int iGetNoiseVal(int ch) +{ + int fa; + + fa = (short) dwNoiseVal; + + // no clip need + //if(fa>32767L) fa=32767L; + //if(fa<-32767L) fa=-32767L; + + // don't upset VAG decoder + //if(iUseInterpolation<2) // no gauss/cubic interpolation? + //pChannel->SB[29] = fa; // -> store noise val in "current sample" slot + + // boost volume - no more! + //return fa * 3 / 2; + return fa; +} + //////////////////////////////////////////////////////////////////////// INLINE void StoreInterpolationVal(int ch,int fa) -{ - /* +{ + /* // fmod channel = sound output if(s_chan[ch].bFMod==2) // fmod freq channel s_chan[ch].SB[29]=fa; - else + else */ { if((spuCtrl&0x4000)==0) fa=0; // muted? @@ -449,7 +449,7 @@ INLINE void StoreInterpolationVal(int ch,int fa) INLINE int iGetInterpolationVal(int ch) { int fa; - + // fmod channel = sound output //if(s_chan[ch].bFMod==2) return s_chan[ch].SB[29]; @@ -520,27 +520,25 @@ INLINE int iGetInterpolationVal(int ch) //////////////////////////////////////////////////////////////////////// -#ifdef _WINDOWS -static VOID CALLBACK MAINProc(UINT nTimerId, UINT msg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2) -#else -static void *MAINThread(void *arg) +#ifdef _WINDOWS +static VOID CALLBACK MAINProc(UINT nTimerId, UINT msg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2) +#else +static void *MAINThread(void *arg) #endif { int s_1,s_2,fa,ns; #ifndef _MACOSX int voldiv = iVolume; #else - const int voldiv = 2; + int voldiv = 2; #endif unsigned char * start;unsigned int nSample; int ch,predict_nr,shift_factor,flags,d,s; int bIRQReturn=0; - - - // mute output - if( voldiv == 5 ) voldiv = 0x7fffffff; - - + + // mute output + if( voldiv == 5 ) voldiv = 0x7fffffff; + while(!bEndThread) // until we are shutting down { // ok, at the beginning we are looking if there is @@ -562,19 +560,19 @@ static void *MAINThread(void *arg) { iSecureStart=0; // reset secure -#ifdef _WINDOWS - if(iUseTimer) // no-thread mode? - { - if(iUseTimer==1) // -> ok, timer mode 1: setup a oneshot timer of x ms to wait - timeSetEvent(PAUSE_W,1,MAINProc,0,TIME_ONESHOT); - return; // -> and done this time (timer mode 1 or 2) - } - // win thread mode: - Sleep(PAUSE_W); // sleep for x ms (win) -#else - if(iUseTimer) return 0; // linux no-thread mode? bye - usleep(PAUSE_L); // else sleep for x ms (linux) -#endif +#ifdef _WINDOWS + if(iUseTimer) // no-thread mode? + { + if(iUseTimer==1) // -> ok, timer mode 1: setup a oneshot timer of x ms to wait + timeSetEvent(PAUSE_W,1,MAINProc,0,TIME_ONESHOT); + return; // -> and done this time (timer mode 1 or 2) + } + // win thread mode: + Sleep(PAUSE_W); // sleep for x ms (win) +#else + if(iUseTimer) return 0; // linux no-thread mode? bye + usleep(PAUSE_L); // else sleep for x ms (linux) +#endif if(dwNewChannel) iSecureStart=1; // if a new channel kicks in (or, of course, sound buffer runs low), we will leave the loop } @@ -591,19 +589,19 @@ static void *MAINThread(void *arg) //- main channel loop -// //--------------------------------------------------// { - ns=0; - while(ns turn everything off - s_chan[ch].iSilent=2; + // silence = let channel keep running (IRQs) + //s_chan[ch].bOn=0; // -> turn everything off + s_chan[ch].iSilent=2; s_chan[ch].ADSRX.lVolume=0; s_chan[ch].ADSRX.EnvelopeVol=0; @@ -681,51 +679,51 @@ static void *MAINThread(void *arg) //////////////////////////////////////////// flag handler - /* - SPU2-X: - $4 = set loop to current block - $2 = keep envelope on (no mute) - $1 = jump to loop address - - silence means no volume (ADSR keeps playing!!) - */ - - // Jungle Book - Rhythm 'n Groove - use external loop address - // - fixes music player (+IRQ generate) - if((flags&4) && (s_chan[ch].bIgnoreLoop == 0)) - s_chan[ch].pLoop=start-16; - - // Jungle Book - Rhythm 'n Groove - don't reset ignore status - // - fixes gameplay speed (IRQ hits) - //s_chan[ch].bIgnoreLoop = 0; - - - if(flags&1) - { - // ...? - //s_chan[ch].bIgnoreLoop = 0; - - // Xenogears - 7 = play missing sounds - start = s_chan[ch].pLoop; - - // silence = keep playing..? - if( (flags&2) == 0 ) { - s_chan[ch].iSilent = 1; - - // silence = don't start release phase - //s_chan[ch].bStop = 1; - - //start = (unsigned char *) -1; - } - } - -#if 0 - // crash check - if( start == 0 ) - start = (unsigned char *) -1; - if( start >= spuMemC + 0x80000 ) - start = spuMemC - 0x80000; -#endif + /* + SPU2-X: + $4 = set loop to current block + $2 = keep envelope on (no mute) + $1 = jump to loop address + + silence means no volume (ADSR keeps playing!!) + */ + + // Jungle Book - Rhythm 'n Groove - use external loop address + // - fixes music player (+IRQ generate) + if((flags&4) && (s_chan[ch].bIgnoreLoop == 0)) + s_chan[ch].pLoop=start-16; + + // Jungle Book - Rhythm 'n Groove - don't reset ignore status + // - fixes gameplay speed (IRQ hits) + //s_chan[ch].bIgnoreLoop = 0; + + + if(flags&1) + { + // ...? + //s_chan[ch].bIgnoreLoop = 0; + + // Xenogears - 7 = play missing sounds + start = s_chan[ch].pLoop; + + // silence = keep playing..? + if( (flags&2) == 0 ) { + s_chan[ch].iSilent = 1; + + // silence = don't start release phase + //s_chan[ch].bStop = 1; + + //start = (unsigned char *) -1; + } + } + +#if 0 + // crash check + if( start == 0 ) + start = (unsigned char *) -1; + if( start >= spuMemC + 0x80000 ) + start = spuMemC - 0x80000; +#endif s_chan[ch].pCurr=start; // store values for next cycle s_chan[ch].s_1=s_1; @@ -740,21 +738,21 @@ static void *MAINThread(void *arg) while(iSpuAsyncWait && !bEndThread && timeGetTime_spu() store 1T sample data, use that to do fmod on next channel - - // mix fmod channel into output - // - Xenogears save icon (high pitch) + + // mix fmod channel into output + // - Xenogears save icon (high pitch) { ////////////////////////////////////////////// // ok, left/right sound volume (psx volume goes from 0 ... 0x3fff) @@ -797,13 +795,13 @@ GOON: ; if(s_chan[ch].bRVBActive) StoreREVERB(ch,ns); } - - s_chan[ch].spos += s_chan[ch].sinc; + + s_chan[ch].spos += s_chan[ch].sinc; } - //////////////////////////////////////////////// - // ok, go on until 1 ms data of this channel is collected - - ns++; + //////////////////////////////////////////////// + // ok, go on until 1 ms data of this channel is collected + + ns++; } // end ns } @@ -837,60 +835,60 @@ GOON: ; else // stereo: for (ns = 0; ns < NSSIZE; ns++) { - static double _interpolation_coefficient = 3.759285613; - - if(iFreqResponse) { - int sl,sr; - double ldiff, rdiff, avg, tmp; - - SSumL[ns]+=MixREVERBLeft(ns); - SSumR[ns]+=MixREVERBRight(); - - sl = SSumL[ns]; SSumL[ns]=0; - sr = SSumR[ns]; SSumR[ns]=0; - - - /* - Frequency Response - - William Pitcock (nenolod) (UPSE PSF player) - - accurate (!) - - http://nenolod.net - */ - - avg = ((sl + sr) / 2); - ldiff = sl - avg; - rdiff = sr - avg; - - tmp = avg + ldiff * _interpolation_coefficient; - if (tmp < -32768) - tmp = -32768; - if (tmp > 32767) - tmp = 32767; - sl = (int)tmp; - - tmp = avg + rdiff * _interpolation_coefficient; - if (tmp < -32768) - tmp = -32768; - if (tmp > 32767) - tmp = 32767; - sr = (int)tmp; - - - *pS++=sl/voldiv; - *pS++=sr/voldiv; - } else { - SSumL[ns]+=MixREVERBLeft(ns); - - d=SSumL[ns]/voldiv;SSumL[ns]=0; - if(d<-32767) d=-32767;if(d>32767) d=32767; - *pS++=d; - - SSumR[ns]+=MixREVERBRight(); - - d=SSumR[ns]/voldiv;SSumR[ns]=0; - if(d<-32767) d=-32767;if(d>32767) d=32767; - *pS++=d; - } + static double _interpolation_coefficient = 3.759285613; + + if(iFreqResponse) { + int sl,sr; + double ldiff, rdiff, avg, tmp; + + SSumL[ns]+=MixREVERBLeft(ns); + SSumR[ns]+=MixREVERBRight(); + + sl = SSumL[ns]; SSumL[ns]=0; + sr = SSumR[ns]; SSumR[ns]=0; + + + /* + Frequency Response + - William Pitcock (nenolod) (UPSE PSF player) + - accurate (!) + - http://nenolod.net + */ + + avg = ((sl + sr) / 2); + ldiff = sl - avg; + rdiff = sr - avg; + + tmp = avg + ldiff * _interpolation_coefficient; + if (tmp < -32768) + tmp = -32768; + if (tmp > 32767) + tmp = 32767; + sl = (int)tmp; + + tmp = avg + rdiff * _interpolation_coefficient; + if (tmp < -32768) + tmp = -32768; + if (tmp > 32767) + tmp = 32767; + sr = (int)tmp; + + + *pS++=sl/voldiv; + *pS++=sr/voldiv; + } else { + SSumL[ns]+=MixREVERBLeft(ns); + + d=SSumL[ns]/voldiv;SSumL[ns]=0; + if(d<-32767) d=-32767;if(d>32767) d=32767; + *pS++=d; + + SSumR[ns]+=MixREVERBRight(); + + d=SSumR[ns]/voldiv;SSumR[ns]=0; + if(d<-32767) d=-32767;if(d>32767) d=32767; + *pS++=d; + } } ////////////////////////////////////////////////////// @@ -929,93 +927,93 @@ GOON: ; InitREVERB(); - ////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // feed the sound - // latency = 25 ms (less pops, crackles, smoother) - - //if(iCycle++>=20) - iCycle += APU_CYCLES_UPDATE; - if(iCycle > 44000/1000*LATENCY + 100*LATENCY/1000) + // latency = 25 ms (less pops, crackles, smoother) + + //if(iCycle++>=20) + iCycle += APU_CYCLES_UPDATE; + if(iCycle > 44000/1000*LATENCY + 100*LATENCY/1000) { SoundFeedStreamData((unsigned char *)pSpuBuffer, ((unsigned char *)pS) - ((unsigned char *)pSpuBuffer)); pS = (short *)pSpuBuffer; iCycle = 0; } - - - if( iUseTimer == 2 ) - break; + + + if( iUseTimer == 2 ) + break; } // end of big main loop... bThreadEnded = 1; - + #ifndef _WINDOWS - return 0; + return 0; #endif } - -//////////////////////////////////////////////////////////////////////// -// WINDOWS THREAD... simply calls the timer func and stays forever :) -//////////////////////////////////////////////////////////////////////// - -#ifdef _WINDOWS - -DWORD WINAPI MAINThreadEx(LPVOID lpParameter) -{ - MAINProc(0,0,0,0,0); - return 0; -} - -#endif + +//////////////////////////////////////////////////////////////////////// +// WINDOWS THREAD... simply calls the timer func and stays forever :) +//////////////////////////////////////////////////////////////////////// + +#ifdef _WINDOWS + +DWORD WINAPI MAINThreadEx(LPVOID lpParameter) +{ + MAINProc(0,0,0,0,0); + return 0; +} + +#endif // SPU ASYNC... even newer epsxe func // 1 time every 'cycle' cycles... harhar -long cpu_cycles; +long cpu_cycles; void CALLBACK SPUasync(unsigned long cycle) { - cpu_cycles += cycle; - + cpu_cycles += cycle; + if(iSpuAsyncWait) { iSpuAsyncWait++; if(iSpuAsyncWait<=64) return; iSpuAsyncWait=0; - - cpu_cycles = cycle; - } - -#ifdef _WINDOWS - if(iDebugMode==2) - { - if(IsWindow(hWDebug)) DestroyWindow(hWDebug); - hWDebug=0;iDebugMode=0; - } - if(iRecordMode==2) - { - if(IsWindow(hWRecord)) DestroyWindow(hWRecord); - hWRecord=0;iRecordMode=0; - } -#endif + + cpu_cycles = cycle; + } + +#ifdef _WINDOWS + if(iDebugMode==2) + { + if(IsWindow(hWDebug)) DestroyWindow(hWDebug); + hWDebug=0;iDebugMode=0; + } + if(iRecordMode==2) + { + if(IsWindow(hWRecord)) DestroyWindow(hWRecord); + hWRecord=0;iRecordMode=0; + } +#endif if(iUseTimer==2) // special mode, only used in Linux by this spu (or if you enable the experimental Windows mode) { if(!bSpuInit) return; // -> no init, no call - // 1 ms updates - while( cpu_cycles >= CPU_CLOCK / INTERVAL_TIME ) - { - #ifdef _WINDOWS - MAINProc(0,0,0,0,0); // -> experimental win mode... not really tested... don't like the drawbacks - #else - MAINThread(0); // -> linux high-compat mode - #endif - - cpu_cycles -= CPU_CLOCK / INTERVAL_TIME; - } + // 1 ms updates + while( cpu_cycles >= CPU_CLOCK / INTERVAL_TIME ) + { + #ifdef _WINDOWS + MAINProc(0,0,0,0,0); // -> experimental win mode... not really tested... don't like the drawbacks + #else + MAINThread(0); // -> linux high-compat mode + #endif + + cpu_cycles -= CPU_CLOCK / INTERVAL_TIME; + } } } @@ -1063,49 +1061,49 @@ void SetupTimer(void) bEndThread=0; // init thread vars bThreadEnded=0; bSpuInit=1; // flag: we are inited - -#ifdef _WINDOWS - - if(iUseTimer==1) // windows: use timer - { - timeBeginPeriod(1); - timeSetEvent(1,1,MAINProc,0,TIME_ONESHOT); - } - else - if(iUseTimer==0) // windows: use thread - { - //_beginthread(MAINThread,0,NULL); - DWORD dw; - hMainThread=CreateThread(NULL,0,MAINThreadEx,0,0,&dw); - SetThreadPriority(hMainThread, - //THREAD_PRIORITY_TIME_CRITICAL); - THREAD_PRIORITY_HIGHEST); - } - -#else - + +#ifdef _WINDOWS + + if(iUseTimer==1) // windows: use timer + { + timeBeginPeriod(1); + timeSetEvent(1,1,MAINProc,0,TIME_ONESHOT); + } + else + if(iUseTimer==0) // windows: use thread + { + //_beginthread(MAINThread,0,NULL); + DWORD dw; + hMainThread=CreateThread(NULL,0,MAINThreadEx,0,0,&dw); + SetThreadPriority(hMainThread, + //THREAD_PRIORITY_TIME_CRITICAL); + THREAD_PRIORITY_HIGHEST); + } + +#else + if(!iUseTimer) // linux: use thread { pthread_create(&thread, NULL, MAINThread, NULL); - } - + } + #endif } // REMOVETIMER: kill threads/timers void RemoveTimer(void) { - bEndThread=1; // raise flag to end thread - -#ifdef _WINDOWS - - if(iUseTimer!=2) // windows thread? - { - while(!bThreadEnded) {Sleep(5L);} // -> wait till thread has ended - Sleep(5L); - } - if(iUseTimer==1) timeEndPeriod(1); // windows timer? stop it - + bEndThread=1; // raise flag to end thread + +#ifdef _WINDOWS + + if(iUseTimer!=2) // windows thread? + { + while(!bThreadEnded) {Sleep(5L);} // -> wait till thread has ended + Sleep(5L); + } + if(iUseTimer==1) timeEndPeriod(1); // windows timer? stop it + #else if(!iUseTimer) // linux tread? { @@ -1113,8 +1111,8 @@ void RemoveTimer(void) while(!bThreadEnded && i<2000) {usleep(1000L);i++;} // -> wait until thread has ended if(thread!=(pthread_t)-1) {pthread_cancel(thread);thread=(pthread_t)-1;} // -> cancel thread anyway } - -#endif + +#endif bThreadEnded=0; // no more spu is running bSpuInit=0; @@ -1205,44 +1203,44 @@ long CALLBACK SPUinit(void) } // SPUOPEN: called by main emu after init -#ifdef _WINDOWS -long CALLBACK SPUopen(HWND hW) -#else -long SPUopen(void) +#ifdef _WINDOWS +long CALLBACK SPUopen(HWND hW) +#else +long SPUopen(void) #endif { - if (bSPUIsOpen) return 0; // security for some stupid main emus + if (bSPUIsOpen) return 0; // security for some stupid main emus -#ifdef _WINDOWS - LastWrite=0xffffffff;LastPlay=0; // init some play vars - if(!IsWindow(hW)) hW=GetActiveWindow(); - hWMain = hW; // store hwnd -#endif +#ifdef _WINDOWS + LastWrite=0xffffffff;LastPlay=0; // init some play vars + if(!IsWindow(hW)) hW=GetActiveWindow(); + hWMain = hW; // store hwnd +#endif SetupSound(); // setup sound (before init!) SetupTimer(); // timer for feeding data - bSPUIsOpen = 1; - -#ifdef _WINDOWS - if(iDebugMode) // windows debug dialog - { - hWDebug=CreateDialog(hInst,MAKEINTRESOURCE(IDD_DEBUG), - NULL,(DLGPROC)DebugDlgProc); - SetWindowPos(hWDebug,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOACTIVATE); - UpdateWindow(hWDebug); - SetFocus(hWMain); - } - - if(iRecordMode) // windows recording dialog - { - hWRecord=CreateDialog(hInst,MAKEINTRESOURCE(IDD_RECORD), - NULL,(DLGPROC)RecordDlgProc); - SetWindowPos(hWRecord,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOACTIVATE); - UpdateWindow(hWRecord); - SetFocus(hWMain); - } -#endif + bSPUIsOpen = 1; + +#ifdef _WINDOWS + if(iDebugMode) // windows debug dialog + { + hWDebug=CreateDialog(hInst,MAKEINTRESOURCE(IDD_DEBUG), + NULL,(DLGPROC)DebugDlgProc); + SetWindowPos(hWDebug,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOACTIVATE); + UpdateWindow(hWDebug); + SetFocus(hWMain); + } + + if(iRecordMode) // windows recording dialog + { + hWRecord=CreateDialog(hInst,MAKEINTRESOURCE(IDD_RECORD), + NULL,(DLGPROC)RecordDlgProc); + SetWindowPos(hWRecord,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOACTIVATE); + UpdateWindow(hWRecord); + SetFocus(hWMain); + } +#endif return PSE_SPU_ERR_SUCCESS; } @@ -1252,14 +1250,14 @@ long CALLBACK SPUclose(void) { if (!bSPUIsOpen) return 0; // some security - bSPUIsOpen = 0; // no more open + bSPUIsOpen = 0; // no more open -#ifdef _WINDOWS - if(IsWindow(hWDebug)) DestroyWindow(hWDebug); - hWDebug=0; - if(IsWindow(hWRecord)) DestroyWindow(hWRecord); - hWRecord=0; -#endif +#ifdef _WINDOWS + if(IsWindow(hWDebug)) DestroyWindow(hWDebug); + hWDebug=0; + if(IsWindow(hWRecord)) DestroyWindow(hWRecord); + hWRecord=0; +#endif RemoveTimer(); // no more feeding RemoveSound(); // no more sound handling @@ -1284,25 +1282,25 @@ long CALLBACK SPUtest(void) // SPUCONFIGURE: call config dialog long CALLBACK SPUconfigure(void) -{ -#if defined (_WINDOWS) - DialogBox(hInst,MAKEINTRESOURCE(IDD_CFGDLG), - GetActiveWindow(),(DLGPROC)DSoundDlgProc); +{ +#if defined (_WINDOWS) + DialogBox(hInst,MAKEINTRESOURCE(IDD_CFGDLG), + GetActiveWindow(),(DLGPROC)DSoundDlgProc); #elif defined (_MACOSX) DoConfiguration(); #else StartCfgTool("CFG"); -#endif +#endif return 0; } // SPUABOUT: show about window void CALLBACK SPUabout(void) -{ -#if defined (_WINDOWS) - DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(),(DLGPROC)AboutDlgProc); +{ +#if defined (_WINDOWS) + DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT), + GetActiveWindow(),(DLGPROC)AboutDlgProc); #elif defined (_MACOSX) DoAbout(); #else diff --git a/plugins/dfsound/spucfg-0.1df/dfsound.glade2 b/plugins/dfsound/spucfg-0.1df/dfsound.glade2 index c071a09e..d2729bb8 100644 --- a/plugins/dfsound/spucfg-0.1df/dfsound.glade2 +++ b/plugins/dfsound/spucfg-0.1df/dfsound.glade2 @@ -78,7 +78,8 @@ True - Low + None +Low Medium Loud Loudest @@ -258,6 +259,18 @@ Cubic 2 + + + Frequency Response - Output Filter + True + True + False + True + + + 3 + + diff --git a/plugins/dfsound/spucfg-0.1df/main.c b/plugins/dfsound/spucfg-0.1df/main.c index dd38645a..034379f7 100644 --- a/plugins/dfsound/spucfg-0.1df/main.c +++ b/plugins/dfsound/spucfg-0.1df/main.c @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) p = strstr(p, "="); len = 1; } - val = set_limit (p, len, 0, 4); + val = set_limit (p, len, -1, 4) + 1; } else val = 2; gtk_combo_box_set_active(GTK_COMBO_BOX (glade_xml_get_widget(xml, "cbVolume2")), val); @@ -194,6 +194,19 @@ int main(int argc, char *argv[]) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (glade_xml_get_widget(xml, "chkDisStereo")), val); if (pB) { + strcpy(t, "\nFreqResponse"); + p = strstr(pB, t); + if (p) { + p = strstr(p, "="); + len = 1; + } + + val = set_limit (p, len, 0, 1); + } else val = 0; + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (glade_xml_get_widget(xml, "chkFreqResponse")), val); + + if (pB) { strcpy(t, "\nUseReverb"); p = strstr(pB, t); if (p) { @@ -233,7 +246,7 @@ void SaveConfig(GtkWidget *widget, gpointer user_data) } val = gtk_combo_box_get_active(GTK_COMBO_BOX(glade_xml_get_widget(xml, "cbVolume2"))); - fprintf(fp, "\nVolume = %d\n", val); + fprintf(fp, "\nVolume = %d\n", val - 1); val = gtk_combo_box_get_active(GTK_COMBO_BOX(glade_xml_get_widget(xml, "cbInterpolation2"))); fprintf(fp, "\nUseInterpolation = %d\n", val); @@ -250,6 +263,9 @@ void SaveConfig(GtkWidget *widget, gpointer user_data) val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "chkDisStereo"))); fprintf(fp, "\nDisStereo = %d\n", val); + val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "chkFreqResponse"))); + fprintf(fp, "\nFreqResponse = %d\n", val); + val = gtk_combo_box_get_active(GTK_COMBO_BOX(glade_xml_get_widget(xml, "cbReverb2"))); fprintf(fp, "\nUseReverb = %d\n", val); diff --git a/plugins/dfxvideo/draw.c b/plugins/dfxvideo/draw.c index 2594fc22..b0b54a56 100644 --- a/plugins/dfxvideo/draw.c +++ b/plugins/dfxvideo/draw.c @@ -1294,9 +1294,6 @@ if (!myvisual) DestroyDisplay(); } - - - int _i; uint32_t color; /* fix the green back ground in YUV mode */ @@ -1416,7 +1413,7 @@ void BlitToYUV(unsigned char * surf,int32_t x,int32_t y) unsigned short row,column; unsigned short dx = PreviousPSXDisplay.Range.x1; unsigned short dy = PreviousPSXDisplay.DisplayMode.y; - int Y,U,V, R,G,B; + int R,G,B; int32_t lPitch = PSXDisplay.DisplayMode.x << 2; uint32_t *destpix; @@ -1567,7 +1564,7 @@ void DoBufferSwap(void) Screen *screen; Window _dw; XvImage *xvi; - unsigned int dstx, dsty, srcy = 0; + unsigned int dstx, dsty; unsigned int _d, _w, _h; //don't care about _d finalw = PSXDisplay.DisplayMode.x; diff --git a/plugins/gxvideo/draw.h b/plugins/gxvideo/draw.h index edeb1e6e..6ab89518 100644 --- a/plugins/gxvideo/draw.h +++ b/plugins/gxvideo/draw.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "gpu_utils.h" diff --git a/plugins/peopsxgl/gpucfg/gpucfg-newstyle2.glade b/plugins/peopsxgl/gpucfg/gpucfg-newstyle2.glade index a39f02ba..538c08ce 100644 --- a/plugins/peopsxgl/gpucfg/gpucfg-newstyle2.glade +++ b/plugins/peopsxgl/gpucfg/gpucfg-newstyle2.glade @@ -1,6 +1,6 @@ - + - + @@ -141,10 +141,12 @@ 5 P.E.Op.S. MesaGL PSX GPU configuration... False + True center normal + vertical 5 @@ -154,6 +156,7 @@ 5 + vertical True @@ -175,7 +178,7 @@ True 5 - + 1 @@ -185,7 +188,7 @@ True - + 1 @@ -228,6 +231,8 @@ True + False + False 1 @@ -239,6 +244,8 @@ True + False + False 2 @@ -260,12 +267,14 @@ 5 + vertical True True + vertical 2 @@ -305,6 +314,7 @@ True + vertical 2 @@ -375,6 +385,9 @@ True + False + False + 5 1 @@ -410,6 +423,7 @@ 5 + vertical Show FPS display on startup @@ -418,6 +432,8 @@ True + False + False 0 @@ -429,6 +445,7 @@ True + False 1 @@ -440,6 +457,8 @@ True + False + False 2 @@ -452,6 +471,8 @@ rdbLimMan + False + False 3 @@ -466,6 +487,8 @@ True + False + False 0 @@ -474,6 +497,9 @@ True + False + False + 5 1 @@ -483,11 +509,15 @@ center + False + False 2 + False + False 4 @@ -509,18 +539,21 @@ 5 + vertical True True + vertical True True + vertical 2 @@ -560,6 +593,7 @@ True + vertical 2 @@ -573,6 +607,8 @@ + False + False 0 @@ -587,6 +623,8 @@ + False + False 1 @@ -683,6 +721,7 @@ 5 + vertical @@ -693,6 +732,8 @@ True + False + False 0 @@ -703,6 +744,8 @@ False + False + 13 1 @@ -711,11 +754,15 @@ True + False + False 2 + False + False 0 @@ -727,6 +774,8 @@ True + False + False 1 @@ -738,6 +787,8 @@ True + False + False 2 @@ -749,6 +800,8 @@ True + False + False 3 @@ -760,6 +813,8 @@ True + False + False 4 @@ -771,6 +826,8 @@ True + False + False 5 @@ -782,6 +839,8 @@ True + False + False 6 @@ -803,6 +862,7 @@ 5 + vertical Use game fixes @@ -1078,7 +1138,6 @@ True False False - False True @@ -1093,7 +1152,6 @@ True False False - False True @@ -1128,6 +1186,7 @@ True + vertical 2 -- cgit v1.2.3