Added "-portable" command line parameter. With this parameter, the editor will use the "GZBuilder.cfg" located in the program directory to load and save program settings. Log and crash report files will be also created in the program directory.

Renamed the default program configuration file from "GZBuilder.cfg" to "GZBuilder.default.cfg".
Changed the default keys of "Move Thing Left\Right\Forward\Back" actions to arrow keys (was Ctrl + arrow keys).
Updated documentation: added "Command Line Parameters" topic.
This commit is contained in:
MaxED 2015-04-02 10:57:08 +00:00
parent 5fe89efc7c
commit 5147d0b8f5
7 changed files with 142 additions and 14 deletions

View file

@ -102,6 +102,10 @@ shortcuts
builder_movedoublespeed = 16;
builder_visualselect = 1;
builder_visualedit = 2;
builder_movethingleft = 37;
builder_movethingright = 39;
builder_movethingfwd = 38;
builder_movethingback = 40;
buildermodes_raisesector8 = 65530;
buildermodes_lowersector8 = 65531;
buildermodes_raisesector1 = 131066;

View file

@ -446,5 +446,13 @@
<param name="Local" value="gzdb\faq.html">
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Compiling GZDoom Builder">
<param name="Local" value="compilingtheeditor.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Command Line Parameters">
<param name="Local" value="commandlineparams.html">
</OBJECT>
</UL>
</BODY></HTML>

View file

@ -0,0 +1,55 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>About Compiler Configurations</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="default.css" media="screen" title="Default" />
</head>
<body>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="command line">
<param name="keyword" value="arguments">
</object>
<div id="gz_title">
<h1>Command Line Parameters</h1>
</div>
<div id="contents">
<p> All command line parameters are case-insensitive.<br />
<br />
<b class="fat">-portable</b> - <span class="red">GZDB only.</span><br />
The editor will be launched in portable mode. It will use the &quot;GZBuilder.cfg&quot; located in the program directory instead of the one located in the &quot;%LocalAppData%\Doom Builder\GZBuilder.cfg&quot; to load and save program settings. Log and crash report files will be also created in the program directory.<br />
<br />
<b class="fat">-nosettings</b><br />
The editor doesn't load or save program settings.<br />
<br />
<b class="fat">-delaywindow</b><br />
Delays showing of the main window.<br />
<br />
<b class="fat">-map &quot;path\to\mapfile.wad&quot;</b><br />
The editor will automatically load the specified map.<br />
<h2>The following parameters are used only in conjunction with the &quot;-map&quot; parameter</h2>
They replicate the settings, which can be set in the <a href="w_openmapoptions.html">Open Map Window</a>.<br />
<br />
<b class="fat">-strictpatches</b><br />
Enables strict patches rules.<br />
<br />
<b class="fat">-cfg &quot;path\to\game configuration.cfg&quot;</b><br />
<b class="fat">-config &quot;path\to\game configuration.cfg&quot;</b><br />
The editor will use the specified game configuration file when loading the map.<br />
<br />
<b class="fat">-resource &lt;resource type&gt; [flags] &quot;path\to\resource&quot;</b><br />
Adds a map resource.<br />
<strong>Resource type</strong> (required): &quot;wad&quot;, &quot;dir&quot; or &quot;pk3&quot;.<br />
<strong>Flags</strong> (optional):
<ul>
<li><strong>ROOTTEXTURES</strong> - load images in the root directory of the resource as textures.</li>
<li><strong>ROOTFLATS</strong> - load images in the root directory of the resource as flats.</li>
<li><strong>STRICTPATCHES</strong> - use strict rules for patches.</li>
<li><strong>NOTEST</strong> - exclude this resource from testing parameters.</li>
</ul>
<strong>Examples:</strong>
<pre>
-resource pk3 notest "c:\GZDoom\gzdoom.pk3"
-resource WAD "c:\Doom\DOOM.WAD"</pre>
</div>
</body>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>About Compiler Configurations</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="default.css" media="screen" title="Default" />
</head>
<body>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="compiling">
<param name="keyword" value="compilation">
</object>
<div id="gz_title">
<h1>Compiling GZDoom Builder</h1>
</div>
<div id="contents">
<p>
[TODO] Just hit the button and all done.<br />
</div>
</body>

View file

