diff --git a/SConstruct b/SConstruct index 1b33b89194..6b2ea6611b 100644 --- a/SConstruct +++ b/SConstruct @@ -140,10 +140,8 @@ if sys.platform == 'darwin': env['FRAMEWORKSFLAGS'] += ['-Xarch_i386', '-Wl,-framework,QuickTime'] env['LIBPATH'] += ['/usr/lib'] env['LINKFLAGS'] += ccld + env['LINKFLAGS'] += ['-Wl,-pagezero_size,0x1000'] env['LINKFLAGS'] += ['-Wl,-search_paths_first', '-Wl,-Z', '-F' + system] - env['SHCCFLAGS'] = env['CCFLAGS'] # Get rid of the -fPIC added in gcc.py - env['SHLINKFLAGS'] += ['-Wl,-undefined,dynamic_lookup'] - env['SHLINKFLAGS'] += ['-Xarch_i386', '-Wl,-read_only_relocs,suppress'] if env['nowx']: env['HAVE_WX'] = 0 @@ -171,7 +169,6 @@ if sys.platform == 'darwin': env['shared_zlib'] = True env['data_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/Resources' - env['plugin_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/PlugIns' if env['bundle']: app = env['prefix'] + '/Dolphin.app' @@ -300,14 +297,12 @@ else: if env['install'] == 'local': env['binary_dir'] = '#' + env['prefix'] env['data_dir'] = '#' + env['prefix'] - env['plugin_dir'] = '#' + env['prefix'] + '/plugins' if env['bundle']: env.Tar(tarname, env['prefix']) else: env['prefix'] = Dir(env['prefix']).abspath env['binary_dir'] = env['prefix'] + '/bin' env['data_dir'] = env['prefix'] + "/share/dolphin-emu" - env['plugin_dir'] = env['prefix'] + '/lib/dolphin-emu' conf.Define('DATA_DIR', "\"" + env['data_dir'] + "/\"") conf.Define('LIBS_DIR', "\"" + env['prefix'] + '/lib/dolphin-emu/' + "\"") # Setup destdir for package building @@ -317,7 +312,6 @@ else: env['destdir'] = Dir(env['destdir']).abspath env['binary_dir'] = env['destdir'] + env['binary_dir'] env['data_dir'] = env['destdir'] + env['data_dir'] - env['plugin_dir'] = env['destdir'] + env['plugin_dir'] env['prefix'] = env['destdir'] + env['prefix'] if env['bundle']: env.Command(tarname + env['TARSUFFIX'], env['prefix'], @@ -343,12 +337,13 @@ dirs = [ 'Externals/Lua', 'Externals/GLew', 'Externals/LZO', - #'Externals/OpenAL', 'Externals/SDL', 'Externals/SOIL', 'Externals/SFML/src', #'Externals/wxWidgets', 'Externals/zlib', + 'Source/Plugins/Plugin_VideoOGL/Src', + #'Source/Plugins/Plugin_VideoSoftware/Src', 'Source/Core/AudioCommon/Src', 'Source/Core/Common/Src', 'Source/Core/Core/Src', @@ -361,8 +356,6 @@ dirs = [ 'Source/Core/VideoCommon/Src', 'Source/Core/VideoUICommon/Src', 'Source/DSPTool/Src', - 'Source/Plugins/Plugin_VideoOGL/Src', - 'Source/Plugins/Plugin_VideoSoftware/Src', 'Source/UnitTests', ] diff --git a/Source/Core/Common/Src/DynamicLibrary.cpp b/Source/Core/Common/Src/DynamicLibrary.cpp index ff2833a6b4..401c7bc993 100644 --- a/Source/Core/Common/Src/DynamicLibrary.cpp +++ b/Source/Core/Common/Src/DynamicLibrary.cpp @@ -76,17 +76,20 @@ int DynamicLibrary::Load(const char* filename) #ifdef _WIN32 library = LoadLibrary(filename); -#else +#elif defined __linux__ // RTLD_NOW: resolve all symbols on load // RTLD_LOCAL: don't resolve symbols for other libraries library = dlopen(filename, RTLD_NOW | RTLD_LOCAL); +#else + library = RTLD_SELF; + return 1; #endif DEBUG_LOG(COMMON, "DL: LoadLibrary: %s(%p)", filename, library); if (!library) { ERROR_LOG(COMMON, "DL: Error loading DLL %s: %s", filename, - DllGetLastError()); + DllGetLastError()); return 0; } @@ -104,33 +107,35 @@ int DynamicLibrary::Load(const char* filename) int DynamicLibrary::Unload() { INFO_LOG(COMMON, "DL: Unloading dynamic library %s", library_file.c_str()); - int retval; - if (!IsLoaded()) { // library != null + int retval; + if (!IsLoaded()) { // library != null ERROR_LOG(COMMON, "DL: Unload failed for %s: not loaded", - library_file.c_str()); - PanicAlert("DL: Unload failed %s: not loaded", - library_file.c_str()); - return 0; - } + library_file.c_str()); + PanicAlert("DL: Unload failed %s: not loaded", + library_file.c_str()); + return 0; + } - DEBUG_LOG(COMMON, "DL: FreeLibrary: %s %p\n", - library_file.c_str(), library); + DEBUG_LOG(COMMON, "DL: FreeLibrary: %s %p\n", + library_file.c_str(), library); #ifdef _WIN32 - retval = FreeLibrary(library); + retval = FreeLibrary(library); #else - retval = dlclose(library)?0:1; + if (library == RTLD_SELF) + return 1; + else + retval = dlclose(library) ? 0 : 1; #endif - if (! retval) { - ERROR_LOG(COMMON, "DL: Unload failed %s: %s", - library_file.c_str(), - DllGetLastError()); - } - library = 0; + if (! retval) { + ERROR_LOG(COMMON, "DL: Unload failed %s: %s", + library_file.c_str(), DllGetLastError()); + } + library = 0; INFO_LOG(COMMON, "DL: Done unloading dynamic library %s", library_file.c_str()); - return retval; + return retval; } // Returns the address where symbol funcname is loaded or NULL on failure @@ -156,11 +161,10 @@ void* DynamicLibrary::Get(const char* funcname) const if (!retval) { WARN_LOG(COMMON, "DL: Symbol %s missing in %s (error: %s)\n", - funcname, library_file.c_str(), - DllGetLastError()); + funcname, library_file.c_str(), DllGetLastError()); } INFO_LOG(COMMON, "DL: Done getting symbol %s: %s", library_file.c_str(), - funcname); + funcname); return retval; } diff --git a/Source/Core/Common/Src/PluginVideo.cpp b/Source/Core/Common/Src/PluginVideo.cpp index 394d21d5ee..a2028135fc 100644 --- a/Source/Core/Common/Src/PluginVideo.cpp +++ b/Source/Core/Common/Src/PluginVideo.cpp @@ -30,18 +30,18 @@ PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo Video_Screenshot = 0; Video_AddMessage = 0; Video_AccessEFB = 0; - Video_SetRendering = 0; - Video_CommandProcessorRead16 = 0; - Video_CommandProcessorWrite16 = 0; - Video_PixelEngineRead16 = 0; - Video_PixelEngineWrite16 = 0; - Video_PixelEngineWrite32 = 0; - Video_GatherPipeBursted = 0; - Video_WaitForFrameFinish = 0; + Video_SetRendering = 0; + Video_CommandProcessorRead16 = 0; + Video_CommandProcessorWrite16 = 0; + Video_PixelEngineRead16 = 0; + Video_PixelEngineWrite16 = 0; + Video_PixelEngineWrite32 = 0; + Video_GatherPipeBursted = 0; + Video_WaitForFrameFinish = 0; Video_IsFifoBusy = 0; Video_AbortFrame = 0; - Video_Prepare = reinterpret_cast + Video_Prepare = reinterpret_cast (LoadSymbol("Video_Prepare")); Video_BeginField = reinterpret_cast (LoadSymbol("Video_BeginField")); @@ -59,43 +59,43 @@ PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo (LoadSymbol("Video_AccessEFB")); Video_SetRendering = reinterpret_cast (LoadSymbol("Video_SetRendering")); - Video_CommandProcessorRead16 = reinterpret_cast + Video_CommandProcessorRead16 = reinterpret_cast (LoadSymbol("Video_CommandProcessorRead16")); - Video_CommandProcessorWrite16 = reinterpret_cast + Video_CommandProcessorWrite16 = reinterpret_cast (LoadSymbol("Video_CommandProcessorWrite16")); - Video_PixelEngineRead16 = reinterpret_cast + Video_PixelEngineRead16 = reinterpret_cast (LoadSymbol("Video_PixelEngineRead16")); - Video_PixelEngineWrite16 = reinterpret_cast + Video_PixelEngineWrite16 = reinterpret_cast (LoadSymbol("Video_PixelEngineWrite16")); - Video_PixelEngineWrite32 = reinterpret_cast + Video_PixelEngineWrite32 = reinterpret_cast (LoadSymbol("Video_PixelEngineWrite32")); - Video_GatherPipeBursted = reinterpret_cast + Video_GatherPipeBursted = reinterpret_cast (LoadSymbol("Video_GatherPipeBursted")); - Video_WaitForFrameFinish = reinterpret_cast + Video_WaitForFrameFinish = reinterpret_cast (LoadSymbol("Video_WaitForFrameFinish")); - Video_IsFifoBusy = reinterpret_cast + Video_IsFifoBusy = reinterpret_cast (LoadSymbol("Video_IsFifoBusy")); - Video_AbortFrame = reinterpret_cast + Video_AbortFrame = reinterpret_cast (LoadSymbol("Video_AbortFrame")); - if ((Video_Prepare != 0) && - (Video_BeginField != 0) && - (Video_EndField != 0) && - (Video_EnterLoop != 0) && - (Video_ExitLoop != 0) && - (Video_Screenshot != 0) && - (Video_AddMessage != 0) && - (Video_SetRendering != 0) && - (Video_AccessEFB != 0) && - (Video_SetRendering != 0) && - (Video_CommandProcessorRead16 != 0) && - (Video_CommandProcessorWrite16 != 0) && - (Video_PixelEngineRead16 != 0) && - (Video_PixelEngineWrite16 != 0) && - (Video_PixelEngineWrite32 != 0) && - (Video_GatherPipeBursted != 0) && - (Video_WaitForFrameFinish != 0) && - (Video_IsFifoBusy != 0) && - (Video_AbortFrame != 0)) + if ((Video_Prepare != 0) && + (Video_BeginField != 0) && + (Video_EndField != 0) && + (Video_EnterLoop != 0) && + (Video_ExitLoop != 0) && + (Video_Screenshot != 0) && + (Video_AddMessage != 0) && + (Video_SetRendering != 0) && + (Video_AccessEFB != 0) && + (Video_SetRendering != 0) && + (Video_CommandProcessorRead16 != 0) && + (Video_CommandProcessorWrite16 != 0) && + (Video_PixelEngineRead16 != 0) && + (Video_PixelEngineWrite16 != 0) && + (Video_PixelEngineWrite32 != 0) && + (Video_GatherPipeBursted != 0) && + (Video_WaitForFrameFinish != 0) && + (Video_IsFifoBusy != 0) && + (Video_AbortFrame != 0)) validVideo = true; } diff --git a/Source/Core/Common/Src/PluginVideo.h b/Source/Core/Common/Src/PluginVideo.h index 43e4dc00fc..0e76b2eac0 100644 --- a/Source/Core/Common/Src/PluginVideo.h +++ b/Source/Core/Common/Src/PluginVideo.h @@ -27,7 +27,7 @@ typedef void (__cdecl* TVideo_Prepare)(); typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32); typedef void (__cdecl* TVideo_BeginField)(u32, FieldType, u32, u32); typedef void (__cdecl* TVideo_EndField)(); -typedef bool (__cdecl* TVideo_Screenshot)(const char* filename); +typedef void (__cdecl* TVideo_Screenshot)(const char* filename); typedef void (__cdecl* TVideo_EnterLoop)(); typedef void (__cdecl* TVideo_ExitLoop)(); typedef void (__cdecl* TVideo_SetRendering)(bool bEnabled); diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index 7fb771038d..fdeb46535a 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -125,12 +125,6 @@ CPluginInfo::CPluginInfo(const char *_rFilename) : m_Filename(_rFilename) , m_Valid(false) { - if (!File::Exists((File::GetPluginsDirectory() + _rFilename).c_str())) - { - PanicAlertT("Can't find plugin %s", _rFilename); - return; - } - // Check if the functions that are common to all plugins are present Common::CPlugin *plugin = new Common::CPlugin(_rFilename); if (plugin->IsValid()) @@ -174,32 +168,7 @@ void CPluginManager::GetPluginInfo(CPluginInfo *&info, std::string Filename) below. */ void *CPluginManager::LoadPlugin(const char *_rFilename) { - if (!File::Exists((File::GetPluginsDirectory() + _rFilename).c_str())) { - PanicAlertT("Error loading plugin %s: can't find file. Please re-select your plugins.", _rFilename); - return NULL; - } - /* Avoid calling LoadLibrary() again and instead point to the plugin info that we found when - Dolphin was started */ - CPluginInfo *info = NULL; - GetPluginInfo(info, _rFilename); - if (!info) { - PanicAlertT("Error loading %s: can't read info", _rFilename); - return NULL; - } - - PLUGIN_TYPE type = info->GetPluginInfo().Type; - Common::CPlugin *plugin = NULL; - - switch (type) - { - case PLUGIN_TYPE_VIDEO: - plugin = new Common::PluginVideo(_rFilename); - break; - - default: - PanicAlertT("Trying to load unsupported type %d", type); - return NULL; - } + Common::CPlugin *plugin = new Common::PluginVideo(_rFilename); // Check that the plugin has all the common and all the type specific functions if (!plugin->IsValid()) @@ -296,12 +265,6 @@ void CPluginManager::EmuStateChange(PLUGIN_EMUSTATE newState) // Open config window. Input: _rFilename = Plugin filename , Type = Plugin type void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type) { - if (! File::Exists((File::GetPluginsDirectory() + _rFilename).c_str())) - { - PanicAlertT("Can't find plugin %s", _rFilename); - return; - } - switch(Type) { case PLUGIN_TYPE_VIDEO: @@ -318,12 +281,6 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY // Open debugging window. Type = Video or DSP. Show = Show or hide window. void *CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show) { - if (!File::Exists((File::GetPluginsDirectory() + _rFilename).c_str())) - { - PanicAlert("Can't find plugin %s", _rFilename); - return NULL; - } - switch(Type) { case PLUGIN_TYPE_VIDEO: diff --git a/Source/Core/DebuggerWX/Src/DSPDebugWindow.cpp b/Source/Core/DebuggerWX/Src/DSPDebugWindow.cpp index 19c2e7fb4f..4c11a0c917 100644 --- a/Source/Core/DebuggerWX/Src/DSPDebugWindow.cpp +++ b/Source/Core/DebuggerWX/Src/DSPDebugWindow.cpp @@ -29,10 +29,6 @@ #include "MemoryView.h" #include "HW/DSPLLE/DSPSymbols.h" -// Define these here to avoid undefined symbols while still saving functionality -void Host_NotifyMapLoaded() {} -void Host_UpdateBreakPointView() {} - DSPDebuggerLLE* m_DebuggerFrame = NULL; BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxPanel) diff --git a/Source/Core/DebuggerWX/Src/DSPRegisterView.cpp b/Source/Core/DebuggerWX/Src/DSPRegisterView.cpp index dcfb330ca6..863d09436c 100644 --- a/Source/Core/DebuggerWX/Src/DSPRegisterView.cpp +++ b/Source/Core/DebuggerWX/Src/DSPRegisterView.cpp @@ -19,7 +19,7 @@ #include "DSPRegisterView.h" -wxString CRegTable::GetValue(int row, int col) +wxString CDSPRegTable::GetValue(int row, int col) { if (row < 32) // 32 "normal" regs { @@ -33,11 +33,11 @@ wxString CRegTable::GetValue(int row, int col) return wxString::FromAscii(""); } -void CRegTable::SetValue(int, int, const wxString &) +void CDSPRegTable::SetValue(int, int, const wxString &) { } -void CRegTable::UpdateCachedRegs() +void CDSPRegTable::UpdateCachedRegs() { if (m_CachedCounter == g_dsp.step_counter) { @@ -53,7 +53,7 @@ void CRegTable::UpdateCachedRegs() } } -wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind) +wxGridCellAttr *CDSPRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind) { wxGridCellAttr *attr = new wxGridCellAttr(); @@ -79,7 +79,7 @@ wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind) DSPRegisterView::DSPRegisterView(wxWindow *parent, wxWindowID id) : wxGrid(parent, id, wxDefaultPosition, wxSize(130, 120)) { - SetTable(new CRegTable(), true); + SetTable(new CDSPRegTable(), true); SetRowLabelSize(0); SetColLabelSize(0); DisableDragRowSize(); @@ -89,6 +89,6 @@ DSPRegisterView::DSPRegisterView(wxWindow *parent, wxWindowID id) void DSPRegisterView::Update() { - ((CRegTable *)GetTable())->UpdateCachedRegs(); + ((CDSPRegTable *)GetTable())->UpdateCachedRegs(); ForceRefresh(); } diff --git a/Source/Core/DebuggerWX/Src/DSPRegisterView.h b/Source/Core/DebuggerWX/Src/DSPRegisterView.h index ba4fabee62..4fd5ebc018 100644 --- a/Source/Core/DebuggerWX/Src/DSPRegisterView.h +++ b/Source/Core/DebuggerWX/Src/DSPRegisterView.h @@ -21,17 +21,17 @@ #include -class CRegTable : public wxGridTableBase +class CDSPRegTable : public wxGridTableBase { private: u64 m_CachedCounter; u16 m_CachedRegs[32]; bool m_CachedRegHasChanged[32]; - DECLARE_NO_COPY_CLASS(CRegTable); + DECLARE_NO_COPY_CLASS(CDSPRegTable); public: - CRegTable() + CDSPRegTable() { memset(m_CachedRegs, 0, sizeof(m_CachedRegs)); memset(m_CachedRegHasChanged, 0, sizeof(m_CachedRegHasChanged)); diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index cd88088848..85a7fbf555 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -251,8 +251,10 @@ void CConfigMain::UpdateGUI() PathsPage->Disable(); +#if defined _WIN32 || defined __linux__ // Disable stuff on PluginsPage GraphicSelection->Disable(); +#endif } } @@ -434,8 +436,10 @@ void CConfigMain::InitializeGUIValues() ApploaderPath->SetPath(wxString(startup_params.m_strApploader.c_str(), *wxConvCurrent)); +#if defined _WIN32 || defined __linux__ // Plugins FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, startup_params.m_strVideoPlugin); +#endif } void CConfigMain::InitializeGUITooltips() @@ -501,10 +505,12 @@ void CConfigMain::CreateGUIControls() Notebook->AddPage(GeneralPage, _("General")); Notebook->AddPage(DisplayPage, _("Display")); Notebook->AddPage(AudioPage, _("Audio")); - Notebook->AddPage(GamecubePage, _("GC")); + Notebook->AddPage(GamecubePage, _("Gamecube")); Notebook->AddPage(WiiPage, _("Wii")); Notebook->AddPage(PathsPage, _("Paths")); +#if defined _WIN32 || defined __linux__ Notebook->AddPage(PluginsPage, _("Plugins")); +#endif // General page @@ -865,6 +871,7 @@ void CConfigMain::CreateGUIControls() PathsPage->SetSizer(sPathsPage); +#if defined _WIN32 || defined __linux__ // Plugins page sbGraphicsPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, _("Graphics")); GraphicSelection = new wxChoice(PluginsPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator); @@ -879,6 +886,7 @@ void CConfigMain::CreateGUIControls() sPluginsPage->Add(sbGraphicsPlugin, 0, wxEXPAND|wxALL, 5); PluginsPage->SetSizer(sPluginsPage); +#endif m_Ok = new wxButton(this, wxID_OK); diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index cb79f3a0c7..8863f92219 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -10,8 +10,8 @@ files = [ ] libs = [ - 'audiocommon', 'core', 'dspcore', 'lzo2', 'discio', 'bdisasm', - 'inputcommon', 'common', 'lua', 'z', 'sfml-network', + 'audiocommon', 'bdisasm', 'common', 'core', 'discio', 'dspcore', + 'inputcommon', 'lua', 'lzo2', 'sfml-network', 'z', 'GLEW', 'SOIL', ] wxlibs = [ ] @@ -62,9 +62,8 @@ else: if sys.platform == 'win32': files += [ "stdafx.cpp" ] elif sys.platform == 'darwin': - ldflags += [ '-Wl,-pagezero_size,0x1000' ] - ldflags += [ '-Wl,-ObjC' ] # XXX Hack to include wxGLCanvas libs += [ 'iconv' ] + ldflags += [ '-Wl,-force_load,' + env['libvideo'][0].path ] exe = '#' + env['prefix'] + '/Dolphin.app/Contents/MacOS/Dolphin' if env['HAVE_WX']: diff --git a/Source/Core/VideoCommon/Src/SConscript b/Source/Core/VideoCommon/Src/SConscript index 56b893c6e4..9bc96706c9 100644 --- a/Source/Core/VideoCommon/Src/SConscript +++ b/Source/Core/VideoCommon/Src/SConscript @@ -40,7 +40,6 @@ files = [ 'VideoState.cpp', 'XFBConvert.cpp', 'XFMemory.cpp', - 'XFMemory.cpp', 'XFStructs.cpp', 'memcpy_amd.cpp', ] diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp index d2e7125c07..ad7b80503f 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp @@ -2070,13 +2070,13 @@ void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center) PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt,bool rgbaOnly) { - PC_TexFormat retval = PC_TEX_FMT_NONE; - - if (g_Config.bEnableOpenCL) - retval = TexDecoder_Decode_OpenCL(dst, src, width, height, texformat, tlutaddr, tlutfmt, rgbaOnly); - - if(retval == PC_TEX_FMT_NONE) - retval = rgbaOnly ? TexDecoder_Decode_RGBA((u32*)dst,src,width,height,texformat,tlutaddr,tlutfmt) : TexDecoder_Decode_real(dst,src,width,height,texformat,tlutaddr,tlutfmt); + PC_TexFormat retval = TexDecoder_Decode_OpenCL(dst, src, + width, height, texformat, tlutaddr, tlutfmt, rgbaOnly); + if (retval == PC_TEX_FMT_NONE) + retval = rgbaOnly ? TexDecoder_Decode_RGBA((u32*)dst, src, + width, height, texformat, tlutaddr, tlutfmt) + : TexDecoder_Decode_real(dst, src, + width, height, texformat, tlutaddr, tlutfmt); if ((!TexFmt_Overlay_Enable)|| (retval == PC_TEX_FMT_NONE)) return retval; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index a8131e4964..1b9bc8ebc7 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -4,8 +4,6 @@ Import('env') import os import sys -name = os.sep + "Plugin_VideoOGL" - files = [ 'RasterFont.cpp', 'Render.cpp', @@ -21,9 +19,9 @@ files = [ 'GLUtil.cpp' ] -libs = [ 'videocommon', 'GLEW', 'SOIL', 'common' ] +env['LIBS'] += ['videocommon'] if env['HAVE_WX']: - libs += [ 'videouicommon' ] + env['LIBS'] += [ 'videouicommon' ] -env.SharedLibrary(env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) +env['libvideo'] = env.StaticLibrary(env['local_libs'] + 'video', files) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp index 3280fbd58c..3dc38ac0e8 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp @@ -274,7 +274,7 @@ namespace Clipper void ProcessTriangle(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2) { - if (stats.thisFrame.numDrawnObjects < g_Config.drawStart || stats.thisFrame.numDrawnObjects >= g_Config.drawEnd ) + if (stats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawStart || stats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawEnd ) return; INCSTAT(stats.thisFrame.numTrianglesIn) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp index c35fc91e2f..c14aced6f5 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp @@ -216,10 +216,10 @@ void OnObjectBegin() { if (!g_bSkipCurrentFrame) { - if (g_Config.bDumpTextures && stats.thisFrame.numDrawnObjects >= g_Config.drawStart && stats.thisFrame.numDrawnObjects < g_Config.drawEnd) + if (g_SWVideoConfig.bDumpTextures && stats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawStart && stats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawEnd) DumpActiveTextures(); - if (g_Config.bHwRasterizer) + if (g_SWVideoConfig.bHwRasterizer) { HwRasterizer::BeginTriangles(); drawingHwTriangles = true; @@ -231,10 +231,10 @@ void OnObjectEnd() { if (!g_bSkipCurrentFrame) { - if (g_Config.bDumpObjects && stats.thisFrame.numDrawnObjects >= g_Config.drawStart && stats.thisFrame.numDrawnObjects < g_Config.drawEnd) + if (g_SWVideoConfig.bDumpObjects && stats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawStart && stats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawEnd) DumpEfb(StringFromFormat("%sobject%i.tga", File::GetUserPath(D_DUMPFRAMES_IDX), stats.thisFrame.numDrawnObjects).c_str()); - if (g_Config.bHwRasterizer || drawingHwTriangles) + if (g_SWVideoConfig.bHwRasterizer || drawingHwTriangles) { HwRasterizer::EndTriangles(); drawingHwTriangles = false; @@ -259,7 +259,7 @@ void OnFrameEnd() { if (!g_bSkipCurrentFrame) { - if (g_Config.bDumpFrames) + if (g_SWVideoConfig.bDumpFrames) { DumpEfb(StringFromFormat("%sframe%i_color.tga", File::GetUserPath(D_DUMPFRAMES_IDX), stats.frameCount).c_str()); DumpDepth(StringFromFormat("%sframe%i_depth.tga", File::GetUserPath(D_DUMPFRAMES_IDX), stats.frameCount).c_str()); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp index 19199714e2..ee6c300468 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp @@ -35,7 +35,7 @@ namespace EfbCopy { OpenGL_Update(); // just updates the render window position and the backbuffer size - if (!g_Config.bHwRasterizer) + if (!g_SWVideoConfig.bHwRasterizer) { // copy to open gl for rendering EfbInterface::UpdateColorTexture(); @@ -48,7 +48,7 @@ namespace EfbCopy void CopyToRam() { - if (!g_Config.bHwRasterizer) + if (!g_SWVideoConfig.bHwRasterizer) { u8 *dest_ptr = g_VideoInitialize.pGetMemoryPointer(bpmem.copyTexDest << 5); @@ -96,7 +96,7 @@ namespace EfbCopy if (bpmem.triggerEFBCopy.clear) { - if (g_Config.bHwRasterizer) + if (g_SWVideoConfig.bHwRasterizer) HwRasterizer::Clear(); else ClearEfb(); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp index 17fd435c84..98af555e9a 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp @@ -296,7 +296,7 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer { INCSTAT(stats.thisFrame.numTrianglesDrawn); - if (g_Config.bHwRasterizer) + if (g_SWVideoConfig.bHwRasterizer) { HwRasterizer::DrawTriangleFrontFace(v0, v1, v2); return; diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Renderer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Renderer.cpp index 360ee70789..e396383291 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Renderer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Renderer.cpp @@ -125,7 +125,7 @@ void Renderer::DrawDebugText() char *p = debugtext_buffer; p[0] = 0; - if (g_Config.bShowStats) + if (g_SWVideoConfig.bShowStats) { p+=sprintf(p,"Objects: %i\n",stats.thisFrame.numDrawnObjects); p+=sprintf(p,"Primatives: %i\n",stats.thisFrame.numPrimatives); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript index a26209a771..169ece38f2 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript @@ -4,8 +4,6 @@ Import('env') import os import sys -name = os.sep + "Plugin_VideoSoftware" - files = [ 'BPMemLoader.cpp', 'Clipper.cpp', @@ -40,6 +38,21 @@ if env['HAVE_WX']: if sys.platform == 'win32': files += [ 'Win32.cpp' ] -libs = [ 'videocommon', 'GLEW', 'SOIL', 'common' ] +#env['LIBS'] += ['videocommon'] +# +#if env['HAVE_WX']: +# env['LIBS'] += [ 'videouicommon' ] +# XXX partially converted to libvideocommon, but there are still conflicts +files += [ + '../../../Core/VideoCommon/Src/ImageWrite.cpp', + '../../../Core/VideoCommon/Src/IndexGenerator.cpp', + '../../../Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp', + '../../../Core/VideoCommon/Src/TextureDecoder.cpp', + '../../../Core/VideoCommon/Src/VertexLoader_Color.cpp', + '../../../Core/VideoCommon/Src/VertexLoader_Normal.cpp', + '../../../Core/VideoCommon/Src/VertexLoader_Position.cpp', + '../../../Core/VideoCommon/Src/VertexLoader_TextCoord.cpp', + '../../../Core/VideoCommon/Src/VertexManagerBase.cpp', + ] -env.SharedLibrary(env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) +env['libvideo'] = env.StaticLibrary(env['local_libs'] + 'video', files) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp index 6456d09e7a..053a20fadf 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp @@ -599,7 +599,7 @@ void Tev::Draw() IndirectLod[stageNum], IndirectLinear[stageNum], texmap, IndirectTex[stageNum]); #if ALLOW_TEV_DUMPS - if (g_Config.bDumpTevStages) + if (g_SWVideoConfig.bDumpTevStages) { u8 stage[4] = { IndirectTex[stageNum][TextureSampler::ALP_SMP], IndirectTex[stageNum][TextureSampler::BLU_SMP], @@ -635,7 +635,7 @@ void Tev::Draw() TextureSampler::Sample(TexCoord.s, TexCoord.t, TextureLod[stageNum], TextureLinear[stageNum], texmap, texel); #if ALLOW_TEV_DUMPS - if (g_Config.bDumpTevTextureFetches) + if (g_SWVideoConfig.bDumpTevTextureFetches) DebugUtil::DrawTempBuffer(texel, DIRECT_TFETCH + stageNum); #endif @@ -689,7 +689,7 @@ void Tev::Draw() Reg[ac.dest][ALP_C] = Clamp1024(Reg[ac.dest][ALP_C]); #if ALLOW_TEV_DUMPS - if (g_Config.bDumpTevStages) + if (g_SWVideoConfig.bDumpTevStages) { u8 stage[4] = {(u8)Reg[0][RED_C], (u8)Reg[0][GRN_C], (u8)Reg[0][BLU_C], (u8)Reg[0][ALP_C]}; DebugUtil::DrawTempBuffer(stage, DIRECT + stageNum); @@ -791,7 +791,7 @@ void Tev::Draw() } #if ALLOW_TEV_DUMPS - if (g_Config.bDumpTevStages) + if (g_SWVideoConfig.bDumpTevStages) { for (u32 i = 0; i < bpmem.genMode.numindstages; ++i) DebugUtil::CopyTempBuffer(Position[0], Position[1], INDIRECT, i, "Indirect"); @@ -799,7 +799,7 @@ void Tev::Draw() DebugUtil::CopyTempBuffer(Position[0], Position[1], DIRECT, i, "Stage"); } - if (g_Config.bDumpTevTextureFetches) + if (g_SWVideoConfig.bDumpTevTextureFetches) { for (u32 i = 0; i <= bpmem.genMode.numtevstages; ++i) { diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfig.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfig.cpp index 4dab4192df..d23b592802 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfig.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfig.cpp @@ -19,7 +19,7 @@ #include "IniFile.h" #include "VideoConfig.h" -SWVideoConfig g_Config; +SWVideoConfig g_SWVideoConfig; SWVideoConfig::SWVideoConfig() { diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfig.h b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfig.h index f10517331b..704803f6c6 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfig.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfig.h @@ -50,6 +50,6 @@ struct SWVideoConfig : NonCopyable u32 drawEnd; }; -extern SWVideoConfig g_Config; +extern SWVideoConfig g_SWVideoConfig; #endif // _PLUGIN_VIDEOSOFTWARE_CONFIG_H_ diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp index c37c4435d7..cf468d0c0d 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp @@ -49,7 +49,7 @@ VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title, wxDialog(parent, -1, wxString(wxT("Dolphin ")).append(wxString::FromAscii(title.c_str())).append(wxT(" Graphics Configuration")), wxDefaultPosition, wxDefaultSize), - vconfig(g_Config), + vconfig(g_SWVideoConfig), ininame(_ininame) { vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); @@ -137,7 +137,7 @@ void VideoConfigDialog::Event_ClickClose(wxCommandEvent&) void VideoConfigDialog::Event_Close(wxCloseEvent& ev) { - g_Config.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); + g_SWVideoConfig.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); ev.Skip(); } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Win32.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Win32.cpp index 177da8fcb7..f66d84e7be 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Win32.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Win32.cpp @@ -129,7 +129,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) { case VK_RETURN: // Pressing Alt+Enter switch FullScreen/Windowed - if (m_hParent == NULL && !g_Config.renderToMainframe) + if (m_hParent == NULL && !g_SWVideoConfig.renderToMainframe) { ToggleFullscreen(hWnd); } @@ -146,7 +146,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) switch (LOWORD( wParam )) { case VK_ESCAPE: - if (g_Config.bFullscreen) + if (g_SWVideoConfig.bFullscreen) { // Pressing Esc switches to Windowed mode from Fullscreen mode ToggleFullscreen(hWnd); @@ -195,7 +195,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) if (m_hParent == NULL) { // Take it out of fullscreen and stop the game - if( g_Config.bFullscreen ) + if( g_SWVidoConfig.bFullscreen ) ToggleFullscreen(m_hParent); PostMessage(m_hParent, WM_USER, WM_USER_STOP, 0); } @@ -262,7 +262,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T // Create new separate window else { - DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW; + DWORD style = g_SWVideoConfig.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW; RECT rc = {0, 0, width, height}; AdjustWindowRect(&rc, style, false); @@ -294,10 +294,10 @@ void ToggleFullscreen(HWND hParent) if (m_hParent == NULL) { int w_fs = 640, h_fs = 480; - if (g_Config.bFullscreen) + if (g_SWVideoConfig.bFullscreen) { // Get out of fullscreen - g_Config.bFullscreen = false; + g_SWVideoConfig.bFullscreen = false; RECT rc = {0, 0, w_fs, h_fs}; // FullScreen -> Desktop @@ -336,7 +336,7 @@ void ToggleFullscreen(HWND hParent) // Set new window style -> PopUp SetWindowLong(hParent, GWL_STYLE, WS_POPUP); - g_Config.bFullscreen = true; + g_SWVideoConfig.bFullscreen = true; ShowCursor(FALSE); // SetWindowPos to the upper-left corner of the screen diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp index 72c7d82b59..4004c1cf14 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp @@ -85,7 +85,7 @@ void Initialize(void *init) SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init; g_VideoInitialize = *_pVideoInitialize; - g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_software.ini").c_str()); + g_SWVideoConfig.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_software.ini").c_str()); InitBPMemory(); InitXFMemory();