From c7b639be28b717122c14441fcf81f38a315d8d65 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 12 Nov 2016 18:49:03 -0600 Subject: [PATCH] apply ArcadePit idea: Let user change the string in the emulator title bar via a file (but changed the format of the string to be more generally useful, and changed it to dll/custombuild.txt) --- BizHawk.Client.EmuHawk/MainForm.cs | 15 +++------------ Version/VersionInfo.cs | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index c64f71fbd4..adce5199a9 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -1385,18 +1385,6 @@ namespace BizHawk.Client.EmuHawk #region Private methods - private static string DisplayNameForSystem(string system) - { - var str = Global.SystemInfo.DisplayName; - - if (VersionInfo.DeveloperBuild) - { - str += " (interim)"; - } - - return str; - } - private void SetWindowText() { string str = string.Empty; @@ -1414,6 +1402,9 @@ namespace BizHawk.Client.EmuHawk str = str + string.Format("({0:0} fps) -", _runloopDisplayFps); } + if (!string.IsNullOrEmpty(VersionInfo.CustomBuildString)) + str += VersionInfo.CustomBuildString + " "; + if (Global.Emulator.IsNull()) { str = str + "BizHawk" + (VersionInfo.DeveloperBuild ? " (interim) " : string.Empty); diff --git a/Version/VersionInfo.cs b/Version/VersionInfo.cs index 25d7e470de..ba7515f321 100644 --- a/Version/VersionInfo.cs +++ b/Version/VersionInfo.cs @@ -1,3 +1,6 @@ +using System; +using System.IO; + static class VersionInfo { public const string MAINVERSION = "1.11.8"; // Use numbers only or the new version notification won't work @@ -5,8 +8,32 @@ static class VersionInfo public static readonly bool DeveloperBuild = true; public static readonly string HomePage = "http://tasvideos.org/BizHawk.html"; + public static readonly string CustomBuildString; + public static string GetEmuVersion() { return DeveloperBuild ? ("GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH) : ("Version " + MAINVERSION); } + + static VersionInfo() + { + string path = Path.Combine(GetExeDirectoryAbsolute(),"dll"); + path = Path.Combine(path,"custombuild.txt"); + if(File.Exists(path)) + { + var lines = File.ReadAllLines(path); + if (lines.Length > 0) + CustomBuildString = lines[0]; + } + } + + //code copied to avoid depending on code in otherp rojects + static string GetExeDirectoryAbsolute() + { + var path = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); + if (path.EndsWith(Path.DirectorySeparatorChar.ToString())) + path = path.Remove(path.Length - 1, 1); + + return path; + } }