From 53ae9e9e8fdb932e4f89aa3d6727e0d8231ffc5c Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 1 Feb 2011 04:20:51 +0000 Subject: [PATCH] Fixed vs2010 SVNRevGen project. (Also changed "make_svnrev.h.vbs" to jscript and gave it some comments :p) Removed some old plugin stuff. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7030 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/SVNRevGen.vcxproj | 22 ++++--- Source/Core/Common/Src/CommonPaths.h | 30 ---------- Source/Core/Common/Src/FileUtil.cpp | 17 ------ Source/Core/Common/make_svnrev.h.js | 79 ++++++++++++++++++++++++++ Source/Core/Common/make_svnrev.h.vbs | 55 ------------------ Source/Core/Core/Src/ConfigManager.cpp | 6 +- 6 files changed, 95 insertions(+), 114 deletions(-) create mode 100644 Source/Core/Common/make_svnrev.h.js delete mode 100644 Source/Core/Common/make_svnrev.h.vbs diff --git a/Source/Core/Common/SVNRevGen.vcxproj b/Source/Core/Common/SVNRevGen.vcxproj index 8899a6d3fa..fbe3da45d1 100644 --- a/Source/Core/Common/SVNRevGen.vcxproj +++ b/Source/Core/Common/SVNRevGen.vcxproj @@ -6,6 +6,17 @@ Win32 + + + cscript /nologo /E:JScript "make_svnrev.h.js" + Updating svnrev.h + dummy + + + + + + {69F00340-5C3D-449F-9A80-958435C6CF06} SVNRevGen @@ -43,17 +54,14 @@ true - cscript /nologo /E:VBScript "make_svnrev.h.vbs" - - - dummy + + + + - - - diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index c2a42481eb..3d08c568a2 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -21,35 +21,10 @@ // Make sure we pick up USER_DIR if set in config.h #include "Common.h" -// Library suffix/prefix -#ifdef _WIN32 - #define PLUGIN_PREFIX "" - #define PLUGIN_SUFFIX ".dll" -#elif defined __APPLE__ - #define PLUGIN_PREFIX "lib" - #define PLUGIN_SUFFIX ".dylib" -#else - #define PLUGIN_PREFIX "lib" - #define PLUGIN_SUFFIX ".so" -#endif - // Directory seperators, do we need this? #define DIR_SEP "/" #define DIR_SEP_CHR '/' -// Location of the plugins -#ifdef _WIN32 - #define PLUGINS_DIR "Plugins" -#elif defined __APPLE__ - #define PLUGINS_DIR "Contents/PlugIns" -#else - #ifdef LIBS_DIR - #define PLUGINS_DIR LIBS_DIR - #else - #define PLUGINS_DIR "plugins" - #endif -#endif - // The user data dir #define ROOT_DIR "." #ifdef _WIN32 @@ -131,11 +106,6 @@ #define RAM_DUMP "ram.raw" #define ARAM_DUMP "aram.raw" -// Plugin files -#define DEFAULT_GFX_PLUGIN PLUGIN_PREFIX "Plugin_VideoOGL" PLUGIN_SUFFIX -#define DEFAULT_DSP_PLUGIN PLUGIN_PREFIX "Plugin_DSP_HLE" PLUGIN_SUFFIX -#define DEFAULT_WIIMOTE_PLUGIN PLUGIN_PREFIX "Plugin_Wiimote" PLUGIN_SUFFIX - // Sys files #define TOTALDB "totaldb.dsy" diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 33e3ea5b64..48f99d8c1a 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -603,23 +603,6 @@ std::string GetBundleDirectory() } #endif -std::string GetPluginsDirectory() -{ - std::string pluginsDir; - -#if defined (__APPLE__) - pluginsDir = GetBundleDirectory(); - pluginsDir += DIR_SEP; - pluginsDir += PLUGINS_DIR; -#else - pluginsDir = PLUGINS_DIR; -#endif - pluginsDir += DIR_SEP; - - INFO_LOG(COMMON, "GetPluginsDirectory: Setting to %s:", pluginsDir.c_str()); - return pluginsDir; -} - std::string GetSysDirectory() { std::string sysDir; diff --git a/Source/Core/Common/make_svnrev.h.js b/Source/Core/Common/make_svnrev.h.js new file mode 100644 index 0000000000..38bcda312a --- /dev/null +++ b/Source/Core/Common/make_svnrev.h.js @@ -0,0 +1,79 @@ +var wshShell = new ActiveXObject("WScript.Shell") +var oFS = new ActiveXObject("Scripting.FileSystemObject"); + +var outfile = "./Src/svnrev.h"; +var svncmd = "SubWCRev ../../.. ./Src/svnrev_template.h " + outfile; +var svntestcmd = "SubWCRev ../../.."; +var hgcmd = "hg svn info"; + +var SVN = 1, HG = 2; +var file_rev = 0, cur_rev = 0, cur_cms = 0; + +function RunCmdGetMatch(cmd, regex) +{ + // run the command + try + { + var cmdexec = wshShell.Exec(cmd); + } + catch (e) + { + // catch "the system cannot find the file specified" error + return 0; + } + // ReadLine is synchronous + while (!cmdexec.StdOut.AtEndOfStream) + { + var reg_exec = regex.exec(cmdexec.StdOut.ReadLine()) + if (reg_exec) + return reg_exec[1]; // return first capture group + } + // failed + return 0; +} + +if (oFS.FileExists(outfile)) +{ + // file exists, read the value of SVN_REV_STR + file_rev = oFS.OpenTextFile(outfile).ReadLine().match(/\d+/); +} +else +{ + // file doesn't exist, create it + oFS.CreateTextFile(outfile); +} + +// get the "Last commited at revision" from SubWCRev's output +cur_rev = RunCmdGetMatch(svntestcmd, /^Last .*?(\d+)/); +if (cur_rev) + cur_cms = SVN; +else +{ + // SubWCRev failed, so use hg + cur_rev = RunCmdGetMatch(hgcmd, /Revision.*?(\d+)/); + if (cur_rev) + cur_cms = HG; + else + { + WScript.Echo("Neither SVN or Hg revision info found!"); + WScript.Quit(1); + } +} + +// check if svnrev.h needs updating +if (cur_rev == file_rev) +{ + WScript.Echo("svnrev.h doesn't need updating (already at " + cur_rev + ")"); + WScript.Quit(0); +} +else if (cur_cms == SVN) +{ + // update using SubWCRev and template file + var ret = wshShell.run(svncmd, 0, true); +} +else +{ + // manually create the file + oFS.CreateTextFile(outfile, true).WriteLine("#define SVN_REV_STR \"" + cur_rev + "\""); +} +WScript.Echo("svnrev.h updated (" + cur_rev + ")"); \ No newline at end of file diff --git a/Source/Core/Common/make_svnrev.h.vbs b/Source/Core/Common/make_svnrev.h.vbs deleted file mode 100644 index 33b8eef59f..0000000000 --- a/Source/Core/Common/make_svnrev.h.vbs +++ /dev/null @@ -1,55 +0,0 @@ -set wshShell = CreateObject("WScript.Shell") -outfile = "./Src/svnrev.h" -svncmd = "SubWCRev ../../.. ./Src/svnrev_template.h " & outfile -svntestcmd = "SubWCRev ../../.." -hgcmd = "hg svn info" -const svn = 0 -const hg = 1 - -set oFS = CreateObject("Scripting.fileSystemObject") -if not oFS.FileExists(outfile) then - oFS.CreateTextFile(outfile) - file_rev = 0 -else - set oFile = oFS.OpenTextFile(outfile) - set re = new regexp - re.pattern = "[0-9]+" - file_rev = re.execute(oFile.readline)(0) -end if - -set testexec = wshShell.exec(svntestcmd) -do while testexec.status = 0 : wscript.sleep 100 : loop -if testexec.exitcode = 0 then - testout = testexec.stdout.readall - set re = new regexp - re.pattern = "Last committed at revision [0-9]+" - cur_rev = split(re.execute(testout)(0))(4) - cur_cms = svn -else - set hgexec = wshShell.exec(hgcmd) - do while hgexec.status = 0 : wscript.sleep 100 : loop - do while true - line = hgexec.stdout.readline - if instr(line, "Revision") then - cur_rev = split(line)(1) - cur_cms = hg - exit do - end if - if hgexec.stdout.atEndofStream then - wscript.echo "Neither SVN or Hg revision info found!" - wscript.quit 1 - end if - loop -end if - -if file_rev = cur_rev then - wscript.echo "svnrev.h doesn't need updating" - wscript.quit 0 -elseif cur_cms = svn then - ret = wshShell.run(svncmd, 0, true) -elseif cur_cms = hg then - set oFile = CreateObject("Scripting.fileSystemObject").CreateTextFile(outfile, true) - oFile.writeline("#define SVN_REV_STR """ & cur_rev & """") -else - wscript.echo "WTF, shouldn't be here!" -end if \ No newline at end of file diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index ce768c4777..20e0ba02ba 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -197,10 +197,6 @@ void SConfig::LoadSettings() IniFile ini; ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); - // Hard coded defaults - m_DefaultGFXPlugin = DEFAULT_GFX_PLUGIN; - m_DefaultDSPPlugin = DEFAULT_DSP_PLUGIN; - // General { ini.Get("General", "LastFilename", &m_LastFilename); @@ -319,7 +315,7 @@ void SConfig::LoadSettings() // Plugins // TODO: change key name, it's no longer a plugin - ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str()); + ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, ""); } m_SYSCONF = new SysConf();