Console: move DOSBox IP shift from game pages into game defaults

The per-page "DOSBox IPs (+100)" checkbox becomes a single machine-level
setting per game, edited in Settings > Change <game> Defaults (a "DOSBox
Build" row below Autotranslocate Delay) and persisted in the game's
defaults file (RPDefaults.rpd / BTDefaults.btd) as a top-level
DosBoxAddressShift element.

The game pages no longer carry the checkbox; each RPGame/BTGame reads the
stored default once at construction into a readonly field and applies it
when enabling a pod (MungaGame.DosBoxAddressShift) and when building the
mission egg (MissionAddress). Since it is read at construction, an
already-open game page keeps its shift until reopened -- consistent with
how every other game default behaves.

Verified against vPOD: enabling the DOSBox default drives a freshly
opened game page's pod connection to 127.0.0.101 and the egg to
pilot=127.0.0.101 with no per-page control; unchecking round-trips to
False in the defaults file. All 103 diff tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-10 15:33:44 -05:00
co-authored by Claude Fable 5
parent a5f25c8bb8
commit 80ee1d26ea
6 changed files with 97 additions and 61 deletions
@@ -283,6 +283,14 @@ internal static class BTDefaults
public static BattleDefaults NoReturn => sNoReturn; public static BattleDefaults NoReturn => sNoReturn;
/// <summary>
/// When set, the BattleTech game pages target each pod's DOSBox-X guest
/// (last octet +100) instead of the pod itself. A machine-level setting for
/// the emulator preservation pods, so it is stored once per defaults file
/// rather than per mode.
/// </summary>
public static bool DosBoxAddressShift { get; set; }
static BTDefaults() static BTDefaults()
{ {
sDefaultsFilePath = Path.Combine(Program.GetCommonAppDataDirectory(), "BTDefaults.btd"); sDefaultsFilePath = Path.Combine(Program.GetCommonAppDataDirectory(), "BTDefaults.btd");
@@ -315,6 +323,14 @@ internal static class BTDefaults
case "NoReturnDefaults": case "NoReturnDefaults":
sNoReturn.Parse(childNode); sNoReturn.Parse(childNode);
break; break;
case "DosBoxAddressShift":
{
if (bool.TryParse(childNode.InnerText, out var result))
{
DosBoxAddressShift = result;
}
break;
}
} }
} }
} }
@@ -337,6 +353,7 @@ internal static class BTDefaults
xmlDocument.AppendChild(xmlDocument.CreateElement("BTDefaults")); xmlDocument.AppendChild(xmlDocument.CreateElement("BTDefaults"));
sFreeForAll.Save(xmlDocument.DocumentElement); sFreeForAll.Save(xmlDocument.DocumentElement);
sNoReturn.Save(xmlDocument.DocumentElement); sNoReturn.Save(xmlDocument.DocumentElement);
xmlDocument.DocumentElement.AppendChild(xmlDocument.CreateElement("DosBoxAddressShift")).InnerText = DosBoxAddressShift.ToString();
string directoryName = Path.GetDirectoryName(filePath); string directoryName = Path.GetDirectoryName(filePath);
if (!Directory.Exists(directoryName)) if (!Directory.Exists(directoryName))
{ {
@@ -89,6 +89,10 @@ public class BTDefaultsDialog : Form
private NumericUpDown mNoReturnLaunchDelay; private NumericUpDown mNoReturnLaunchDelay;
private Label mDosBoxLabel;
private CheckBox mDosBoxShift;
private TableLayoutPanel mButtonsTable; private TableLayoutPanel mButtonsTable;
private Button mCancel; private Button mCancel;
@@ -124,6 +128,7 @@ public class BTDefaultsDialog : Form
BTScenario scenario = BTConfig.FreeForAll; BTScenario scenario = BTConfig.FreeForAll;
BuildColumn(scenario, BTDefaults.FreeForAll, mFfaMap, mFfaWeather, mFfaTimeOfDay, mFfaAdvancedDamage, mFfaMissionLength, mFfaVehicle, mFfaCamo, mFfaPatch, mFfaBadge, mFfaExperience, mFfaLaunchDelay); BuildColumn(scenario, BTDefaults.FreeForAll, mFfaMap, mFfaWeather, mFfaTimeOfDay, mFfaAdvancedDamage, mFfaMissionLength, mFfaVehicle, mFfaCamo, mFfaPatch, mFfaBadge, mFfaExperience, mFfaLaunchDelay);
BuildColumn(scenario, BTDefaults.NoReturn, mNoReturnMap, mNoReturnWeather, mNoReturnTimeOfDay, mNoReturnAdvancedDamage, mNoReturnMissionLength, mNoReturnVehicle, mNoReturnCamo, mNoReturnPatch, mNoReturnBadge, mNoReturnExperience, mNoReturnLaunchDelay); BuildColumn(scenario, BTDefaults.NoReturn, mNoReturnMap, mNoReturnWeather, mNoReturnTimeOfDay, mNoReturnAdvancedDamage, mNoReturnMissionLength, mNoReturnVehicle, mNoReturnCamo, mNoReturnPatch, mNoReturnBadge, mNoReturnExperience, mNoReturnLaunchDelay);
mDosBoxShift.Checked = BTDefaults.DosBoxAddressShift;
} }
private static void BuildColumn(BTScenario scenario, BTDefaults.BattleDefaults defaults, ComboBox map, ComboBox weather, ComboBox timeOfDay, ComboBox advancedDamage, MaskedTextBox missionLength, ComboBox vehicle, ComboBox camo, ComboBox patch, ComboBox badge, ComboBox experience, NumericUpDown launchDelay) private static void BuildColumn(BTScenario scenario, BTDefaults.BattleDefaults defaults, ComboBox map, ComboBox weather, ComboBox timeOfDay, ComboBox advancedDamage, MaskedTextBox missionLength, ComboBox vehicle, ComboBox camo, ComboBox patch, ComboBox badge, ComboBox experience, NumericUpDown launchDelay)
@@ -208,6 +213,7 @@ public class BTDefaultsDialog : Form
{ {
SaveColumn(BTDefaults.FreeForAll, mFfaMap, mFfaWeather, mFfaTimeOfDay, mFfaAdvancedDamage, mFfaMissionLength, mFfaVehicle, mFfaCamo, mFfaPatch, mFfaBadge, mFfaExperience, mFfaLaunchDelay); SaveColumn(BTDefaults.FreeForAll, mFfaMap, mFfaWeather, mFfaTimeOfDay, mFfaAdvancedDamage, mFfaMissionLength, mFfaVehicle, mFfaCamo, mFfaPatch, mFfaBadge, mFfaExperience, mFfaLaunchDelay);
SaveColumn(BTDefaults.NoReturn, mNoReturnMap, mNoReturnWeather, mNoReturnTimeOfDay, mNoReturnAdvancedDamage, mNoReturnMissionLength, mNoReturnVehicle, mNoReturnCamo, mNoReturnPatch, mNoReturnBadge, mNoReturnExperience, mNoReturnLaunchDelay); SaveColumn(BTDefaults.NoReturn, mNoReturnMap, mNoReturnWeather, mNoReturnTimeOfDay, mNoReturnAdvancedDamage, mNoReturnMissionLength, mNoReturnVehicle, mNoReturnCamo, mNoReturnPatch, mNoReturnBadge, mNoReturnExperience, mNoReturnLaunchDelay);
BTDefaults.DosBoxAddressShift = mDosBoxShift.Checked;
BTDefaults.Save(); BTDefaults.Save();
Hide(); Hide();
} }
@@ -274,6 +280,8 @@ public class BTDefaultsDialog : Form
this.mNoReturnExperience = new System.Windows.Forms.ComboBox(); this.mNoReturnExperience = new System.Windows.Forms.ComboBox();
this.mFfaLaunchDelay = new System.Windows.Forms.NumericUpDown(); this.mFfaLaunchDelay = new System.Windows.Forms.NumericUpDown();
this.mNoReturnLaunchDelay = new System.Windows.Forms.NumericUpDown(); this.mNoReturnLaunchDelay = new System.Windows.Forms.NumericUpDown();
this.mDosBoxLabel = new System.Windows.Forms.Label();
this.mDosBoxShift = new System.Windows.Forms.CheckBox();
this.mButtonsTable = new System.Windows.Forms.TableLayoutPanel(); this.mButtonsTable = new System.Windows.Forms.TableLayoutPanel();
this.mCancel = new System.Windows.Forms.Button(); this.mCancel = new System.Windows.Forms.Button();
this.mOK = new System.Windows.Forms.Button(); this.mOK = new System.Windows.Forms.Button();
@@ -321,17 +329,19 @@ public class BTDefaultsDialog : Form
this.mMainTable.Controls.Add(this.mLaunchDelayLabel, 0, 11); this.mMainTable.Controls.Add(this.mLaunchDelayLabel, 0, 11);
this.mMainTable.Controls.Add(this.mFfaLaunchDelay, 1, 11); this.mMainTable.Controls.Add(this.mFfaLaunchDelay, 1, 11);
this.mMainTable.Controls.Add(this.mNoReturnLaunchDelay, 2, 11); this.mMainTable.Controls.Add(this.mNoReturnLaunchDelay, 2, 11);
this.mMainTable.Controls.Add(this.mButtonsTable, 0, 12); this.mMainTable.Controls.Add(this.mDosBoxLabel, 0, 12);
this.mMainTable.Controls.Add(this.mDosBoxShift, 1, 12);
this.mMainTable.Controls.Add(this.mButtonsTable, 0, 13);
this.mMainTable.Dock = System.Windows.Forms.DockStyle.Fill; this.mMainTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.mMainTable.Location = new System.Drawing.Point(3, 3); this.mMainTable.Location = new System.Drawing.Point(3, 3);
this.mMainTable.Name = "mMainTable"; this.mMainTable.Name = "mMainTable";
this.mMainTable.RowCount = 13; this.mMainTable.RowCount = 14;
for (int i = 0; i < 12; i++) for (int i = 0; i < 13; i++)
{ {
this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle());
} }
this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100f)); this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100f));
this.mMainTable.Size = new System.Drawing.Size(478, 384); this.mMainTable.Size = new System.Drawing.Size(478, 414);
this.mMainTable.TabIndex = 0; this.mMainTable.TabIndex = 0;
this.mFfaHeaderLabel.Anchor = System.Windows.Forms.AnchorStyles.None; this.mFfaHeaderLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.mFfaHeaderLabel.AutoSize = true; this.mFfaHeaderLabel.AutoSize = true;
@@ -352,6 +362,7 @@ public class BTDefaultsDialog : Form
ConfigureRowLabel(this.mBadgeLabel, "mBadgeLabel", "Badge:"); ConfigureRowLabel(this.mBadgeLabel, "mBadgeLabel", "Badge:");
ConfigureRowLabel(this.mExperienceLabel, "mExperienceLabel", "Experience:"); ConfigureRowLabel(this.mExperienceLabel, "mExperienceLabel", "Experience:");
ConfigureRowLabel(this.mLaunchDelayLabel, "mLaunchDelayLabel", "Autotranslocate Delay:"); ConfigureRowLabel(this.mLaunchDelayLabel, "mLaunchDelayLabel", "Autotranslocate Delay:");
ConfigureRowLabel(this.mDosBoxLabel, "mDosBoxLabel", "DOSBox Build:");
ConfigureOptionCombo(this.mFfaMap, "mFfaMap"); ConfigureOptionCombo(this.mFfaMap, "mFfaMap");
ConfigureOptionCombo(this.mNoReturnMap, "mNoReturnMap"); ConfigureOptionCombo(this.mNoReturnMap, "mNoReturnMap");
ConfigureOptionCombo(this.mFfaWeather, "mFfaWeather"); ConfigureOptionCombo(this.mFfaWeather, "mFfaWeather");
@@ -378,6 +389,12 @@ public class BTDefaultsDialog : Form
this.mFfaLaunchDelay.Name = "mFfaLaunchDelay"; this.mFfaLaunchDelay.Name = "mFfaLaunchDelay";
this.mNoReturnLaunchDelay.Dock = System.Windows.Forms.DockStyle.Fill; this.mNoReturnLaunchDelay.Dock = System.Windows.Forms.DockStyle.Fill;
this.mNoReturnLaunchDelay.Name = "mNoReturnLaunchDelay"; this.mNoReturnLaunchDelay.Name = "mNoReturnLaunchDelay";
this.mMainTable.SetColumnSpan(this.mDosBoxShift, 2);
this.mDosBoxShift.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.mDosBoxShift.AutoSize = true;
this.mDosBoxShift.Name = "mDosBoxShift";
this.mDosBoxShift.Text = "Shift all pod IPs +100 (DOSBox-X preservation build)";
this.mDosBoxShift.UseVisualStyleBackColor = true;
this.mButtonsTable.ColumnCount = 2; this.mButtonsTable.ColumnCount = 2;
this.mMainTable.SetColumnSpan(this.mButtonsTable, 3); this.mMainTable.SetColumnSpan(this.mButtonsTable, 3);
this.mButtonsTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100f)); this.mButtonsTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100f));
@@ -408,7 +425,7 @@ public class BTDefaultsDialog : Form
base.AcceptButton = this.mOK; base.AcceptButton = this.mOK;
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f); base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(484, 390); base.ClientSize = new System.Drawing.Size(484, 420);
base.Controls.Add(this.mMainTable); base.Controls.Add(this.mMainTable);
base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
base.MaximizeBox = false; base.MaximizeBox = false;
+5 -26
View File
@@ -182,7 +182,7 @@ internal class BTGame : DockContent
private Timer tmrAutoTranslocate; private Timer tmrAutoTranslocate;
private CheckBox mDosBoxShift; private readonly bool mDosBoxAddressShift = BTDefaults.DosBoxAddressShift;
private string GameStatusText private string GameStatusText
{ {
@@ -398,15 +398,7 @@ internal class BTGame : DockContent
private string MissionAddress(Pod pod) private string MissionAddress(Pod pod)
{ {
return (mDosBoxShift.Checked ? DosBox.ShiftAddress(pod.IPAddress) : pod.IPAddress).ToString(); return (mDosBoxAddressShift ? DosBox.ShiftAddress(pod.IPAddress) : pod.IPAddress).ToString();
}
private void mDosBoxShift_CheckedChanged(object sender, EventArgs e)
{
foreach (DataGridViewRow item in (IEnumerable)mPilotsDataGrid.Rows)
{
((Pod)item.Tag).MungaGame.DosBoxAddressShift = mDosBoxShift.Checked;
}
} }
private void NetworkScan(object sender, EventArgs e) private void NetworkScan(object sender, EventArgs e)
@@ -862,7 +854,6 @@ internal class BTGame : DockContent
private void SwitchControlsMode(bool editMode) private void SwitchControlsMode(bool editMode)
{ {
mDosBoxShift.Enabled = editMode;
mMap.Enabled = editMode; mMap.Enabled = editMode;
mWeather.Enabled = editMode; mWeather.Enabled = editMode;
mTimeOfDay.Enabled = editMode; mTimeOfDay.Enabled = editMode;
@@ -1093,7 +1084,7 @@ internal class BTGame : DockContent
{ {
if (flag.Value) if (flag.Value)
{ {
((Pod)dataGridViewRow.Tag).MungaGame.DosBoxAddressShift = mDosBoxShift.Checked; ((Pod)dataGridViewRow.Tag).MungaGame.DosBoxAddressShift = mDosBoxAddressShift;
((Pod)dataGridViewRow.Tag).MungaGame.MakeRequested(this); ((Pod)dataGridViewRow.Tag).MungaGame.MakeRequested(this);
} }
else else
@@ -1316,7 +1307,6 @@ internal class BTGame : DockContent
this.mRandomWeather = new System.Windows.Forms.Button(); this.mRandomWeather = new System.Windows.Forms.Button();
this.mRandomTimeOfDay = new System.Windows.Forms.Button(); this.mRandomTimeOfDay = new System.Windows.Forms.Button();
this.mMissionLengthTextBox = new System.Windows.Forms.TextBox(); this.mMissionLengthTextBox = new System.Windows.Forms.TextBox();
this.mDosBoxShift = new System.Windows.Forms.CheckBox();
this.mPilotsGroupBox = new System.Windows.Forms.GroupBox(); this.mPilotsGroupBox = new System.Windows.Forms.GroupBox();
this.mPilotsDataGrid = new System.Windows.Forms.DataGridView(); this.mPilotsDataGrid = new System.Windows.Forms.DataGridView();
this.mEnabledColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.mEnabledColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
@@ -1351,7 +1341,7 @@ internal class BTGame : DockContent
this.mMissionPropertiesGroupBox.Text = "Mission Properties"; this.mMissionPropertiesGroupBox.Text = "Mission Properties";
this.mMissionPropertiesTable.AutoSize = true; this.mMissionPropertiesTable.AutoSize = true;
this.mMissionPropertiesTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.mMissionPropertiesTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.mMissionPropertiesTable.ColumnCount = 9; this.mMissionPropertiesTable.ColumnCount = 8;
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
@@ -1360,8 +1350,7 @@ internal class BTGame : DockContent
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 0f)); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 0f));
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.Controls.Add(this.mIssuesLabel, 7, 0);
this.mMissionPropertiesTable.Controls.Add(this.mIssuesLabel, 8, 0);
this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextLabel, 3, 1); this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextLabel, 3, 1);
this.mMissionPropertiesTable.Controls.Add(this.mMap, 1, 0); this.mMissionPropertiesTable.Controls.Add(this.mMap, 1, 0);
this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthDisplayLabel, 5, 1); this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthDisplayLabel, 5, 1);
@@ -1379,7 +1368,6 @@ internal class BTGame : DockContent
this.mMissionPropertiesTable.Controls.Add(this.mRandomWeather, 2, 1); this.mMissionPropertiesTable.Controls.Add(this.mRandomWeather, 2, 1);
this.mMissionPropertiesTable.Controls.Add(this.mRandomTimeOfDay, 2, 2); this.mMissionPropertiesTable.Controls.Add(this.mRandomTimeOfDay, 2, 2);
this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextBox, 4, 1); this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextBox, 4, 1);
this.mMissionPropertiesTable.Controls.Add(this.mDosBoxShift, 7, 2);
this.mMissionPropertiesTable.Dock = System.Windows.Forms.DockStyle.Fill; this.mMissionPropertiesTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.mMissionPropertiesTable.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.AddColumns; this.mMissionPropertiesTable.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.AddColumns;
this.mMissionPropertiesTable.Location = new System.Drawing.Point(5, 18); this.mMissionPropertiesTable.Location = new System.Drawing.Point(5, 18);
@@ -1542,15 +1530,6 @@ internal class BTGame : DockContent
this.mMissionLengthTextBox.Size = new System.Drawing.Size(100, 20); this.mMissionLengthTextBox.Size = new System.Drawing.Size(100, 20);
this.mMissionLengthTextBox.TabIndex = 12; this.mMissionLengthTextBox.TabIndex = 12;
this.mMissionLengthTextBox.TextChanged += new System.EventHandler(mMissionLengthTextBox_TextChanged); this.mMissionLengthTextBox.TextChanged += new System.EventHandler(mMissionLengthTextBox_TextChanged);
this.mDosBoxShift.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.mDosBoxShift.AutoSize = true;
this.mDosBoxShift.Location = new System.Drawing.Point(642, 64);
this.mDosBoxShift.Name = "mDosBoxShift";
this.mDosBoxShift.Size = new System.Drawing.Size(122, 17);
this.mDosBoxShift.TabIndex = 13;
this.mDosBoxShift.Text = "DOSBox IPs (+100)";
this.mDosBoxShift.UseVisualStyleBackColor = true;
this.mDosBoxShift.CheckedChanged += new System.EventHandler(mDosBoxShift_CheckedChanged);
this.mPilotsGroupBox.Controls.Add(this.mPilotsDataGrid); this.mPilotsGroupBox.Controls.Add(this.mPilotsDataGrid);
this.mPilotsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; this.mPilotsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.mPilotsGroupBox.Location = new System.Drawing.Point(8, 113); this.mPilotsGroupBox.Location = new System.Drawing.Point(8, 113);
@@ -352,6 +352,14 @@ internal static class RPDefaults
public static FootballDefaults Football => sFootball; public static FootballDefaults Football => sFootball;
/// <summary>
/// When set, the Red Planet game pages target each pod's DOSBox-X guest
/// (last octet +100) instead of the pod itself. A machine-level setting for
/// the emulator preservation pods, so it is stored once per defaults file
/// rather than per scenario.
/// </summary>
public static bool DosBoxAddressShift { get; set; }
static RPDefaults() static RPDefaults()
{ {
sDefaultsFilePath = Path.Combine(Program.GetCommonAppDataDirectory(), "RPDefaults.rpd"); sDefaultsFilePath = Path.Combine(Program.GetCommonAppDataDirectory(), "RPDefaults.rpd");
@@ -384,6 +392,14 @@ internal static class RPDefaults
case "FootballDefaults": case "FootballDefaults":
sFootball.Parse(childNode); sFootball.Parse(childNode);
break; break;
case "DosBoxAddressShift":
{
if (bool.TryParse(childNode.InnerText, out var result))
{
DosBoxAddressShift = result;
}
break;
}
} }
} }
} }
@@ -406,6 +422,7 @@ internal static class RPDefaults
xmlDocument.AppendChild(xmlDocument.CreateElement("RPDefaults")); xmlDocument.AppendChild(xmlDocument.CreateElement("RPDefaults"));
sDeathRace.Save(xmlDocument.DocumentElement); sDeathRace.Save(xmlDocument.DocumentElement);
sFootball.Save(xmlDocument.DocumentElement); sFootball.Save(xmlDocument.DocumentElement);
xmlDocument.DocumentElement.AppendChild(xmlDocument.CreateElement("DosBoxAddressShift")).InnerText = DosBoxAddressShift.ToString();
string directoryName = Path.GetDirectoryName(filePath); string directoryName = Path.GetDirectoryName(filePath);
if (!Directory.Exists(directoryName)) if (!Directory.Exists(directoryName))
{ {
@@ -77,6 +77,10 @@ public class RPDefaultsDialog : Form
private NumericUpDown mFootballLaunchDelay; private NumericUpDown mFootballLaunchDelay;
private Label mDosBoxLabel;
private CheckBox mDosBoxShift;
private static RPDefaultsDialog mSingletonDialog; private static RPDefaultsDialog mSingletonDialog;
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
@@ -123,6 +127,8 @@ public class RPDefaultsDialog : Form
this.label11 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label();
this.mDeathraceLaunchDelay = new System.Windows.Forms.NumericUpDown(); this.mDeathraceLaunchDelay = new System.Windows.Forms.NumericUpDown();
this.mFootballLaunchDelay = new System.Windows.Forms.NumericUpDown(); this.mFootballLaunchDelay = new System.Windows.Forms.NumericUpDown();
this.mDosBoxLabel = new System.Windows.Forms.Label();
this.mDosBoxShift = new System.Windows.Forms.CheckBox();
this.mMainTable.SuspendLayout(); this.mMainTable.SuspendLayout();
this.mButtonsTable.SuspendLayout(); this.mButtonsTable.SuspendLayout();
((System.ComponentModel.ISupportInitialize)this.mDeathraceLaunchDelay).BeginInit(); ((System.ComponentModel.ISupportInitialize)this.mDeathraceLaunchDelay).BeginInit();
@@ -141,7 +147,7 @@ public class RPDefaultsDialog : Form
this.mMainTable.Controls.Add(this.label9, 0, 8); this.mMainTable.Controls.Add(this.label9, 0, 8);
this.mMainTable.Controls.Add(this.label1, 1, 0); this.mMainTable.Controls.Add(this.label1, 1, 0);
this.mMainTable.Controls.Add(this.label10, 2, 0); this.mMainTable.Controls.Add(this.label10, 2, 0);
this.mMainTable.Controls.Add(this.mButtonsTable, 0, 10); this.mMainTable.Controls.Add(this.mButtonsTable, 0, 11);
this.mMainTable.Controls.Add(this.label5, 0, 6); this.mMainTable.Controls.Add(this.label5, 0, 6);
this.mMainTable.Controls.Add(this.mDeathRaceVehicle, 1, 6); this.mMainTable.Controls.Add(this.mDeathRaceVehicle, 1, 6);
this.mMainTable.Controls.Add(this.mFootballVehicle, 2, 6); this.mMainTable.Controls.Add(this.mFootballVehicle, 2, 6);
@@ -162,10 +168,13 @@ public class RPDefaultsDialog : Form
this.mMainTable.Controls.Add(this.mFootballWeather, 2, 2); this.mMainTable.Controls.Add(this.mFootballWeather, 2, 2);
this.mMainTable.Controls.Add(this.label11, 0, 9); this.mMainTable.Controls.Add(this.label11, 0, 9);
this.mMainTable.Controls.Add(this.mDeathraceLaunchDelay, 1, 9); this.mMainTable.Controls.Add(this.mDeathraceLaunchDelay, 1, 9);
this.mMainTable.Controls.Add(this.mDosBoxLabel, 0, 10);
this.mMainTable.Controls.Add(this.mDosBoxShift, 1, 10);
this.mMainTable.Dock = System.Windows.Forms.DockStyle.Fill; this.mMainTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.mMainTable.Location = new System.Drawing.Point(3, 3); this.mMainTable.Location = new System.Drawing.Point(3, 3);
this.mMainTable.Name = "mMainTable"; this.mMainTable.Name = "mMainTable";
this.mMainTable.RowCount = 11; this.mMainTable.RowCount = 12;
this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle());
@@ -177,7 +186,7 @@ public class RPDefaultsDialog : Form
this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100f)); this.mMainTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100f));
this.mMainTable.Size = new System.Drawing.Size(478, 298); this.mMainTable.Size = new System.Drawing.Size(478, 328);
this.mMainTable.TabIndex = 0; this.mMainTable.TabIndex = 0;
this.mFootballPosition.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; this.mFootballPosition.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
this.mFootballPosition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.mFootballPosition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -406,10 +415,26 @@ public class RPDefaultsDialog : Form
this.mFootballLaunchDelay.Name = "mFootballLaunchDelay"; this.mFootballLaunchDelay.Name = "mFootballLaunchDelay";
this.mFootballLaunchDelay.Size = new System.Drawing.Size(173, 20); this.mFootballLaunchDelay.Size = new System.Drawing.Size(173, 20);
this.mFootballLaunchDelay.TabIndex = 32; this.mFootballLaunchDelay.TabIndex = 32;
this.mDosBoxLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.mDosBoxLabel.AutoSize = true;
this.mDosBoxLabel.Location = new System.Drawing.Point(35, 258);
this.mDosBoxLabel.Name = "mDosBoxLabel";
this.mDosBoxLabel.Size = new System.Drawing.Size(82, 13);
this.mDosBoxLabel.TabIndex = 29;
this.mDosBoxLabel.Text = "DOSBox Build:";
this.mMainTable.SetColumnSpan(this.mDosBoxShift, 2);
this.mDosBoxShift.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.mDosBoxShift.AutoSize = true;
this.mDosBoxShift.Location = new System.Drawing.Point(123, 256);
this.mDosBoxShift.Name = "mDosBoxShift";
this.mDosBoxShift.Size = new System.Drawing.Size(268, 17);
this.mDosBoxShift.TabIndex = 33;
this.mDosBoxShift.Text = "Shift all pod IPs +100 (DOSBox-X preservation build)";
this.mDosBoxShift.UseVisualStyleBackColor = true;
base.AcceptButton = this.mOK; base.AcceptButton = this.mOK;
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f); base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(484, 304); base.ClientSize = new System.Drawing.Size(484, 334);
base.Controls.Add(this.mMainTable); base.Controls.Add(this.mMainTable);
base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
base.MaximizeBox = false; base.MaximizeBox = false;
@@ -457,6 +482,7 @@ public class RPDefaultsDialog : Form
BuildGenericOption(mFootballPosition, RPConfig.Football.Positions, RPDefaults.Football.PositionKey); BuildGenericOption(mFootballPosition, RPConfig.Football.Positions, RPDefaults.Football.PositionKey);
BuildDelayControl(mDeathraceLaunchDelay, RPDefaults.DeathRace.LaunchDelay); BuildDelayControl(mDeathraceLaunchDelay, RPDefaults.DeathRace.LaunchDelay);
BuildDelayControl(mFootballLaunchDelay, RPDefaults.Football.LaunchDelay); BuildDelayControl(mFootballLaunchDelay, RPDefaults.Football.LaunchDelay);
mDosBoxShift.Checked = RPDefaults.DosBoxAddressShift;
} }
private static void BuildScoreCompressionOptions(ComboBox comboBox, bool defaultValue) private static void BuildScoreCompressionOptions(ComboBox comboBox, bool defaultValue)
@@ -577,6 +603,7 @@ public class RPDefaultsDialog : Form
RPDefaults.Football.PositionKey = ExtractSelectedKey<string>(mFootballPosition); RPDefaults.Football.PositionKey = ExtractSelectedKey<string>(mFootballPosition);
RPDefaults.DeathRace.LaunchDelay = (int)mDeathraceLaunchDelay.Value; RPDefaults.DeathRace.LaunchDelay = (int)mDeathraceLaunchDelay.Value;
RPDefaults.Football.LaunchDelay = (int)mFootballLaunchDelay.Value; RPDefaults.Football.LaunchDelay = (int)mFootballLaunchDelay.Value;
RPDefaults.DosBoxAddressShift = mDosBoxShift.Checked;
RPDefaults.Save(); RPDefaults.Save();
Hide(); Hide();
} }
+5 -26
View File
@@ -176,7 +176,7 @@ public class RPGame : DockContent
private Timer tmrAutoTranslocate; private Timer tmrAutoTranslocate;
private CheckBox mDosBoxShift; private readonly bool mDosBoxAddressShift = RPDefaults.DosBoxAddressShift;
private string GameStatusText private string GameStatusText
{ {
@@ -425,15 +425,7 @@ public class RPGame : DockContent
private string MissionAddress(Pod pod) private string MissionAddress(Pod pod)
{ {
return (mDosBoxShift.Checked ? DosBox.ShiftAddress(pod.IPAddress) : pod.IPAddress).ToString(); return (mDosBoxAddressShift ? DosBox.ShiftAddress(pod.IPAddress) : pod.IPAddress).ToString();
}
private void mDosBoxShift_CheckedChanged(object sender, EventArgs e)
{
foreach (DataGridViewRow item in (IEnumerable)mPilotsDataGrid.Rows)
{
((Pod)item.Tag).MungaGame.DosBoxAddressShift = mDosBoxShift.Checked;
}
} }
private void NetworkScan(object sender, EventArgs e) private void NetworkScan(object sender, EventArgs e)
@@ -922,7 +914,6 @@ public class RPGame : DockContent
private void SwitchControlsMode(bool editMode) private void SwitchControlsMode(bool editMode)
{ {
mDosBoxShift.Enabled = editMode;
ComboBox comboBox = mMap; ComboBox comboBox = mMap;
ComboBox comboBox2 = mWeather; ComboBox comboBox2 = mWeather;
ComboBox comboBox3 = mTimeOfDay; ComboBox comboBox3 = mTimeOfDay;
@@ -1203,7 +1194,7 @@ public class RPGame : DockContent
{ {
if (flag.Value) if (flag.Value)
{ {
((Pod)dataGridViewRow.Tag).MungaGame.DosBoxAddressShift = mDosBoxShift.Checked; ((Pod)dataGridViewRow.Tag).MungaGame.DosBoxAddressShift = mDosBoxAddressShift;
((Pod)dataGridViewRow.Tag).MungaGame.MakeRequested(this); ((Pod)dataGridViewRow.Tag).MungaGame.MakeRequested(this);
} }
else else
@@ -1431,7 +1422,6 @@ public class RPGame : DockContent
this.mRandomWeather = new System.Windows.Forms.Button(); this.mRandomWeather = new System.Windows.Forms.Button();
this.mRandomTimeOfDay = new System.Windows.Forms.Button(); this.mRandomTimeOfDay = new System.Windows.Forms.Button();
this.mMissionLengthTextBox = new System.Windows.Forms.TextBox(); this.mMissionLengthTextBox = new System.Windows.Forms.TextBox();
this.mDosBoxShift = new System.Windows.Forms.CheckBox();
this.mPilotsGroupBox = new System.Windows.Forms.GroupBox(); this.mPilotsGroupBox = new System.Windows.Forms.GroupBox();
this.mPilotsDataGrid = new System.Windows.Forms.DataGridView(); this.mPilotsDataGrid = new System.Windows.Forms.DataGridView();
this.mEnabledColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.mEnabledColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
@@ -1464,7 +1454,7 @@ public class RPGame : DockContent
this.mMissionPropertiesGroupBox.Text = "Mission Properties"; this.mMissionPropertiesGroupBox.Text = "Mission Properties";
this.mMissionPropertiesTable.AutoSize = true; this.mMissionPropertiesTable.AutoSize = true;
this.mMissionPropertiesTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.mMissionPropertiesTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.mMissionPropertiesTable.ColumnCount = 9; this.mMissionPropertiesTable.ColumnCount = 8;
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
@@ -1473,8 +1463,7 @@ public class RPGame : DockContent
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 0f)); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 0f));
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.mMissionPropertiesTable.Controls.Add(this.mIssuesLabel, 7, 0);
this.mMissionPropertiesTable.Controls.Add(this.mIssuesLabel, 8, 0);
this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextLabel, 3, 1); this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextLabel, 3, 1);
this.mMissionPropertiesTable.Controls.Add(this.mMap, 1, 0); this.mMissionPropertiesTable.Controls.Add(this.mMap, 1, 0);
this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthDisplayLabel, 5, 1); this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthDisplayLabel, 5, 1);
@@ -1492,7 +1481,6 @@ public class RPGame : DockContent
this.mMissionPropertiesTable.Controls.Add(this.mRandomWeather, 2, 1); this.mMissionPropertiesTable.Controls.Add(this.mRandomWeather, 2, 1);
this.mMissionPropertiesTable.Controls.Add(this.mRandomTimeOfDay, 2, 2); this.mMissionPropertiesTable.Controls.Add(this.mRandomTimeOfDay, 2, 2);
this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextBox, 4, 1); this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextBox, 4, 1);
this.mMissionPropertiesTable.Controls.Add(this.mDosBoxShift, 7, 2);
this.mMissionPropertiesTable.Dock = System.Windows.Forms.DockStyle.Fill; this.mMissionPropertiesTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.mMissionPropertiesTable.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.AddColumns; this.mMissionPropertiesTable.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.AddColumns;
this.mMissionPropertiesTable.Location = new System.Drawing.Point(5, 18); this.mMissionPropertiesTable.Location = new System.Drawing.Point(5, 18);
@@ -1653,15 +1641,6 @@ public class RPGame : DockContent
this.mMissionLengthTextBox.Size = new System.Drawing.Size(100, 20); this.mMissionLengthTextBox.Size = new System.Drawing.Size(100, 20);
this.mMissionLengthTextBox.TabIndex = 12; this.mMissionLengthTextBox.TabIndex = 12;
this.mMissionLengthTextBox.TextChanged += new System.EventHandler(mMissionLengthTextBox_TextChanged); this.mMissionLengthTextBox.TextChanged += new System.EventHandler(mMissionLengthTextBox_TextChanged);
this.mDosBoxShift.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.mDosBoxShift.AutoSize = true;
this.mDosBoxShift.Location = new System.Drawing.Point(642, 64);
this.mDosBoxShift.Name = "mDosBoxShift";
this.mDosBoxShift.Size = new System.Drawing.Size(122, 17);
this.mDosBoxShift.TabIndex = 13;
this.mDosBoxShift.Text = "DOSBox IPs (+100)";
this.mDosBoxShift.UseVisualStyleBackColor = true;
this.mDosBoxShift.CheckedChanged += new System.EventHandler(mDosBoxShift_CheckedChanged);
this.mPilotsGroupBox.Controls.Add(this.mPilotsDataGrid); this.mPilotsGroupBox.Controls.Add(this.mPilotsDataGrid);
this.mPilotsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; this.mPilotsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.mPilotsGroupBox.Location = new System.Drawing.Point(8, 113); this.mPilotsGroupBox.Location = new System.Drawing.Point(8, 113);