From 98e24f587368272e867fe09c39fb11d4550e7e3e Mon Sep 17 00:00:00 2001 From: Soren Jorvang Date: Sat, 5 Feb 2011 16:06:05 +0000 Subject: [PATCH] The compiler need not obey the static keyword, so to avoid linker problems, whole functions in .h files need to also be static in case they are included in several .cpp files. Also a few other minor LTO fixes. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7082 8ced0084-cf51-0410-be5f-012b33b47a6e --- Externals/zlib/SConscript | 3 --- SConstruct | 13 +++++------ Source/Core/AudioCommon/Src/AudioCommon.cpp | 18 +++++++-------- Source/Core/Common/Src/Hash.cpp | 2 +- Source/Core/Common/Src/StringUtil.h | 2 +- Source/Core/Core/Src/DSP/DSPIntUtil.h | 22 +++++++++---------- .../Src/HW/DSPHLE/UCodes/UCode_AX_ADPCM.h | 4 ++-- Source/Core/DolphinWX/Src/Frame.h | 2 +- Source/Core/DolphinWX/Src/SConscript | 8 +++++-- Source/Core/VideoCommon/Src/SConscript | 4 +++- .../Core/VideoCommon/Src/TextureCacheBase.cpp | 4 ++-- Source/DSPTool/Src/SConscript | 7 +----- .../Plugin_VideoSoftware/Src/SWGLUtil.cpp | 2 +- .../Plugin_VideoSoftware/Src/SWmain.cpp | 5 ----- Source/UnitTests/SConscript | 7 +----- 15 files changed, 43 insertions(+), 60 deletions(-) diff --git a/Externals/zlib/SConscript b/Externals/zlib/SConscript index 13ad348f18..eeed8db8c2 100644 --- a/Externals/zlib/SConscript +++ b/Externals/zlib/SConscript @@ -3,9 +3,6 @@ Import('env') import sys -if sys.platform == 'darwin': - Return() - if env.has_key('shared_zlib') and env['shared_zlib']: env['LIBS'] += 'z' Return() diff --git a/SConstruct b/SConstruct index 0dc071a593..05bc2343b5 100644 --- a/SConstruct +++ b/SConstruct @@ -120,12 +120,12 @@ if sys.platform == 'darwin': env['CCFLAGS'] += ['-march=core2', '-mdynamic-no-pic'] env['CCFLAGS'] += ['-Xarch_i386', '-msse3', '-Xarch_x86_64', '-mssse3'] env['CXXFLAGS'] += ['-x', 'objective-c++'] - env['FRAMEWORKS'] += ['AppKit', 'Carbon', 'CoreFoundation', 'CoreServices'] - env['FRAMEWORKS'] += ['AudioToolbox', 'AudioUnit', 'CoreAudio', 'WebKit'] - env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL'] + env['FRAMEWORKS'] += ['AudioToolbox', 'AudioUnit', 'Carbon', 'Cocoa'] + env['FRAMEWORKS'] += ['CoreAudio', 'CoreFoundation', 'CoreServices'] + env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL', 'WebKit'] env['LIBPATH'] += ['/usr/lib'] # XXX clang env['LINKFLAGS'] += ccld - env['LINKFLAGS'] += ['-Wl,-dead_strip', '-Wl,-dead_strip_dylibs'] + env['LINKFLAGS'] += ['-Wl,-dead_strip,-dead_strip_dylibs'] env['LINKFLAGS'] += ['-Wl,-pagezero_size,0x1000'] env['LINKFLAGS'] += ['-Wl,-search_paths_first'] @@ -156,11 +156,8 @@ if sys.platform == 'darwin': env['CPPPATH'] += wxenv['CPPPATH'] env['wxconfiglibs'] = wxenv['LIBS'] - env['CPPPATH'] += ['#Externals'] - env['FRAMEWORKPATH'] += ['Externals/Cg'] - env['FRAMEWORKS'] += ['Cg'] - env['data_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/Resources' + env['shared_zlib'] = True if env['bundle']: app = env['prefix'] + '/Dolphin.app' diff --git a/Source/Core/AudioCommon/Src/AudioCommon.cpp b/Source/Core/AudioCommon/Src/AudioCommon.cpp index 8d8c2e7b84..547c0a8fe6 100644 --- a/Source/Core/AudioCommon/Src/AudioCommon.cpp +++ b/Source/Core/AudioCommon/Src/AudioCommon.cpp @@ -30,10 +30,6 @@ namespace AudioCommon { SoundStream *InitSoundStream(CMixer *mixer, void *hWnd) { - // This looks evil. - if (!mixer) - mixer = new CMixer(); - std::string backend = ac_Config.sBackend; if (backend == BACKEND_OPENAL && OpenALStream::isValid()) soundStream = new OpenALStream(mixer); @@ -57,12 +53,11 @@ namespace AudioCommon ac_Config.Update(); if (soundStream->Start()) { +#if 0 // Start the sound recording - /* - if (ac_Config.record) { - soundStream->StartLogAudio(FULL_DUMP_DIR g_Config.recordFile); - } - */ + if (ac_Config.record) + soundStream->StartLogAudio(FULL_DUMP_DIR g_Config.recordFile); +#endif return soundStream; } PanicAlertT("Could not initialize backend %s.", backend.c_str()); @@ -81,7 +76,10 @@ namespace AudioCommon if (soundStream) { soundStream->Stop(); - soundStream->StopLogAudio(); +#if 0 + if (ac_Config.record) + soundStream->StopLogAudio(); +#endif delete soundStream; soundStream = NULL; } diff --git a/Source/Core/Common/Src/Hash.cpp b/Source/Core/Common/Src/Hash.cpp index 22413f1bcd..5717e701ac 100644 --- a/Source/Core/Common/Src/Hash.cpp +++ b/Source/Core/Common/Src/Hash.cpp @@ -449,7 +449,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) makes identical hashes, this is just a c/p of the 64-bit one. */ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) { - const u64 m = 0xc6a4a7935bd1e995; + const u64 m = 0xc6a4a7935bd1e995ULL; u64 h = len * m; const int r = 47; u32 Step = (len / 8); diff --git a/Source/Core/Common/Src/StringUtil.h b/Source/Core/Common/Src/StringUtil.h index 5ee1324172..d814974677 100644 --- a/Source/Core/Common/Src/StringUtil.h +++ b/Source/Core/Common/Src/StringUtil.h @@ -68,7 +68,7 @@ bool TryParse(const std::string &str, bool *output); bool TryParse(const std::string &str, u32 *output); template -bool TryParse(const std::string &str, N *const output) +static bool TryParse(const std::string &str, N *const output) { std::istringstream iss(str); diff --git a/Source/Core/Core/Src/DSP/DSPIntUtil.h b/Source/Core/Core/Src/DSP/DSPIntUtil.h index 712d79fdf8..2c23aa229c 100644 --- a/Source/Core/Core/Src/DSP/DSPIntUtil.h +++ b/Source/Core/Core/Src/DSP/DSPIntUtil.h @@ -38,12 +38,12 @@ // --- SR // --------------------------------------------------------------------------------------- -inline void dsp_SR_set_flag(int flag) +static inline void dsp_SR_set_flag(int flag) { g_dsp.r.sr |= flag; } -inline bool dsp_SR_is_flag_set(int flag) +static inline bool dsp_SR_is_flag_set(int flag) { return (g_dsp.r.sr & flag) != 0; } @@ -52,7 +52,7 @@ inline bool dsp_SR_is_flag_set(int flag) // --- AR increments, decrements // --------------------------------------------------------------------------------------- -inline u16 dsp_increase_addr_reg(u16 reg, s16 _ix) +static inline u16 dsp_increase_addr_reg(u16 reg, s16 _ix) { u32 ar = g_dsp.r.ar[reg]; u32 wr = g_dsp.r.wr[reg]; @@ -75,7 +75,7 @@ inline u16 dsp_increase_addr_reg(u16 reg, s16 _ix) return nar; } -inline u16 dsp_decrease_addr_reg(u16 reg, s16 _ix) +static inline u16 dsp_decrease_addr_reg(u16 reg, s16 _ix) { u32 ar = g_dsp.r.ar[reg]; u32 wr = g_dsp.r.wr[reg]; @@ -98,7 +98,7 @@ inline u16 dsp_decrease_addr_reg(u16 reg, s16 _ix) return nar; } -inline u16 dsp_increment_addr_reg(u16 reg) +static inline u16 dsp_increment_addr_reg(u16 reg) { u32 ar = g_dsp.r.ar[reg]; u32 wr = g_dsp.r.wr[reg]; @@ -110,7 +110,7 @@ inline u16 dsp_increment_addr_reg(u16 reg) return nar; } -inline u16 dsp_decrement_addr_reg(u16 reg) +static inline u16 dsp_decrement_addr_reg(u16 reg) { u32 ar = g_dsp.r.ar[reg]; u32 wr = g_dsp.r.wr[reg]; @@ -127,7 +127,7 @@ inline u16 dsp_decrement_addr_reg(u16 reg) // --- reg // --------------------------------------------------------------------------------------- -inline u16 dsp_op_read_reg(int reg) +static inline u16 dsp_op_read_reg(int reg) { switch (reg & 0x1f) { case DSP_REG_ST0: @@ -177,7 +177,7 @@ inline u16 dsp_op_read_reg(int reg) } } -inline void dsp_op_write_reg(int reg, u16 val) +static inline void dsp_op_write_reg(int reg, u16 val) { switch (reg & 0x1f) { // 8-bit sign extended registers. Should look at prod.h too... @@ -238,7 +238,7 @@ inline void dsp_op_write_reg(int reg, u16 val) } } -inline void dsp_conditional_extend_accum(int reg) +static inline void dsp_conditional_extend_accum(int reg) { switch (reg) { @@ -258,7 +258,7 @@ inline void dsp_conditional_extend_accum(int reg) // --- prod // --------------------------------------------------------------------------------------- -inline s64 dsp_get_long_prod() +static inline s64 dsp_get_long_prod() { #if PROFILE ProfilerAddDelta(g_dsp.err_pc, 1); @@ -274,7 +274,7 @@ inline s64 dsp_get_long_prod() return val; } -inline s64 dsp_get_long_prod_round_prodl() +static inline s64 dsp_get_long_prod_round_prodl() { s64 prod = dsp_get_long_prod(); diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_ADPCM.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_ADPCM.h index 3e60477fc1..9130bb9da4 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_ADPCM.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_ADPCM.h @@ -20,7 +20,7 @@ #include "../../DSP.h" -inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac) +static inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac) { while (samplePos < newSamplePos) { @@ -63,7 +63,7 @@ inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 // TODO: WTF is going on here?!? // Volume control (ramping) -inline u16 ADPCM_Vol(u16 vol, u16 delta) +static inline u16 ADPCM_Vol(u16 vol, u16 delta) { int x = vol; if (delta && delta < 0x5000) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 5647450afd..9b817c6308 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -37,7 +37,7 @@ // A shortcut to access the bitmaps #define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name)) -inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length) +static inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length) { wxMemoryInputStream is(data, length); return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1)); diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index 1818853390..bdafb3206d 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -46,8 +46,12 @@ else: if sys.platform == 'win32': files += ["stdafx.cpp"] elif sys.platform == 'darwin': - frameworksflags += ['-Wl,-framework,QuickTime', '-Wl,-no_arch_warnings'] - frameworksflags += ['-weak_framework', 'OpenCL'] + env['CPPPATH'] += ['#Externals'] + env['FRAMEWORKPATH'] += ['Externals/Cg'] + frameworksflags += ['-Wl,-weak_framework,Cg'] + frameworksflags += ['-Wl,-weak_framework,OpenCL'] + frameworksflags += ['-Wl,-weak_framework,QuickTime'] + frameworksflags += ['-Wl,-no_arch_warnings'] exe = '#' + env['prefix'] + '/Dolphin.app/Contents/MacOS/Dolphin' diff --git a/Source/Core/VideoCommon/Src/SConscript b/Source/Core/VideoCommon/Src/SConscript index 2ca731bdab..ff86acf99b 100644 --- a/Source/Core/VideoCommon/Src/SConscript +++ b/Source/Core/VideoCommon/Src/SConscript @@ -8,7 +8,6 @@ files = [ 'BPStructs.cpp', 'CPMemory.cpp', 'CommandProcessor.cpp', - 'Debugger.cpp', 'DLCache.cpp', 'Fifo.cpp', 'FramebufferManagerBase.cpp', @@ -44,4 +43,7 @@ files = [ 'memcpy_amd.cpp', ] +if env['HAVE_WX']: + files += ['Debugger.cpp'] + env['LIBS'] += env.StaticObject(files) diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index e1bd47077b..af53b0184b 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -296,7 +296,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, unsigned int newWidth = width; unsigned int newHeight = height; - sprintf(texPathTemp, "%s_%08lx_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (texHash & 0x00000000FFFFFFFFLL), texformat); + sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (texHash & 0x00000000FFFFFFFFLL), texformat); pcfmt = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, texformat, temp); if (pcfmt != PC_TEX_FMT_NONE) @@ -397,7 +397,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, if (false == File::Exists(szDir) || false == File::IsDirectory(szDir)) File::CreateDir(szDir); - sprintf(szTemp, "%s/%s_%08lx_%i.png", szDir, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (texHash & 0x00000000FFFFFFFFLL), texformat); + sprintf(szTemp, "%s/%s_%08x_%i.png", szDir, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (texHash & 0x00000000FFFFFFFFLL), texformat); if (false == File::Exists(szTemp)) entry->Save(szTemp); diff --git a/Source/DSPTool/Src/SConscript b/Source/DSPTool/Src/SConscript index 33df45ed1b..37bc47593b 100644 --- a/Source/DSPTool/Src/SConscript +++ b/Source/DSPTool/Src/SConscript @@ -12,9 +12,4 @@ libs = [ env['dspcore'], ] -if sys.platform == 'darwin': - frames = ['CoreFoundation'] -else: - frames = [] - -env.Program('dsptool', files, LIBS = libs, FRAMEWORKS = frames) +env.Program('dsptool', files, LIBS = libs) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWGLUtil.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWGLUtil.cpp index fe547aa18d..d0ea0d022f 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWGLUtil.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWGLUtil.cpp @@ -108,7 +108,7 @@ unsigned int VideoBackend::PeekMessages() void VideoBackend::UpdateFPSDisplay(const char *text) { char temp[100]; - snprintf(temp, sizeof temp, "%s | OpenGL | %s", svn_rev_str, text); + snprintf(temp, sizeof temp, "%s | Software | %s", svn_rev_str, text); OpenGL_SetWindowText(temp); } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp index 5ece33f192..7e85fb3580 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp @@ -87,11 +87,6 @@ void VideoBackend::EmuStateChange(EMUSTATE_CHANGE newState) } -//bool IsD3D() -//{ -// return false; -//} - void VideoBackend::Shutdown() { SWRenderer::Shutdown(); diff --git a/Source/UnitTests/SConscript b/Source/UnitTests/SConscript index 38c6432bfb..b4d8476a22 100644 --- a/Source/UnitTests/SConscript +++ b/Source/UnitTests/SConscript @@ -14,9 +14,4 @@ libs = [ env['dspcore'], ] -if sys.platform == 'darwin': - frames = ['CoreFoundation'] -else: - frames = [] - -env.Program('tester', files, LIBS = libs, FRAMEWORKS = frames) +env.Program('tester', files, LIBS = libs)