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)
This commit is contained in:
zeromus 2016-11-12 18:49:03 -06:00
parent 10499ee07e
commit c7b639be28
2 changed files with 30 additions and 12 deletions

View File

@ -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);

View File

@ -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;
}
}