mirror of https://github.com/PCSX2/pcsx2.git
Darwin/OSX - spu2x apple build with portaudio only.
OSX compilation fix: spu2x: Windows & Linux
This commit is contained in:
parent
b56197d30b
commit
c72400e927
|
@ -31,6 +31,8 @@ endmacro(print_dep)
|
|||
#-------------------------------------------------------------------------------
|
||||
if (GTK2_FOUND OR GTK3_FOUND)
|
||||
set(GTKn_FOUND TRUE)
|
||||
elseif(APPLE) # Not we have but that we don't change all if(gtkn) entries
|
||||
set(GTKn_FOUND TRUE)
|
||||
else()
|
||||
set(GTKn_FOUND FALSE)
|
||||
endif()
|
||||
|
@ -253,7 +255,8 @@ endif()
|
|||
# -SDL
|
||||
# -common_libs
|
||||
#---------------------------------------
|
||||
if(ALSA_FOUND OR PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND AND SDLn_FOUND AND common_libs)
|
||||
if((APPLE AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND AND SDLn_FOUND AND common_libs)
|
||||
OR (LINUX AND ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND AND SDLn_FOUND AND common_libs))
|
||||
set(spu2-x TRUE)
|
||||
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/spu2-x")
|
||||
set(spu2-x FALSE)
|
||||
|
|
|
@ -405,6 +405,12 @@ set(pcsx2LinuxSources
|
|||
Linux/LnxFlatFileReader.cpp
|
||||
)
|
||||
|
||||
set(pcsx2OSXSources
|
||||
# Linux/LnxConsolePipe.cpp
|
||||
# Linux/LnxKeyCodes.cpp
|
||||
Darwin/DarwinFlatFileReader.cpp
|
||||
)
|
||||
|
||||
# Linux headers
|
||||
set(pcsx2LinuxHeaders
|
||||
)
|
||||
|
@ -623,9 +629,10 @@ if(Windows)
|
|||
endif()
|
||||
|
||||
# MacOSX
|
||||
if(MacOSX)
|
||||
if(APPLE)
|
||||
set(Platform
|
||||
)
|
||||
${pcsx2OSXSources}
|
||||
${pcsx2LinuxHeaders})
|
||||
endif()
|
||||
|
||||
set(pcsx2FinalSources
|
||||
|
|
|
@ -83,7 +83,7 @@ extern u32 OutputModule;
|
|||
extern int SndOutLatencyMS;
|
||||
extern int SynchMode;
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef __POSIX__
|
||||
extern wchar_t dspPlugin[];
|
||||
extern int dspPluginModule;
|
||||
|
||||
|
|
|
@ -68,7 +68,11 @@ static __forceinline T GetClamped( T src, T min, T max )
|
|||
return std::min( std::max( src, min ), max );
|
||||
}
|
||||
|
||||
#ifdef __WXMAC__
|
||||
#include "PS2Eext.h"
|
||||
#else
|
||||
extern void SysMessage(const char *fmt, ...);
|
||||
#endif
|
||||
extern void SysMessage(const wchar_t *fmt, ...);
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
// Adapted from ZeroSPU2 code by Zerofrog. Heavily modified by Arcum42.
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "Global.h"
|
||||
|
@ -260,3 +262,5 @@ public:
|
|||
} static Alsa;
|
||||
|
||||
SndOutModule *AlsaOut = &Alsa;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -141,7 +141,9 @@ void ReadSettings()
|
|||
SynchMode = CfgReadInt( L"OUTPUT", L"Synch_Mode", 0);
|
||||
|
||||
PortaudioOut->ReadSettings();
|
||||
#ifndef __APPLE__
|
||||
SDLOut->ReadSettings();
|
||||
#endif
|
||||
SoundtouchCfg::ReadSettings();
|
||||
DebugConfig::ReadSettings();
|
||||
|
||||
|
@ -185,7 +187,9 @@ void WriteSettings()
|
|||
CfgWriteInt(L"DEBUG", L"DelayCycles", delayCycles);
|
||||
|
||||
PortaudioOut->WriteSettings();
|
||||
#ifndef __APPLE__
|
||||
SDLOut->WriteSettings();
|
||||
#endif
|
||||
SoundtouchCfg::WriteSettings();
|
||||
DebugConfig::WriteSettings();
|
||||
}
|
||||
|
@ -200,6 +204,7 @@ void debug_dialog()
|
|||
DebugConfig::DisplayDialog();
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
void DisplayDialog()
|
||||
{
|
||||
int return_value;
|
||||
|
@ -379,6 +384,12 @@ void DisplayDialog()
|
|||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
#else
|
||||
void DisplayDialog()
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void configure()
|
||||
{
|
||||
|
|
|
@ -18,7 +18,10 @@
|
|||
#ifndef CONFIG_H_INCLUDED
|
||||
#define CONFIG_H_INCLUDED
|
||||
|
||||
#ifdef __linux__
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <wx/fileconf.h>
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ void WriteSettings()
|
|||
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
void DisplayDialog()
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
@ -285,5 +286,10 @@ void DisplayDialog()
|
|||
|
||||
WriteSettings();
|
||||
}
|
||||
#else
|
||||
void DisplayDialog()
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -71,9 +71,11 @@ namespace SoundtouchCfg
|
|||
CfgWriteInt( L"SOUNDTOUCH", L"OverlapMS", OverlapMS );
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
static GtkWidget *seq_label, *seek_label, *over_label;
|
||||
static GtkWidget *seq_slide, *seek_slide, *over_slide;
|
||||
|
||||
|
||||
void restore_defaults()
|
||||
{
|
||||
gtk_range_set_value(GTK_RANGE(seq_slide), 30);
|
||||
|
@ -81,6 +83,7 @@ namespace SoundtouchCfg
|
|||
gtk_range_set_value(GTK_RANGE(over_slide), 10);
|
||||
}
|
||||
|
||||
|
||||
void DisplayDialog()
|
||||
{
|
||||
int return_value;
|
||||
|
@ -158,4 +161,15 @@ namespace SoundtouchCfg
|
|||
|
||||
WriteSettings();
|
||||
}
|
||||
#else
|
||||
void DisplayDialog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void restore_defaults()
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -18,9 +18,11 @@
|
|||
// To be continued...
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void SysMessage(const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
@ -59,6 +61,7 @@ void SysMessage(const wchar_t *fmt, ...)
|
|||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
#endif
|
||||
|
||||
void DspUpdate()
|
||||
{
|
||||
|
|
|
@ -270,6 +270,20 @@ static __forceinline void GetNextDataDummy(V_Core& thiscore, uint voiceidx)
|
|||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
#if defined(__clang__)
|
||||
#include <limits.h>
|
||||
static s32 rotr(u32 x, u32 s)
|
||||
{
|
||||
//return (x >> s) | (x << (32 - s));
|
||||
return (x >> s) | (x << (sizeof(x) * CHAR_BIT - s));
|
||||
}
|
||||
|
||||
static s32 rotl(u32 x, u32 s)
|
||||
{
|
||||
//return (x << s) | (x >> (32 - s));
|
||||
return (x << s) | (x >> (sizeof(x) * CHAR_BIT - s));
|
||||
}
|
||||
#endif
|
||||
|
||||
static s32 __forceinline GetNoiseValues()
|
||||
{
|
||||
|
@ -292,7 +306,7 @@ static s32 __forceinline GetNoiseValues()
|
|||
ROR eax,3
|
||||
MOV Seed,eax
|
||||
}
|
||||
#else
|
||||
#elif !defined(__clang__) // Linux with GCC
|
||||
__asm__ (
|
||||
".intel_syntax\n"
|
||||
"MOV %%eax,%1\n"
|
||||
|
@ -307,6 +321,14 @@ static s32 __forceinline GetNoiseValues()
|
|||
".att_syntax\n" : "=r"(Seed) :"r"(Seed)
|
||||
: "%eax", "%esi"
|
||||
);
|
||||
#else // Clang and others
|
||||
s32 s = rotr(Seed,5);
|
||||
s ^= 0x9a;
|
||||
s32 k = rotl(s,2);
|
||||
k+=s;
|
||||
k^=s;
|
||||
k = rotr(k,3);
|
||||
Seed=k;
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
@ -819,7 +841,7 @@ static int p_cachestat_counter=0;
|
|||
|
||||
// Gcc does not want to inline it when lto is enabled because some functions growth too much.
|
||||
// The function is big enought to see any speed impact. -- Gregory
|
||||
#ifndef __linux__
|
||||
#ifndef __POSIX__
|
||||
__forceinline
|
||||
#endif
|
||||
void Mix()
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#include "Dma.h"
|
||||
#include "Dialogs.h"
|
||||
|
||||
#ifdef __POSIX__
|
||||
#include "PS2Eext.h"
|
||||
#endif
|
||||
|
||||
#include "svnrev.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -446,7 +450,7 @@ EXPORT_C_(s32) SPU2open(void *pDsp)
|
|||
{
|
||||
SndBuffer::Init();
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef __POSIX__
|
||||
DspLoadLibrary(dspPlugin,dspPluginModule);
|
||||
#endif
|
||||
WaveDump::Open();
|
||||
|
@ -467,7 +471,7 @@ EXPORT_C_(void) SPU2close()
|
|||
|
||||
FileLog("[%10d] SPU2 Close\n",Cycles);
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef __POSIX__
|
||||
DspCloseLibrary();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "Pcsx2Defs.h"
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef __POSIX__
|
||||
//Until I get around to putting in Linux svn code, this is an unknown svn version.
|
||||
#define SVN_REV_UNKNOWN
|
||||
#endif
|
||||
|
@ -51,7 +51,7 @@ EXPORT_C_(void) SPU2irqCallback(void (*SPU2callback)());
|
|||
#else
|
||||
// These defines are useless and gcc-4.6 complain about redefinition
|
||||
// so we remove them on linux
|
||||
#ifndef __linux__
|
||||
#ifndef __POSIX__
|
||||
EXPORT_C_(void) SPU2readDMA4Mem(u16 *pMem, u32 size);
|
||||
EXPORT_C_(void) SPU2writeDMA4Mem(u16 *pMem, u32 size);
|
||||
EXPORT_C_(void) SPU2interruptDMA4();
|
||||
|
|
|
@ -92,8 +92,10 @@ SndOutModule* mods[]=
|
|||
WaveOut,
|
||||
#endif
|
||||
PortaudioOut,
|
||||
#ifdef __linux__
|
||||
#if defined(SPU2X_SDL) || defined(SPU2X_SDL2)
|
||||
SDLOut,
|
||||
#endif
|
||||
#if defined(__linux__) /* && defined(__ALSA__)*/
|
||||
AlsaOut,
|
||||
#endif
|
||||
NULL // signals the end of our list
|
||||
|
@ -465,7 +467,7 @@ void SndBuffer::Write( const StereoOut32& Sample )
|
|||
ssFreeze--;
|
||||
memset( sndTempBuffer, 0, sizeof(StereoOut32) * SndOutPacketSize ); // Play silence
|
||||
}
|
||||
#ifndef __linux__
|
||||
#ifndef __POSIX__
|
||||
if( dspPluginEnabled )
|
||||
{
|
||||
// Convert in, send to winamp DSP, and convert out.
|
||||
|
|
|
@ -673,8 +673,10 @@ extern SndOutModule* DSoundOut;
|
|||
extern SndOutModule* XAudio2Out;
|
||||
#endif
|
||||
extern SndOutModule* PortaudioOut;
|
||||
#ifdef __linux__
|
||||
#if defined(SPU2X_SDL) || defined(SPU2X_SDL2)
|
||||
extern SndOutModule * const SDLOut;
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
extern SndOutModule* AlsaOut;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -588,6 +588,9 @@ public:
|
|||
#ifdef __linux__
|
||||
// By default on linux use the ALSA API (+99% users) -- Gregory
|
||||
CfgReadStr( L"PORTAUDIO", L"HostApi", api, L"ALSA" );
|
||||
#elif defined(__APPLE__)
|
||||
// Suppose OSX only has CoreAudio...
|
||||
CfgReadStr( L"PORTAUDIO", L"HostApi", api, L"CoreAudio" );
|
||||
#else
|
||||
CfgReadStr( L"PORTAUDIO", L"HostApi", api, L"WASAPI" );
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "Global.h"
|
||||
#ifdef __linux__
|
||||
#ifdef __POSIX__
|
||||
#include "WavFile.h"
|
||||
#else
|
||||
#include "soundtouch/source/SoundStretch/WavFile.h"
|
||||
|
@ -53,7 +53,7 @@ namespace WaveDump
|
|||
for( int srcidx=0; srcidx<CoreSrc_Count; srcidx++ )
|
||||
{
|
||||
safe_delete( m_CoreWav[cidx][srcidx] );
|
||||
#ifdef __linux__
|
||||
#ifdef __POSIX__
|
||||
sprintf( wavfilename, "logs/spu2x-Core%d-%s.wav",
|
||||
cidx, m_tbl_CoreOutputTypeNames[ srcidx ] );
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue