summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2013-09-12 02:40:17 +0200
committerPierre Bourdon <delroth@gmail.com>2013-09-14 06:08:30 +0200
commite7213ca4b16593b676031802dd353a14a77c8a60 (patch)
tree93753bce891a43dbf0edf6fe241a98cf8bcd35c0 /Source
parent6bdb6585d6174415105f335b3982fbc7e39fb560 (diff)
Overlay the user Shaders/ over the shared one to avoid copying files
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinWX/Src/Main.cpp17
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp8
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/main.cpp39
3 files changed, 41 insertions, 23 deletions
diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp
index 9fae1f2999..7ba77501c0 100644
--- a/Source/Core/DolphinWX/Src/Main.cpp
+++ b/Source/Core/DolphinWX/Src/Main.cpp
@@ -253,27 +253,26 @@ bool DolphinApp::OnInit()
//TODO : detect the revision and upgrade where necessary
File::CopyDir(std::string(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP),
File::GetUserPath(D_GAMECONFIG_IDX));
- File::CopyDir(std::string(SHARED_USER_DIR SHADERS_DIR DIR_SEP),
- File::GetUserPath(D_SHADERS_IDX));
File::CopyDir(std::string(SHARED_USER_DIR WII_USER_DIR DIR_SEP),
File::GetUserPath(D_WIIUSER_IDX));
File::CopyDir(std::string(SHARED_USER_DIR OPENCL_DIR DIR_SEP),
File::GetUserPath(D_OPENCL_IDX));
File::CreateFullPath(File::GetUserPath(D_USER_IDX));
- File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));
- File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
+ File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
- File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
- File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
- File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
- File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
- File::CreateFullPath(File::GetUserPath(D_MAPS_IDX));
+ File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + USA_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + EUR_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP);
+ File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
+ File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
+ File::CreateFullPath(File::GetUserPath(D_MAPS_IDX));
+ File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
+ File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX));
+ File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
LogManager::Init();
SConfig::Init();
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp
index d5899038fc..c1563a74e2 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include "CommonPaths.h"
#include "FileUtil.h"
#include "VideoCommon.h"
#include "VideoConfig.h"
@@ -150,7 +151,12 @@ void ApplyShader()
// loading shader code
std::string code;
- std::string path = File::GetUserPath(D_SHADERS_IDX) + g_ActiveConfig.sPostProcessingShader + ".txt";
+ std::string path = File::GetUserPath(D_SHADERS_IDX) + g_ActiveConfig.sPostProcessingShader + ".glsl";
+ if (!File::Exists(path))
+ {
+ // Fallback to shared user dir
+ path = File::GetSysDirectory() + SHADERS_DIR DIR_SEP + g_ActiveConfig.sPostProcessingShader + ".glsl";
+ }
if(!File::ReadFileToString(true, path.c_str(), code)) {
ERROR_LOG(VIDEO, "Post-processing shader not found: %s", path.c_str());
return;
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
index 1eb986fe74..9e38b80fed 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
@@ -38,6 +38,7 @@ Make AA apply instantly during gameplay if possible
#include "Globals.h"
#include "Atomic.h"
+#include "CommonPaths.h"
#include "Thread.h"
#include "LogManager.h"
@@ -102,25 +103,37 @@ std::string VideoBackend::GetDisplayName()
void GetShaders(std::vector<std::string> &shaders)
{
+ std::set<std::string> already_found;
+
shaders.clear();
- if (File::IsDirectory(File::GetUserPath(D_SHADERS_IDX)))
+ static const std::string directories[] = {
+ File::GetUserPath(D_SHADERS_IDX),
+ File::GetSysDirectory() + SHADERS_DIR DIR_SEP,
+ };
+ for (size_t i = 0; i < ArraySize(directories); ++i)
{
+ if (!File::IsDirectory(directories[i]))
+ continue;
+
File::FSTEntry entry;
- File::ScanDirectoryTree(File::GetUserPath(D_SHADERS_IDX), entry);
- for (u32 i = 0; i < entry.children.size(); i++)
+ File::ScanDirectoryTree(directories[i], entry);
+ for (u32 j = 0; j < entry.children.size(); j++)
{
- std::string name = entry.children[i].virtualName.c_str();
- if (!strcasecmp(name.substr(name.size() - 4).c_str(), ".txt")) {
- name = name.substr(0, name.size() - 4);
- shaders.push_back(name);
- }
+ std::string name = entry.children[j].virtualName.c_str();
+ if (name.size() < 5)
+ continue;
+ if (strcasecmp(name.substr(name.size() - 5).c_str(), ".glsl"))
+ continue;
+
+ name = name.substr(0, name.size() - 5);
+ if (already_found.find(name) != already_found.end())
+ continue;
+
+ already_found.insert(name);
+ shaders.push_back(name);
}
- std::sort(shaders.begin(), shaders.end());
- }
- else
- {
- File::CreateDir(File::GetUserPath(D_SHADERS_IDX).c_str());
}
+ std::sort(shaders.begin(), shaders.end());
}
void InitBackendInfo()