diff --git a/.gitignore b/.gitignore index 5053d26db..d44fa3a25 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/desmume/src/frontend/windows/defaultconfig/scmrev.h /desmume/src/frontend/windows/.libs /desmume/src/frontend/windows/.obj /desmume/src/frontend/windows/__bins diff --git a/desmume/src/frontend/windows/defaultconfig/SubWCRev.bat b/desmume/src/frontend/windows/defaultconfig/SubWCRev.bat deleted file mode 100644 index 07fb657a3..000000000 --- a/desmume/src/frontend/windows/defaultconfig/SubWCRev.bat +++ /dev/null @@ -1,2 +0,0 @@ -defaultconfig\SubWCRev.exe ..\.. ".\defaultconfig\svnrev_template.h" ".\userconfig\svnrev.h" -exit 0 \ No newline at end of file diff --git a/desmume/src/frontend/windows/defaultconfig/SubWCRev.exe b/desmume/src/frontend/windows/defaultconfig/SubWCRev.exe deleted file mode 100644 index 0ec4188b1..000000000 Binary files a/desmume/src/frontend/windows/defaultconfig/SubWCRev.exe and /dev/null differ diff --git a/desmume/src/frontend/windows/defaultconfig/intl3_tsvn32.dll b/desmume/src/frontend/windows/defaultconfig/intl3_tsvn32.dll deleted file mode 100644 index 7aab20010..000000000 Binary files a/desmume/src/frontend/windows/defaultconfig/intl3_tsvn32.dll and /dev/null differ diff --git a/desmume/src/frontend/windows/defaultconfig/libapr_tsvn32.dll b/desmume/src/frontend/windows/defaultconfig/libapr_tsvn32.dll deleted file mode 100644 index 89a02a4c4..000000000 Binary files a/desmume/src/frontend/windows/defaultconfig/libapr_tsvn32.dll and /dev/null differ diff --git a/desmume/src/frontend/windows/defaultconfig/libaprutil_tsvn32.dll b/desmume/src/frontend/windows/defaultconfig/libaprutil_tsvn32.dll deleted file mode 100644 index d90cfb7ca..000000000 Binary files a/desmume/src/frontend/windows/defaultconfig/libaprutil_tsvn32.dll and /dev/null differ diff --git a/desmume/src/frontend/windows/defaultconfig/libsasl32.dll b/desmume/src/frontend/windows/defaultconfig/libsasl32.dll deleted file mode 100644 index 519552cc8..000000000 Binary files a/desmume/src/frontend/windows/defaultconfig/libsasl32.dll and /dev/null differ diff --git a/desmume/src/frontend/windows/defaultconfig/libsvn_tsvn32.dll b/desmume/src/frontend/windows/defaultconfig/libsvn_tsvn32.dll deleted file mode 100644 index 4f886a6c3..000000000 Binary files a/desmume/src/frontend/windows/defaultconfig/libsvn_tsvn32.dll and /dev/null differ diff --git a/desmume/src/frontend/windows/defaultconfig/make_scmrev.h.js b/desmume/src/frontend/windows/defaultconfig/make_scmrev.h.js new file mode 100644 index 000000000..f088387bd --- /dev/null +++ b/desmume/src/frontend/windows/defaultconfig/make_scmrev.h.js @@ -0,0 +1,100 @@ +var wshShell = new ActiveXObject("WScript.Shell") +var oFS = new ActiveXObject("Scripting.FileSystemObject"); + +var outfile = "./defaultconfig/scmrev.h"; +var cmd_revision = " rev-parse HEAD"; +var cmd_describe = " describe --always --long --dirty"; +var cmd_branch = " rev-parse --abbrev-ref HEAD"; + +function GetGitExe() +{ + try + { + gitexe = wshShell.RegRead("HKCU\\Software\\GitExtensions\\gitcommand"); + wshShell.Exec(gitexe); + return gitexe; + } + catch (e) + {} + + for (var gitexe in {"git.cmd":1, "git":1, "git.bat":1}) + { + try + { + wshShell.Exec(gitexe); + return gitexe; + } + catch (e) + {} + } + + // last try - msysgit not in path (vs2015 default) + msyspath = "\\Git\\cmd\\git.exe"; + gitexe = wshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%") + msyspath; + if (oFS.FileExists(gitexe)) { + return gitexe; + } + gitexe = wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%") + msyspath; + if (oFS.FileExists(gitexe)) { + return gitexe; + } + + WScript.Echo("Cannot find git or git.cmd, check your PATH:\n" + + wshShell.ExpandEnvironmentStrings("%PATH%")); + WScript.Quit(1); +} + +function GetFirstStdOutLine(cmd) +{ + try + { + return wshShell.Exec(cmd).StdOut.ReadLine(); + } + catch (e) + { + // catch "the system cannot find the file specified" error + WScript.Echo("Failed to exec " + cmd + " this should never happen"); + WScript.Quit(1); + } +} + +function GetFileContents(f) +{ + try + { + return oFS.OpenTextFile(f).ReadAll(); + } + catch (e) + { + // file doesn't exist + return ""; + } +} + +// get info from git +var gitexe = GetGitExe(); +var revision = GetFirstStdOutLine(gitexe + cmd_revision); +var describe = GetFirstStdOutLine(gitexe + cmd_describe); +var branch = GetFirstStdOutLine(gitexe + cmd_branch); +var isStable = +("master" == branch || "stable" == branch); + +// remove hash (and trailing "-0" if needed) from description +describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2'); + +var out_contents = + "#define SCM_REV_STR \"" + revision + "\"\n" + + "#define SCM_DESC_STR \"" + describe + "\"\n" + + "#define SCM_BRANCH_STR \"" + branch + "\"\n" + + "#define SCM_IS_MASTER " + isStable + "\n"; + +// check if file needs updating +if (out_contents == GetFileContents(outfile)) +{ + WScript.Echo(outfile + " current at " + describe); +} +else +{ + // needs updating - writeout current info + oFS.CreateTextFile(outfile, true).Write(out_contents); + WScript.Echo(outfile + " updated to " + describe); +} diff --git a/desmume/src/frontend/windows/defaultconfig/svnrev.h b/desmume/src/frontend/windows/defaultconfig/svnrev.h deleted file mode 100644 index e2669fba1..000000000 --- a/desmume/src/frontend/windows/defaultconfig/svnrev.h +++ /dev/null @@ -1,5 +0,0 @@ -//this should be overridden with one generated in userconfig -//but it is here just in case to prevent compiler errors - -#define SVN_REV 0 -#define SVN_REV_STR "0" \ No newline at end of file diff --git a/desmume/src/frontend/windows/defaultconfig/svnrev_template.h b/desmume/src/frontend/windows/defaultconfig/svnrev_template.h deleted file mode 100644 index d7a944d4b..000000000 --- a/desmume/src/frontend/windows/defaultconfig/svnrev_template.h +++ /dev/null @@ -1,2 +0,0 @@ -#define SVN_REV $WCREV$ -#define SVN_REV_STR "$WCREV$" \ No newline at end of file diff --git a/desmume/src/frontend/windows/desmume.props b/desmume/src/frontend/windows/desmume.props index 26f2ef910..34137515a 100644 --- a/desmume/src/frontend/windows/desmume.props +++ b/desmume/src/frontend/windows/desmume.props @@ -82,7 +82,7 @@ - defaultconfig\SubWCRev.bat + "%windir%\Sysnative\cscript" /nologo /E:JScript "defaultconfig\make_scmrev.h.js" diff --git a/desmume/src/saves.cpp b/desmume/src/saves.cpp index eaab756b4..0d1a35511 100644 --- a/desmume/src/saves.cpp +++ b/desmume/src/saves.cpp @@ -66,7 +66,7 @@ int lastSaveState = 0; //Keeps track of last savestate used for quick save/load #define SS_INDIRECT 0x80000000 u32 _DESMUME_version = EMU_DESMUME_VERSION_NUMERIC(); -u32 svn_rev = EMU_DESMUME_SUBVERSION_NUMERIC(); +u32 svn_rev = 0; //EMU_DESMUME_VERSION_NUMERIC(); //sorry, not using this now s64 save_time = 0; NDS_SLOT1_TYPE slot1Type = NDS_SLOT1_RETAIL_AUTO; NDS_SLOT2_TYPE slot2Type = NDS_SLOT2_AUTO; @@ -1044,7 +1044,7 @@ bool savestate_save (const char *file_name) static void writechunks(EMUFILE* os) { DateTime tm = DateTime::get_Now(); - svn_rev = EMU_DESMUME_SUBVERSION_NUMERIC(); + svn_rev = 0; save_time = tm.get_Ticks(); diff --git a/desmume/src/version.cpp b/desmume/src/version.cpp index acc10b9a0..b7f3188a7 100644 --- a/desmume/src/version.cpp +++ b/desmume/src/version.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2015 DeSmuME team + Copyright (C) 2009-2016 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,12 +31,15 @@ #define TOSTRING(x) STRINGIFY(x) #endif -//todo - everyone will want to support this eventually, i suppose -#if defined(HOST_WINDOWS) || defined(DESMUME_COCOA) +//TODO - it isn't possible to build a core without a frontend, so really this belongs with frontend modules +//the only stuff that belongs in the core is major/minor/build versions which are (in principle) used for versioning savestates and movies and such.. +#if defined(HOST_WINDOWS) + #include "scmrev.h" + #define SVN_REV_STR SCM_DESC_STR +#elif defined(DESMUME_COCOA) #include "svnrev.h" #else #ifndef SVN_REV - #define SVN_REV 0 #define SVN_REV_STR "0" #endif #endif @@ -106,7 +109,7 @@ #elif defined(PUBLIC_RELEASE) #define DESMUME_SUBVERSION_STRING "" #else - #define DESMUME_SUBVERSION_STRING " svn" SVN_REV_STR + #define DESMUME_SUBVERSION_STRING " git#" SVN_REV_STR #endif #ifdef __INTEL_COMPILER @@ -140,12 +143,6 @@ #define DESMUME_JIT "" #endif -#ifdef PUBLIC_RELEASE -const u32 DESMUME_SUBVERSION_NUMERIC = 0xFFFFFFFF; -#else -const u32 DESMUME_SUBVERSION_NUMERIC = SVN_REV; -#endif - const u8 DESMUME_VERSION_MAJOR = 0; const u8 DESMUME_VERSION_MINOR = 9; const u8 DESMUME_VERSION_BUILD = 12; @@ -155,7 +152,6 @@ const u8 DESMUME_VERSION_BUILD = 12; #define DESMUME_NAME_AND_VERSION DESMUME_NAME DESMUME_VERSION_STRING u32 EMU_DESMUME_VERSION_NUMERIC() { return DESMUME_VERSION_NUMERIC; } -u32 EMU_DESMUME_SUBVERSION_NUMERIC() { return DESMUME_SUBVERSION_NUMERIC; } const char* EMU_DESMUME_VERSION_STRING() { return DESMUME_VERSION_STRING; } const char* EMU_DESMUME_SUBVERSION_STRING() { return DESMUME_SUBVERSION_STRING; } const char* EMU_DESMUME_NAME_AND_VERSION() { return DESMUME_NAME_AND_VERSION; } diff --git a/desmume/src/version.h b/desmume/src/version.h index 692be7cdf..3c3608211 100644 --- a/desmume/src/version.h +++ b/desmume/src/version.h @@ -23,7 +23,6 @@ extern const u8 DESMUME_VERSION_MINOR; extern const u8 DESMUME_VERSION_BUILD; u32 EMU_DESMUME_VERSION_NUMERIC(); -u32 EMU_DESMUME_SUBVERSION_NUMERIC(); const char* EMU_DESMUME_VERSION_STRING(); const char* EMU_DESMUME_SUBVERSION_STRING(); const char* EMU_DESMUME_NAME_AND_VERSION();