From 6d70c14d12a5f60a94dce365f3ce911504de7b83 Mon Sep 17 00:00:00 2001 From: Soren Jorvang Date: Fri, 4 Feb 2011 00:46:56 +0000 Subject: [PATCH] In the SCons build, skip the generation of static libraries and just operate on lists of object files instead. This helps with LTO since LLVM/clang LTO is completely broken by static libraries. It also helps identify symbol clashes between components like the former plugins. Many linkers also expect static libraries to form a strict DAG which turns out be a difficult rule to uphold in practice, especially since some of our platforms aren't picky about this. LTO builds currently appears to crash at runtime because of the static wx libs. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7056 8ced0084-cf51-0410-be5f-012b33b47a6e --- Externals/Bochs_disasm/SConscript | 4 +- Externals/CLRun/SConscript | 2 +- Externals/GLew/SConscript | 9 ++-- Externals/LZO/SConscript | 7 +-- Externals/SDL/SConscript | 6 ++- Externals/SFML/src/SConscript | 3 +- Externals/SOIL/SConscript | 3 +- Externals/zlib/SConscript | 7 ++- SConstruct | 27 +++++------ Source/Core/AudioCommon/Src/SConscript | 2 +- Source/Core/Common/Src/SConscript | 2 +- Source/Core/Core/Src/SConscript | 2 +- Source/Core/DebuggerUICommon/Src/SConscript | 2 +- Source/Core/DebuggerWX/Src/SConscript | 2 +- Source/Core/DiscIO/Src/SConscript | 2 +- Source/Core/DolphinWX/Src/SConscript | 45 +++++++------------ Source/Core/InputCommon/Src/SConscript | 2 +- Source/Core/VideoCommon/Src/SConscript | 2 +- Source/Core/VideoUICommon/Src/SConscript | 2 +- Source/Plugins/Plugin_VideoOGL/Src/SConscript | 2 +- .../Plugin_VideoSoftware/Src/CPMemLoader.cpp | 38 ++++++++-------- .../Plugin_VideoSoftware/Src/EfbCopy.cpp | 2 +- .../Plugin_VideoSoftware/Src/HwRasterizer.cpp | 2 +- .../Plugin_VideoSoftware/Src/HwRasterizer.h | 2 +- .../Plugin_VideoSoftware/Src/SConscript | 2 +- .../Plugin_VideoSoftware/Src/SWGLUtil.cpp | 33 +++++++++++++- .../Plugin_VideoSoftware/Src/SWRenderer.cpp | 2 +- .../Plugin_VideoSoftware/Src/SWmain.cpp | 9 ---- 28 files changed, 118 insertions(+), 105 deletions(-) diff --git a/Externals/Bochs_disasm/SConscript b/Externals/Bochs_disasm/SConscript index 0894d8020b..247036893d 100644 --- a/Externals/Bochs_disasm/SConscript +++ b/Externals/Bochs_disasm/SConscript @@ -14,5 +14,7 @@ files = [ if sys.platform == 'win32': files += [ "stdafx.cpp" ] -env.StaticLibrary(env['local_libs'] + "bdisasm", files) env['CPPPATH'] += ['#Externals/Bochs_disasm'] +#env['LIBS'] += env.StaticObject(files) +bochs = env.StaticObject(files) +env['LIBS'] += bochs diff --git a/Externals/CLRun/SConscript b/Externals/CLRun/SConscript index 71fa8780a2..61ee43ebc8 100644 --- a/Externals/CLRun/SConscript +++ b/Externals/CLRun/SConscript @@ -13,5 +13,5 @@ files = [ 'clrun/genclgl.c', ] -env.StaticLibrary(env['local_libs'] + 'clrun', files) env['CPPPATH'] += ['#Externals/CLRun/include'] +env['LIBS'] += env.StaticObject(files) diff --git a/Externals/GLew/SConscript b/Externals/GLew/SConscript index 872cefa7e4..996893b34e 100644 --- a/Externals/GLew/SConscript +++ b/Externals/GLew/SConscript @@ -4,16 +4,19 @@ Import('env') import sys if env.has_key('shared_glew') and env['shared_glew']: + env['LIBS'] += 'GLEW' Return() if sys.platform == 'darwin': - libs = ['GLEW'] + libs = [] frames = ['AGL', 'OpenGL'] else: - libs = ['GLEW', 'GL', 'GLU'] + libs = ['GL', 'GLU'] frames = [] +glew = env.StaticObject('src/glew.c') +libs += glew env.Program('glewinfo', 'src/glewinfo.c', LIBS = libs, FRAMEWORKS = frames) env.Program('visualinfo', 'src/visualinfo.c', LIBS = libs, FRAMEWORKS = frames) -env.StaticLibrary(env['local_libs'] + 'GLEW', ['src/glew.c']) env['CPPPATH'] += ['#Externals/GLew/include'] +env['LIBS'] += glew diff --git a/Externals/LZO/SConscript b/Externals/LZO/SConscript index 463cc8856c..0505a27a0e 100644 --- a/Externals/LZO/SConscript +++ b/Externals/LZO/SConscript @@ -3,11 +3,8 @@ Import('env') if env.has_key('shared_lzo') and env['shared_lzo']: + env['LIBS'] += 'lzo2' Return() -files = [ - "minilzo.c", - ] - -env.StaticLibrary(env['local_libs'] + "lzo2", files) env['CPPPATH'] += ['#Externals/LZO'] +env['LIBS'] += env.StaticObject('minilzo.c') diff --git a/Externals/SDL/SConscript b/Externals/SDL/SConscript index 0bb73cde5d..b555b07e2e 100644 --- a/Externals/SDL/SConscript +++ b/Externals/SDL/SConscript @@ -3,7 +3,11 @@ Import('env') import sys +if sys.platform == 'darwin': + Return() + if env.has_key('shared_sdl') and env['shared_sdl']: + env['LIBS'] += 'SDL' Return() files = [ @@ -38,5 +42,5 @@ else: 'src/joystick/dummy/SDL_sysjoystick.c', ] -env.StaticLibrary(env['local_libs'] + "SDL", files) env['CPPPATH'] += ['#Externals/SDL', '#Externals/SDL/include'] +env['LIBS'] += env.StaticObject(files) diff --git a/Externals/SFML/src/SConscript b/Externals/SFML/src/SConscript index 258d3df72a..c81bd662e3 100644 --- a/Externals/SFML/src/SConscript +++ b/Externals/SFML/src/SConscript @@ -3,6 +3,7 @@ Import('env') if env.has_key('shared_sfml') and env['shared_sfml']: + env['LIBS'] += 'sfml-network' Return() files = [ @@ -16,5 +17,5 @@ files = [ "SFML/Network/Unix/SocketHelper.cpp", ] -env.StaticLibrary(env['local_libs'] + "sfml-network", files) env['CPPPATH'] += ['#Externals/SFML/include'] +env['LIBS'] += env.StaticObject(files) diff --git a/Externals/SOIL/SConscript b/Externals/SOIL/SConscript index 805f36412e..c07128d1b0 100644 --- a/Externals/SOIL/SConscript +++ b/Externals/SOIL/SConscript @@ -3,6 +3,7 @@ Import('env') if env.has_key('shared_soil') and env['shared_soil']: + env['LIBS'] += 'SOIL' Return() files = [ @@ -12,5 +13,5 @@ files = [ 'stb_image_aug.c' ] -env.StaticLibrary(env['local_libs'] + "SOIL", files) env['CPPPATH'] += ['#Externals/SOIL'] +env['LIBS'] += env.StaticObject(files) diff --git a/Externals/zlib/SConscript b/Externals/zlib/SConscript index e648c37e6c..230e85b776 100644 --- a/Externals/zlib/SConscript +++ b/Externals/zlib/SConscript @@ -1,8 +1,13 @@ # -*- python -*- Import('env') +import sys + +if sys.platform == 'darwin': + Return() if env.has_key('shared_zlib') and env['shared_zlib']: + env['LIBS'] += 'z' Return() files = [ @@ -20,5 +25,5 @@ files = [ 'zutil.c', ] -env.StaticLibrary(env['local_libs'] + "z", files) env['CPPPATH'] += ['#Externals/zlib'] +env['LIBS'] += env.StaticObject(files) diff --git a/SConstruct b/SConstruct index 1dd9c5c185..38e009b532 100644 --- a/SConstruct +++ b/SConstruct @@ -103,9 +103,6 @@ env['LIBS'] = [] env['build_dir'] = 'Build' + os.sep + platform.system() + \ '-' + platform.machine() + '-' + env['flavor'] -# Static libs go here -env['local_libs'] = '#' + env['build_dir'] + os.sep + 'libs' + os.sep - # Default install path if not env.has_key('install') or env['install'] == 'local': env['prefix'] = 'Binary' + os.sep + platform.system() + \ @@ -122,10 +119,6 @@ if sys.platform == 'darwin': env['CCFLAGS'] += ['-Wextra-tokens', '-Wnewline-eof'] env['CCFLAGS'] += ['-march=core2', '-mdynamic-no-pic'] env['CCFLAGS'] += ['-Xarch_i386', '-msse3', '-Xarch_x86_64', '-mssse3'] - env['CC'] = '/Developer/usr/bin/llvm-gcc' - env['CXX'] = '/Developer/usr/bin/llvm-g++' - #env['CC'] = 'clang' - #env['CXX'] = 'clang++' env['CXXFLAGS'] += ['-x', 'objective-c++'] env['FRAMEWORKS'] += ['AppKit', 'Carbon', 'CoreFoundation', 'CoreServices'] env['FRAMEWORKS'] += ['AudioToolbox', 'AudioUnit', 'CoreAudio', 'WebKit'] @@ -136,6 +129,15 @@ if sys.platform == 'darwin': env['LINKFLAGS'] += ['-Wl,-pagezero_size,0x1000'] env['LINKFLAGS'] += ['-Wl,-search_paths_first'] + if env['ENV'].has_key('CC'): + env['CC'] = env['ENV']['CC'] + else: + env['CC'] = '/Developer/usr/bin/llvm-gcc' + if env['ENV'].has_key('CXX'): + env['CXX'] = env['ENV']['CXX'] + else: + env['CXX'] = '/Developer/usr/bin/llvm-g++' + if env['nowx']: env['HAVE_WX'] = 0 else: @@ -157,8 +159,6 @@ if sys.platform == 'darwin': env['CPPPATH'] += ['#Externals'] env['FRAMEWORKPATH'] += ['Externals/Cg'] env['FRAMEWORKS'] += ['Cg'] - env['shared_sdl'] = True - env['shared_zlib'] = True env['data_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/Resources' @@ -318,11 +318,6 @@ else: env.Alias('install', env['prefix']) -# Local (static) libraries must be first in the search path for the build in -# order that they can override system libraries, but they must not be found -# during autoconfiguration as they will then be detected as system libraries. -env['LIBPATH'].insert(0, env['local_libs']) - dirs = [ 'Externals/Bochs_disasm', 'Externals/CLRun', @@ -343,10 +338,10 @@ dirs = [ 'Source/Core/InputCommon/Src', 'Source/Core/VideoCommon/Src', 'Source/Core/VideoUICommon/Src', - 'Source/DSPTool/Src', + #'Source/DSPTool/Src', 'Source/Plugins/Plugin_VideoOGL/Src', 'Source/Plugins/Plugin_VideoSoftware/Src', - 'Source/UnitTests', + #'Source/UnitTests', ] # Now that platform configuration is done, propagate it to modules diff --git a/Source/Core/AudioCommon/Src/SConscript b/Source/Core/AudioCommon/Src/SConscript index 90c02a2fc1..22af0c70f0 100644 --- a/Source/Core/AudioCommon/Src/SConscript +++ b/Source/Core/AudioCommon/Src/SConscript @@ -26,4 +26,4 @@ else: files += [ 'DSoundStream.cpp' ] files += [ 'XAudio2Stream.cpp' ] -env.StaticLibrary(env['local_libs'] + 'audiocommon', files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Core/Common/Src/SConscript b/Source/Core/Common/Src/SConscript index eb076681fa..577633fc1a 100644 --- a/Source/Core/Common/Src/SConscript +++ b/Source/Core/Common/Src/SConscript @@ -53,5 +53,5 @@ if sys.platform == 'win32': files += [ "ExtendedTrace.cpp" ] files += [ "stdafx.cpp" ] -env.StaticLibrary(env['local_libs'] + "common", files) env['CPPPATH'] += ['.'] +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Core/Core/Src/SConscript b/Source/Core/Core/Src/SConscript index f3dfe985bc..0b5fe90e85 100644 --- a/Source/Core/Core/Src/SConscript +++ b/Source/Core/Core/Src/SConscript @@ -196,4 +196,4 @@ elif sys.platform == 'linux2' and env['HAVE_BLUEZ']: else: files += [ "HW/BBA-TAP/TAP_Unix.cpp", "HW/WiimoteReal/IODummy.cpp" ] -env.StaticLibrary(env['local_libs'] + 'core', files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Core/DebuggerUICommon/Src/SConscript b/Source/Core/DebuggerUICommon/Src/SConscript index 07145a79a1..19ad35c23b 100644 --- a/Source/Core/DebuggerUICommon/Src/SConscript +++ b/Source/Core/DebuggerUICommon/Src/SConscript @@ -11,4 +11,4 @@ files = [ 'MemoryView.cpp', ] -env.StaticLibrary(env['local_libs'] + 'debugger_ui_util', files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Core/DebuggerWX/Src/SConscript b/Source/Core/DebuggerWX/Src/SConscript index da7beae7cc..de272a5105 100644 --- a/Source/Core/DebuggerWX/Src/SConscript +++ b/Source/Core/DebuggerWX/Src/SConscript @@ -20,4 +20,4 @@ files = [ "JitWindow.cpp", ] -env.StaticLibrary(env['local_libs'] + "debwx", files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Core/DiscIO/Src/SConscript b/Source/Core/DiscIO/Src/SConscript index 909545c018..01f0972b81 100644 --- a/Source/Core/DiscIO/Src/SConscript +++ b/Source/Core/DiscIO/Src/SConscript @@ -26,4 +26,4 @@ files = [ 'WiiWad.cpp', ] -env.StaticLibrary(env['local_libs'] + 'discio', files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index 8f36f1e40c..1818853390 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -6,15 +6,12 @@ import sys from SconsTests import utils files = ['BootManager.cpp'] -ldflags = [] -libs = [] +frameworksflags = [] if not env['HAVE_WX']: files += ['MainNoGUI.cpp'] else: - files += ['Main.cpp'] - - libfiles = [ + files += [ 'AboutDolphin.cpp', 'ARCodeAddEdit.cpp', 'GeckoCodeDiag.cpp', @@ -32,6 +29,7 @@ else: 'PatchAddEdit.cpp', 'PHackSettings.cpp', 'CheatsWindow.cpp', + 'Main.cpp', 'MemcardManager.cpp', 'MemoryCards/GCMemcard.cpp', 'MemoryCards/WiiSaveCrypted.cpp', @@ -45,28 +43,18 @@ else: 'WxUtils.cpp', ] - env.StaticLibrary(env['local_libs'] + "dolphinwx", libfiles) - - libs += ['debwx', 'debugger_ui_util', 'dolphinwx'] - -libs += ['core', 'common', 'discio', 'plugin_videoogl', 'plugin_videosoftware'] -if env['HAVE_WX']: - libs += ['videouicommon'] -libs += ['audiocommon', 'inputcommon', 'videocommon'] -libs += ['GLEW', 'SOIL', 'bdisasm', 'lzo2', 'sfml-network', 'z'] - if sys.platform == 'win32': - files += [ "stdafx.cpp" ] + files += ["stdafx.cpp"] elif sys.platform == 'darwin': - ldflags += ['-Wl,-framework,QuickTime', '-Wl,-no_arch_warnings'] - ldflags += ['-weak_framework', 'OpenCL'] + frameworksflags += ['-Wl,-framework,QuickTime', '-Wl,-no_arch_warnings'] + frameworksflags += ['-weak_framework', 'OpenCL'] exe = '#' + env['prefix'] + '/Dolphin.app/Contents/MacOS/Dolphin' if env['HAVE_WX']: - libs += env['wxconfiglibs'] + env['LIBS'] += env['wxconfiglibs'] else: - libs += [ 'iconv' ] + env['LIBS'] += ['iconv'] exe += 'NoGUI' env.Install('#' + env['prefix'] + '/Dolphin.app/Contents/' + @@ -121,18 +109,15 @@ elif sys.platform == 'darwin': CFBundleTypeRole = 'Viewer')] ))) - env.Command('dummy', '#' + env['prefix'], - "find $SOURCES -name .svn -exec rm -rf {} +") else: - files += [ 'X11Utils.cpp' ] - libs += [ 'SDL', 'clrun' ] - if env['HAVE_WX']: - exe = env['binary_dir'] + '/dolphin-emu' - else: - exe = env['binary_dir'] + '/dolphin-emu-nogui' + files += ['X11Utils.cpp'] + exe = env['binary_dir'] + '/dolphin-emu' + if not env['HAVE_WX']: + exe += '-nogui' env.InstallAs(env['data_dir'] + '/sys', '#Data/Sys') env.InstallAs(env['data_dir'] + '/user', '#Data/User') -linkflags = ldflags + env['LINKFLAGS'] +env.Command('dummy', '#' + env['prefix'], + "find $SOURCES -name .svn -exec rm -rf {} +") -env.Program(exe, files, LIBS = libs + env['LIBS'], LINKFLAGS = linkflags) +env.Program(exe, files, FRAMEWORKSFLAGS = frameworksflags) diff --git a/Source/Core/InputCommon/Src/SConscript b/Source/Core/InputCommon/Src/SConscript index 597acf2cb1..ef0564e53c 100644 --- a/Source/Core/InputCommon/Src/SConscript +++ b/Source/Core/InputCommon/Src/SConscript @@ -30,4 +30,4 @@ elif env['HAVE_X11']: 'ControllerInterface/Xlib/Xlib.cpp', ] -env.StaticLibrary(env['local_libs'] + "inputcommon", files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Core/VideoCommon/Src/SConscript b/Source/Core/VideoCommon/Src/SConscript index 80e467bb63..2ca731bdab 100644 --- a/Source/Core/VideoCommon/Src/SConscript +++ b/Source/Core/VideoCommon/Src/SConscript @@ -44,4 +44,4 @@ files = [ 'memcpy_amd.cpp', ] -env.StaticLibrary(env['local_libs'] + "videocommon", files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Core/VideoUICommon/Src/SConscript b/Source/Core/VideoUICommon/Src/SConscript index 6f2d6ae3a9..9c1989f2a0 100644 --- a/Source/Core/VideoUICommon/Src/SConscript +++ b/Source/Core/VideoUICommon/Src/SConscript @@ -10,4 +10,4 @@ files = [ 'DebuggerPanel.cpp', ] -env.StaticLibrary(env['local_libs'] + 'videouicommon', files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index 32a3c73504..3eae4097d0 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -19,4 +19,4 @@ files = [ 'GLUtil.cpp' ] -env.StaticLibrary(env['local_libs'] + 'plugin_videoogl', files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/CPMemLoader.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/CPMemLoader.cpp index d13d5f1a50..081f35a15e 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/CPMemLoader.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/CPMemLoader.cpp @@ -20,61 +20,61 @@ #include "HW/Memmap.h" // CP state -u8 *cached_arraybases[16]; +static u8 *_cached_arraybases[16]; // STATE_TO_SAVE -u32 arraybases[16]; -u32 arraystrides[16]; -TMatrixIndexA MatrixIndexA; -TMatrixIndexB MatrixIndexB; -TVtxDesc g_VtxDesc; -VAT g_VtxAttr[8]; +static u32 _arraybases[16]; +static u32 _arraystrides[16]; +static TMatrixIndexA _MatrixIndexA; +static TMatrixIndexB _MatrixIndexB; +static TVtxDesc _g_VtxDesc; +static VAT _g_VtxAttr[8]; void SWLoadCPReg(u32 sub_cmd, u32 value) { switch (sub_cmd & 0xF0) { case 0x30: - MatrixIndexA.Hex = value; + _MatrixIndexA.Hex = value; break; case 0x40: - MatrixIndexB.Hex = value; + _MatrixIndexB.Hex = value; break; case 0x50: - g_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits - g_VtxDesc.Hex |= value; + _g_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits + _g_VtxDesc.Hex |= value; break; case 0x60: - g_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits - g_VtxDesc.Hex |= (u64)value << 17; + _g_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits + _g_VtxDesc.Hex |= (u64)value << 17; break; case 0x70: _assert_((sub_cmd & 0x0F) < 8); - g_VtxAttr[sub_cmd & 7].g0.Hex = value; + _g_VtxAttr[sub_cmd & 7].g0.Hex = value; break; case 0x80: _assert_((sub_cmd & 0x0F) < 8); - g_VtxAttr[sub_cmd & 7].g1.Hex = value; + _g_VtxAttr[sub_cmd & 7].g1.Hex = value; break; case 0x90: _assert_((sub_cmd & 0x0F) < 8); - g_VtxAttr[sub_cmd & 7].g2.Hex = value; + _g_VtxAttr[sub_cmd & 7].g2.Hex = value; break; // Pointers to vertex arrays in GC RAM case 0xA0: - arraybases[sub_cmd & 0xF] = value; - cached_arraybases[sub_cmd & 0xF] = Memory::GetPointer(value); + _arraybases[sub_cmd & 0xF] = value; + _cached_arraybases[sub_cmd & 0xF] = Memory::GetPointer(value); break; case 0xB0: - arraystrides[sub_cmd & 0xF] = value & 0xFF; + _arraystrides[sub_cmd & 0xF] = value & 0xFF; break; } } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp index 985a2af1a3..62f00b22b8 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp @@ -25,7 +25,7 @@ #include "DebugUtil.h" #include "HwRasterizer.h" #include "SWCommandProcessor.h" -#include "SWGLUtil.h" +#include "../../Plugin_VideoOGL/Src/GLUtil.h" #include "HW/Memmap.h" #include "Core.h" diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp index f4053ac547..0974141444 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp @@ -22,7 +22,7 @@ #include "BPMemLoader.h" #include "HwRasterizer.h" -#include "SWGLUtil.h" +#include "../../Plugin_VideoOGL/Src/GLUtil.h" #include "NativeVertexFormat.h" #include "DebugUtil.h" diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.h b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.h index 21b002e737..568c313215 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.h @@ -21,7 +21,7 @@ #include #include "BPMemLoader.h" -#include "SWGLUtil.h" +#include "../../Plugin_VideoOGL/Src/GLUtil.h" struct OutputVertexData; diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript index 6edce8a73c..625a5250e7 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript @@ -36,4 +36,4 @@ if env['HAVE_WX']: if sys.platform == 'win32': files += [ 'Win32.cpp' ] -env.StaticLibrary(env['local_libs'] + 'plugin_videosoftware', files) +env['LIBS'] += env.StaticObject(files) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWGLUtil.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWGLUtil.cpp index 209b2417d6..fe547aa18d 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWGLUtil.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWGLUtil.cpp @@ -21,9 +21,11 @@ #include "ConfigManager.h" #include "Core.h" #include "Host.h" +#include "VideoBackend.h" #include "SWGLUtil.h" +#if 0 #if defined(_WIN32) #include "Win32.h" static HDC hDC = NULL; // Private GDI Device Context @@ -78,15 +80,41 @@ void OpenGL_SetWindowText(const char *text) XStoreName(GLWin.dpy, GLWin.win, text); #endif } +#endif + +namespace SW +{ + +// Draw messages on top of the screen +unsigned int VideoBackend::PeekMessages() +{ +#ifdef _WIN32 + // TODO: peekmessage + MSG msg; + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) + { + if (msg.message == WM_QUIT) + return FALSE; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return TRUE; +#else + return false; +#endif +} // Show the current FPS -void UpdateFPSDisplay(const char *text) +void VideoBackend::UpdateFPSDisplay(const char *text) { char temp[100]; - snprintf(temp, sizeof temp, "%s | Software | %s", svn_rev_str, text); + snprintf(temp, sizeof temp, "%s | OpenGL | %s", svn_rev_str, text); OpenGL_SetWindowText(temp); } +} + +#if 0 // Create rendering window. // Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize() bool OpenGL_Create(int _twidth, int _theight) @@ -454,3 +482,4 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line) } return true; } +#endif diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp index 80ca257803..276628bf4c 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp @@ -18,7 +18,7 @@ #include "Common.h" #include "Core.h" -#include "SWGLUtil.h" +#include "../../Plugin_VideoOGL/Src/GLUtil.h" #include "SWRenderer.h" #include "SWStatistics.h" #include "../../Plugin_VideoOGL/Src/RasterFont.h" diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp index 69abc1e9a6..5ece33f192 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp @@ -190,13 +190,4 @@ void VideoBackend::Video_AbortFrame(void) { } -void VideoBackend::UpdateFPSDisplay(const char*) -{ -} - -unsigned int VideoBackend::PeekMessages() -{ - return 0; -} - }