@ -19,6 +19,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Text;
using System.Windows.Forms;
using System.IO;
@ -116,6 +118,7 @@ namespace CodeImp.DoomBuilder
// Files and Folders
private const string SETTINGS_FILE = "GZBuilder.cfg";
private const string DEFAULT_SETTINGS_FILE = "GZBuilder.default.cfg"; //mxd
private const string SETTINGS_DIR = "Doom Builder";
private const string LOG_FILE = "GZBuilder.log";
private const string GAME_CONFIGS_DIR = "Configurations";
@ -192,6 +195,7 @@ namespace CodeImp.DoomBuilder
private static DataLocationList autoloadresources;
private static bool delaymainwindow;
private static bool nosettings;
private static bool portablemode; //mxd
//misc
private static readonly Random random = new Random(); //mxd
@ -573,10 +577,13 @@ namespace CodeImp.DoomBuilder
//apppath = Uri.UnescapeDataString(localpath.AbsolutePath);
apppath = Path.GetDirectoryName(Application.ExecutablePath); //mxd. What was the point of using Uri here (other than to prevent lauching from a shared folder)?
// Parse command-line arguments
ParseCommandLineArgs(args);
// Setup directories
temppath = Path.GetTempPath();
setuppath = Path.Combine(apppath, SETUP_DIR);
settingspath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), SETTINGS_DIR);
settingspath = (portablemode ? apppath : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), SETTINGS_DIR)); //mxd
configspath = Path.Combine(apppath, GAME_CONFIGS_DIR);
compilerspath = Path.Combine(apppath, COMPILERS_DIR);
pluginspath = Path.Combine(apppath, PLUGINS_DIR);
@ -587,7 +594,7 @@ namespace CodeImp.DoomBuilder
logfile = Path.Combine(settingspath, LOG_FILE);
// Make program settings directory if missing
if(!Directory.Exists(settingspath)) Directory.CreateDirectory(settingspath);
if(!portablemode && !Directory.Exists(settingspath)) Directory.CreateDirectory(settingspath);
// Remove the previous log file and start logging
if(File.Exists(logfile)) File.Delete(logfile);
@ -599,13 +606,10 @@ namespace CodeImp.DoomBuilder
for(int i = 0; i < args.Length; i++)
General.WriteLogLine("Argument " + i + ": \"" + args[i] + "\"");
// Parse command-line arguments
ParseCommandLineArgs(args);
// Load configuration
General.WriteLogLine("Loading program configuration...");
settings = new ProgramConfiguration();
string defaultsettingsfile = Path.Combine(apppath, SETTINGS_FILE);
string defaultsettingsfile = Path.Combine(apppath, DEFAULT_SETTINGS_FILE);
string usersettingsfile = nosettings ? defaultsettingsfile : Path.Combine(settingspath, SETTINGS_FILE);
if(settings.Load(usersettingsfile, defaultsettingsfile))
{
@ -833,6 +837,43 @@ namespace CodeImp.DoomBuilder
{
autoloadstrictpatches = true;
}
//mxd. Portable mode?
else if(string.Compare(curarg, "-PORTABLE", true) == 0)
{
// Can we write stuff to apppath?
try
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
if(identity != null)
{
WindowsPrincipal principal = new WindowsPrincipal(identity);
DirectorySecurity security = Directory.GetAccessControl(apppath);
AuthorizationRuleCollection authrules = security.GetAccessRules(true, true, typeof(SecurityIdentifier));
foreach(FileSystemAccessRule accessrule in authrules)
{
SecurityIdentifier id = accessrule.IdentityReference as SecurityIdentifier;
if(id == null || !principal.IsInRole(id)) continue;
if((FileSystemRights.WriteData & accessrule.FileSystemRights) != FileSystemRights.WriteData) continue;
if(accessrule.AccessControlType == AccessControlType.Allow)
{
portablemode = true;
}
else if(accessrule.AccessControlType == AccessControlType.Deny)
{
//Deny usually overrides any Allow
portablemode = false;
break;
}
}
}
}
catch(UnauthorizedAccessException) { }
// Warn the user?
if(!portablemode) ShowWarningMessage("Failed to enable portable mode.\nMake sure you have write premission for '" + apppath + "' directory.", MessageBoxButtons.OK);
}
// Resource?
else if(string.Compare(curarg, "-RESOURCE", true) == 0)
{

View file

@ -1190,7 +1190,6 @@ movethingleft
allowmouse = true;
allowscroll = true;
repeat = true;
default = 131109;
}
movethingright
@ -1202,7 +1201,6 @@ movethingright
allowmouse = true;
allowscroll = true;
repeat = true;
default = 131111;
}
movethingfwd
@ -1214,7 +1212,6 @@ movethingfwd
allowmouse = true;
allowscroll = true;
repeat = true;
default = 131110;
}
movethingback
@ -1226,7 +1223,6 @@ movethingback
allowmouse = true;
allowscroll = true;
repeat = true;
default = 131112;
}
placethingatcursor

View file

@ -1439,8 +1439,8 @@ namespace CodeImp.DoomBuilder.Windows
this.capitalizetexturenames.Size = new System.Drawing.Size(140, 17);
this.capitalizetexturenames.TabIndex = 36;
this.capitalizetexturenames.Text = "Capitalize texture names";
this.toolTip1.SetToolTip(this.capitalizetexturenames, "When enabled, texture names will be shown \r\nand saved as all caps (DB2 behaviour)" +
"");
this.toolTip1.SetToolTip(this.capitalizetexturenames, "When enabled, texture names will be shown \r\nand saved as all caps\r\n(Doom Builder " +
"2 behaviour)");
this.capitalizetexturenames.UseVisualStyleBackColor = true;
//
// cbMarkExtraFloors
@ -1638,7 +1638,10 @@ namespace CodeImp.DoomBuilder.Windows
this.scripttabwidth.AllowNegative = false;
this.scripttabwidth.AllowRelative = false;
this.scripttabwidth.ButtonStep = 2;
this.scripttabwidth.ButtonStepBig = 10F;
this.scripttabwidth.ButtonStepFloat = 1F;
this.scripttabwidth.ButtonStepSmall = 0.1F;
this.scripttabwidth.ButtonStepsUseModifierKeys = false;
this.scripttabwidth.ButtonStepsWrapAround = false;
this.scripttabwidth.Location = new System.Drawing.Point(364, 157);
this.scripttabwidth.Name = "scripttabwidth";