mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Updated sfall debug editor (from Mr.Stalin)
Formatted the code of sfall debug editor.
This commit is contained in:
Generated
+34
-26
@@ -29,11 +29,11 @@
|
|||||||
this.bCritters = new System.Windows.Forms.Button();
|
this.bCritters = new System.Windows.Forms.Button();
|
||||||
this.bSGlobals = new System.Windows.Forms.Button();
|
this.bSGlobals = new System.Windows.Forms.Button();
|
||||||
this.bArrays = new System.Windows.Forms.Button();
|
this.bArrays = new System.Windows.Forms.Button();
|
||||||
|
this.bEdit = new System.Windows.Forms.Button();
|
||||||
this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.bEdit = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -41,25 +41,30 @@
|
|||||||
//
|
//
|
||||||
this.dataGridView1.AllowUserToAddRows = false;
|
this.dataGridView1.AllowUserToAddRows = false;
|
||||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView1.AllowUserToResizeRows = false;
|
||||||
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
this.Column0,
|
this.Column0,
|
||||||
this.Column1,
|
this.Column1,
|
||||||
this.Column2,
|
this.Column2,
|
||||||
this.Column3});
|
this.Column3});
|
||||||
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
|
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
|
||||||
|
this.dataGridView1.MultiSelect = false;
|
||||||
this.dataGridView1.Name = "dataGridView1";
|
this.dataGridView1.Name = "dataGridView1";
|
||||||
this.dataGridView1.Size = new System.Drawing.Size(444, 215);
|
this.dataGridView1.RowHeadersVisible = false;
|
||||||
|
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dataGridView1.Size = new System.Drawing.Size(443, 233);
|
||||||
this.dataGridView1.TabIndex = 0;
|
this.dataGridView1.TabIndex = 0;
|
||||||
|
this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);
|
||||||
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
|
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
|
||||||
//
|
//
|
||||||
// bGlobals
|
// bGlobals
|
||||||
//
|
//
|
||||||
this.bGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.bGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.bGlobals.Location = new System.Drawing.Point(12, 233);
|
this.bGlobals.Location = new System.Drawing.Point(12, 251);
|
||||||
this.bGlobals.Name = "bGlobals";
|
this.bGlobals.Name = "bGlobals";
|
||||||
this.bGlobals.Size = new System.Drawing.Size(100, 23);
|
this.bGlobals.Size = new System.Drawing.Size(100, 23);
|
||||||
this.bGlobals.TabIndex = 1;
|
this.bGlobals.TabIndex = 1;
|
||||||
@@ -70,7 +75,7 @@
|
|||||||
// bMapVars
|
// bMapVars
|
||||||
//
|
//
|
||||||
this.bMapVars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.bMapVars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.bMapVars.Location = new System.Drawing.Point(118, 233);
|
this.bMapVars.Location = new System.Drawing.Point(118, 251);
|
||||||
this.bMapVars.Name = "bMapVars";
|
this.bMapVars.Name = "bMapVars";
|
||||||
this.bMapVars.Size = new System.Drawing.Size(100, 23);
|
this.bMapVars.Size = new System.Drawing.Size(100, 23);
|
||||||
this.bMapVars.TabIndex = 2;
|
this.bMapVars.TabIndex = 2;
|
||||||
@@ -81,7 +86,7 @@
|
|||||||
// bCritters
|
// bCritters
|
||||||
//
|
//
|
||||||
this.bCritters.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.bCritters.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.bCritters.Location = new System.Drawing.Point(118, 262);
|
this.bCritters.Location = new System.Drawing.Point(12, 280);
|
||||||
this.bCritters.Name = "bCritters";
|
this.bCritters.Name = "bCritters";
|
||||||
this.bCritters.Size = new System.Drawing.Size(100, 23);
|
this.bCritters.Size = new System.Drawing.Size(100, 23);
|
||||||
this.bCritters.TabIndex = 3;
|
this.bCritters.TabIndex = 3;
|
||||||
@@ -91,8 +96,8 @@
|
|||||||
//
|
//
|
||||||
// bSGlobals
|
// bSGlobals
|
||||||
//
|
//
|
||||||
this.bSGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.bSGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.bSGlobals.Location = new System.Drawing.Point(225, 233);
|
this.bSGlobals.Location = new System.Drawing.Point(249, 251);
|
||||||
this.bSGlobals.Name = "bSGlobals";
|
this.bSGlobals.Name = "bSGlobals";
|
||||||
this.bSGlobals.Size = new System.Drawing.Size(100, 23);
|
this.bSGlobals.Size = new System.Drawing.Size(100, 23);
|
||||||
this.bSGlobals.TabIndex = 4;
|
this.bSGlobals.TabIndex = 4;
|
||||||
@@ -102,8 +107,8 @@
|
|||||||
//
|
//
|
||||||
// bArrays
|
// bArrays
|
||||||
//
|
//
|
||||||
this.bArrays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.bArrays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.bArrays.Location = new System.Drawing.Point(12, 262);
|
this.bArrays.Location = new System.Drawing.Point(355, 251);
|
||||||
this.bArrays.Name = "bArrays";
|
this.bArrays.Name = "bArrays";
|
||||||
this.bArrays.Size = new System.Drawing.Size(100, 23);
|
this.bArrays.Size = new System.Drawing.Size(100, 23);
|
||||||
this.bArrays.TabIndex = 5;
|
this.bArrays.TabIndex = 5;
|
||||||
@@ -111,14 +116,27 @@
|
|||||||
this.bArrays.UseVisualStyleBackColor = true;
|
this.bArrays.UseVisualStyleBackColor = true;
|
||||||
this.bArrays.Click += new System.EventHandler(this.bArrays_Click);
|
this.bArrays.Click += new System.EventHandler(this.bArrays_Click);
|
||||||
//
|
//
|
||||||
|
// bEdit
|
||||||
|
//
|
||||||
|
this.bEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.bEdit.Location = new System.Drawing.Point(355, 280);
|
||||||
|
this.bEdit.Name = "bEdit";
|
||||||
|
this.bEdit.Size = new System.Drawing.Size(100, 23);
|
||||||
|
this.bEdit.TabIndex = 6;
|
||||||
|
this.bEdit.Text = "Edit";
|
||||||
|
this.bEdit.UseVisualStyleBackColor = true;
|
||||||
|
this.bEdit.Click += new System.EventHandler(this.bEdit_Click);
|
||||||
|
//
|
||||||
// Column0
|
// Column0
|
||||||
//
|
//
|
||||||
this.Column0.HeaderText = "ID";
|
this.Column0.HeaderText = "ID";
|
||||||
this.Column0.Name = "Column0";
|
this.Column0.Name = "Column0";
|
||||||
this.Column0.ReadOnly = true;
|
this.Column0.ReadOnly = true;
|
||||||
|
this.Column0.Width = 50;
|
||||||
//
|
//
|
||||||
// Column1
|
// Column1
|
||||||
//
|
//
|
||||||
|
this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||||
this.Column1.HeaderText = "Name";
|
this.Column1.HeaderText = "Name";
|
||||||
this.Column1.Name = "Column1";
|
this.Column1.Name = "Column1";
|
||||||
this.Column1.ReadOnly = true;
|
this.Column1.ReadOnly = true;
|
||||||
@@ -133,22 +151,11 @@
|
|||||||
this.Column3.HeaderText = "Value (Float)";
|
this.Column3.HeaderText = "Value (Float)";
|
||||||
this.Column3.Name = "Column3";
|
this.Column3.Name = "Column3";
|
||||||
//
|
//
|
||||||
// bEdit
|
|
||||||
//
|
|
||||||
this.bEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.bEdit.Location = new System.Drawing.Point(225, 262);
|
|
||||||
this.bEdit.Name = "bEdit";
|
|
||||||
this.bEdit.Size = new System.Drawing.Size(100, 23);
|
|
||||||
this.bEdit.TabIndex = 6;
|
|
||||||
this.bEdit.Text = "Edit";
|
|
||||||
this.bEdit.UseVisualStyleBackColor = true;
|
|
||||||
this.bEdit.Click += new System.EventHandler(this.bEdit_Click);
|
|
||||||
//
|
|
||||||
// DebugEditor
|
// DebugEditor
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(468, 297);
|
this.ClientSize = new System.Drawing.Size(467, 315);
|
||||||
this.Controls.Add(this.bEdit);
|
this.Controls.Add(this.bEdit);
|
||||||
this.Controls.Add(this.bArrays);
|
this.Controls.Add(this.bArrays);
|
||||||
this.Controls.Add(this.bSGlobals);
|
this.Controls.Add(this.bSGlobals);
|
||||||
@@ -156,8 +163,9 @@
|
|||||||
this.Controls.Add(this.bMapVars);
|
this.Controls.Add(this.bMapVars);
|
||||||
this.Controls.Add(this.bGlobals);
|
this.Controls.Add(this.bGlobals);
|
||||||
this.Controls.Add(this.dataGridView1);
|
this.Controls.Add(this.dataGridView1);
|
||||||
|
this.MinimumSize = new System.Drawing.Size(450, 300);
|
||||||
this.Name = "DebugEditor";
|
this.Name = "DebugEditor";
|
||||||
this.Text = "DebugEditor";
|
this.Text = "sfall Debug Editor";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DebugEditor_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DebugEditor_FormClosing);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
@@ -172,11 +180,11 @@
|
|||||||
private System.Windows.Forms.Button bCritters;
|
private System.Windows.Forms.Button bCritters;
|
||||||
private System.Windows.Forms.Button bSGlobals;
|
private System.Windows.Forms.Button bSGlobals;
|
||||||
private System.Windows.Forms.Button bArrays;
|
private System.Windows.Forms.Button bArrays;
|
||||||
|
private System.Windows.Forms.Button bEdit;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column0;
|
private System.Windows.Forms.DataGridViewTextBoxColumn Column0;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
|
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
|
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
||||||
private System.Windows.Forms.Button bEdit;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+170
-132
@@ -4,14 +4,16 @@ using System.ComponentModel;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using File=System.IO.File;
|
using File = System.IO.File;
|
||||||
using StreamReader=System.IO.StreamReader;
|
using StreamReader = System.IO.StreamReader;
|
||||||
using MemoryStream=System.IO.MemoryStream;
|
using MemoryStream = System.IO.MemoryStream;
|
||||||
using BinaryReader=System.IO.BinaryReader;
|
using BinaryReader = System.IO.BinaryReader;
|
||||||
using BinaryWriter=System.IO.BinaryWriter;
|
using BinaryWriter = System.IO.BinaryWriter;
|
||||||
|
|
||||||
namespace FalloutClient {
|
namespace FalloutClient {
|
||||||
public partial class DebugEditor : Form {
|
|
||||||
|
public partial class DebugEditor : Form
|
||||||
|
{
|
||||||
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)]
|
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)]
|
||||||
private struct ByteConverter {
|
private struct ByteConverter {
|
||||||
[System.Runtime.InteropServices.FieldOffset(0)]
|
[System.Runtime.InteropServices.FieldOffset(0)]
|
||||||
@@ -20,86 +22,91 @@ namespace FalloutClient {
|
|||||||
private float f;
|
private float f;
|
||||||
|
|
||||||
public int GetAsInt(float f) {
|
public int GetAsInt(float f) {
|
||||||
this.f=f;
|
this.f = f;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
public float GetAsFloat(int i) {
|
public float GetAsFloat(int i) {
|
||||||
this.i=i;
|
this.i = i;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
public byte[] GetAsBytes(ulong ul) {
|
public byte[] GetAsBytes(ulong ul) {
|
||||||
byte[] b=new byte[8];
|
byte[] b = new byte[8];
|
||||||
for(int i=0;i<8;i++) b[i]=(byte)((ul&((ulong)0xff<<(i*8)))>>(i*8));
|
for (int i = 0; i < 8; i++) b[i] = (byte)((ul & ((ulong)0xff << (i * 8))) >> (i * 8));
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ByteConverter converter=new ByteConverter();
|
private static ByteConverter converter = new ByteConverter();
|
||||||
|
|
||||||
private enum Mode { Globals, MapVars, SGlobals, Arrays, Critters }
|
private enum Mode { Globals, MapVars, SGlobals, Arrays, Critters }
|
||||||
|
|
||||||
private readonly EditorConnection connection;
|
private readonly EditorConnection connection;
|
||||||
private Mode mode;
|
private Mode mode;
|
||||||
|
|
||||||
private readonly Dictionary<int, string> GlobNames=new Dictionary<int, string>();
|
private readonly Dictionary<int, string> GlobNames = new Dictionary<int, string>();
|
||||||
private readonly Dictionary<uint, string> CritNames=new Dictionary<uint, string>();
|
private readonly Dictionary<uint, string> CritNames = new Dictionary<uint, string>();
|
||||||
|
|
||||||
private void Redraw() {
|
private void Redraw() {
|
||||||
dataGridView1.SuspendLayout();
|
dataGridView1.SuspendLayout();
|
||||||
dataGridView1.Rows.Clear();
|
dataGridView1.Rows.Clear();
|
||||||
switch(mode) {
|
switch (mode) {
|
||||||
case Mode.Globals:
|
case Mode.Globals:
|
||||||
Column2.ReadOnly=false;
|
Column2.ReadOnly = false;
|
||||||
Column3.ReadOnly=false;
|
Column3.ReadOnly = false;
|
||||||
Column2.HeaderText="Value (Int)";
|
Column2.HeaderText = "Value (Int)";
|
||||||
Column3.HeaderText="Value (Float)";
|
Column3.HeaderText = "Value (Float)";
|
||||||
bEdit.Enabled=false;
|
bEdit.Enabled = false;
|
||||||
for(int i=0;i<connection.Globals.Length;i++) {
|
for (int i = 0; i < connection.Globals.Length; i++) {
|
||||||
string name=GlobNames.ContainsKey(i)?GlobNames[i]:"";
|
string name = GlobNames.ContainsKey(i) ? GlobNames[i] : "";
|
||||||
dataGridView1.Rows.Add(i, name, connection.Globals[i], converter.GetAsFloat(connection.Globals[i]));
|
dataGridView1.Rows.Add(i, name, connection.Globals[i], converter.GetAsFloat(connection.Globals[i]));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Mode.MapVars:
|
case Mode.MapVars:
|
||||||
Column2.ReadOnly=false;
|
Column2.ReadOnly = false;
|
||||||
Column3.ReadOnly=false;
|
Column3.ReadOnly = false;
|
||||||
Column2.HeaderText="Value (Int)";
|
Column2.HeaderText = "Value (Int)";
|
||||||
Column3.HeaderText="Value (Float)";
|
Column3.HeaderText = "Value (Float)";
|
||||||
bEdit.Enabled=false;
|
bEdit.Enabled = false;
|
||||||
for(int i=0;i<connection.MapVars.Length;i++) {
|
for (int i = 0; i < connection.MapVars.Length; i++) {
|
||||||
dataGridView1.Rows.Add(i, "", connection.MapVars[i], converter.GetAsFloat(connection.MapVars[i]));
|
dataGridView1.Rows.Add(i, "", connection.MapVars[i], converter.GetAsFloat(connection.MapVars[i]));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Mode.SGlobals:
|
case Mode.SGlobals:
|
||||||
Column2.ReadOnly=false;
|
Column2.ReadOnly = false;
|
||||||
Column3.ReadOnly=false;
|
Column3.ReadOnly = false;
|
||||||
Column2.HeaderText="Value (Int)";
|
Column2.HeaderText = "Value (Int)";
|
||||||
Column3.HeaderText="Value (Float)";
|
Column3.HeaderText = "Value (Float)";
|
||||||
bEdit.Enabled=false;
|
bEdit.Enabled = false;
|
||||||
for(int i=0;i<connection.SGlobalKeys.Length;i++) {
|
for (int i = 0; i < connection.SGlobalKeys.Length; i++) {
|
||||||
string s=connection.SGlobalKeys[i]>0xffffffff?new string(System.Text.ASCIIEncoding.ASCII.GetChars(converter.GetAsBytes(connection.SGlobalKeys[i]))):("0x"+connection.SGlobalKeys[i].ToString("x"));
|
string s = connection.SGlobalKeys[i] > 0xffffffff
|
||||||
|
? new string(System.Text.ASCIIEncoding.ASCII.GetChars(converter.GetAsBytes(connection.SGlobalKeys[i])))
|
||||||
|
: (connection.SGlobalKeys[i].ToString());
|
||||||
dataGridView1.Rows.Add(s, "", connection.sGlobals[i], converter.GetAsFloat(connection.sGlobals[i]));
|
dataGridView1.Rows.Add(s, "", connection.sGlobals[i], converter.GetAsFloat(connection.sGlobals[i]));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Mode.Arrays:
|
case Mode.Arrays:
|
||||||
Column2.ReadOnly=true;
|
Column2.ReadOnly = true;
|
||||||
Column3.ReadOnly=true;
|
Column3.ReadOnly = true;
|
||||||
Column2.HeaderText="Array length";
|
Column2.HeaderText = "Array size";
|
||||||
Column3.HeaderText="Element size";
|
Column3.HeaderText = "Array flags";
|
||||||
bEdit.Enabled=true;
|
bEdit.Enabled = true;
|
||||||
for(int i=0;i<connection.Arrays.Length;i++) {
|
for (int i = 0; i < connection.Arrays.Length; i++) {
|
||||||
dataGridView1.Rows.Add(connection.Arrays[i], "", connection.ArrayLengths[i], connection.ArrayDataSizes[i]);
|
bool isMap = connection.ArrayIsMap[i];
|
||||||
|
int arrlen = connection.ArrayLengths[i];
|
||||||
|
if (isMap) arrlen /= 2;
|
||||||
|
dataGridView1.Rows.Add(connection.Arrays[i], isMap ? "Map" : "", arrlen, "0x" + connection.ArrayDataSizes[i].ToString("x").ToUpper());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Mode.Critters:
|
case Mode.Critters:
|
||||||
Column2.ReadOnly=true;
|
Column2.ReadOnly = true;
|
||||||
Column3.ReadOnly=true;
|
Column3.ReadOnly = true;
|
||||||
Column2.HeaderText="pid";
|
Column2.HeaderText = "Pid";
|
||||||
Column3.HeaderText="";
|
Column3.HeaderText = "Pointer";
|
||||||
bEdit.Enabled=true;
|
bEdit.Enabled = true;
|
||||||
for(int i=0;i<connection.Critters.Length;i++) {
|
for (int i = 0; i < connection.Critters.Length / 2; i++) {
|
||||||
uint modcrit=(connection.Critters[i]&0xfffff);
|
uint modcrit = (connection.Critters[i, 0] & 0xfffff);
|
||||||
string name=CritNames.ContainsKey(modcrit)?CritNames[modcrit]:"";
|
string name = CritNames.ContainsKey(modcrit) ? CritNames[modcrit] : "";
|
||||||
dataGridView1.Rows.Add(i+1, name, connection.Critters[i].ToString("x"), "");
|
dataGridView1.Rows.Add(i + 1, name, connection.Critters[i, 0].ToString("x").ToUpper(), connection.Critters[i, 1].ToString());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -108,21 +115,29 @@ namespace FalloutClient {
|
|||||||
|
|
||||||
internal DebugEditor(EditorConnection connection) {
|
internal DebugEditor(EditorConnection connection) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.connection=connection;
|
this.connection = connection;
|
||||||
mode=Mode.Globals;
|
mode = Mode.Globals;
|
||||||
if(File.Exists("globals.txt")) {
|
if (File.Exists(".\\data\\data\\vault13.gam")) {
|
||||||
StreamReader sr=new StreamReader("globals.txt");
|
StreamReader sr=new StreamReader(".\\data\\data\\vault13.gam");
|
||||||
while(!sr.EndOfStream) {
|
int gvar = 0;
|
||||||
string[] line=sr.ReadLine().Split(' ');
|
while (!sr.EndOfStream) {
|
||||||
GlobNames[int.Parse(line[0])]=line[1];
|
string line = sr.ReadLine().TrimStart();
|
||||||
|
if (line.StartsWith("GVAR_")) GlobNames[gvar++] = line.Remove(line.IndexOf(':')).TrimEnd();
|
||||||
|
}
|
||||||
|
sr.Close();
|
||||||
|
} else if (File.Exists("globals.txt")) {
|
||||||
|
StreamReader sr = new StreamReader("globals.txt");
|
||||||
|
while (!sr.EndOfStream) {
|
||||||
|
string[] line = sr.ReadLine().Split(' ');
|
||||||
|
GlobNames[int.Parse(line[0])] = line[1];
|
||||||
}
|
}
|
||||||
sr.Close();
|
sr.Close();
|
||||||
}
|
}
|
||||||
if(File.Exists("critters.txt")) {
|
if (File.Exists("critters.txt")) {
|
||||||
StreamReader sr=new StreamReader("critters.txt");
|
StreamReader sr = new StreamReader("critters.txt");
|
||||||
while(!sr.EndOfStream) {
|
while (!sr.EndOfStream) {
|
||||||
string line=sr.ReadLine();
|
string line = sr.ReadLine();
|
||||||
CritNames[uint.Parse(line.Remove(line.IndexOf(' ')))]=line.Substring(line.IndexOf(' ')+1);
|
CritNames[uint.Parse(line.Remove(line.IndexOf(' ')))] = line.Substring(line.IndexOf(' ') + 1);
|
||||||
}
|
}
|
||||||
sr.Close();
|
sr.Close();
|
||||||
}
|
}
|
||||||
@@ -135,65 +150,65 @@ namespace FalloutClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void bGlobals_Click(object sender, EventArgs e) {
|
private void bGlobals_Click(object sender, EventArgs e) {
|
||||||
mode=Mode.Globals;
|
mode = Mode.Globals;
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bMapVars_Click(object sender, EventArgs e) {
|
private void bMapVars_Click(object sender, EventArgs e) {
|
||||||
mode=Mode.MapVars;
|
mode = Mode.MapVars;
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bSGlobals_Click(object sender, EventArgs e) {
|
private void bSGlobals_Click(object sender, EventArgs e) {
|
||||||
mode=Mode.SGlobals;
|
mode = Mode.SGlobals;
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bArrays_Click(object sender, EventArgs e) {
|
private void bArrays_Click(object sender, EventArgs e) {
|
||||||
mode=Mode.Arrays;
|
mode = Mode.Arrays;
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bCritters_Click(object sender, EventArgs e) {
|
private void bCritters_Click(object sender, EventArgs e) {
|
||||||
mode=Mode.Critters;
|
mode = Mode.Critters;
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
|
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
|
||||||
int[] array=null;
|
int[] array = null;
|
||||||
DataTypeSend dts;
|
DataTypeSend dts;
|
||||||
switch(mode) {
|
switch (mode) {
|
||||||
case Mode.Globals:
|
case Mode.Globals:
|
||||||
array=connection.Globals;
|
array = connection.Globals;
|
||||||
dts=DataTypeSend.SetGlobal;
|
dts = DataTypeSend.SetGlobal;
|
||||||
break;
|
break;
|
||||||
case Mode.MapVars:
|
case Mode.MapVars:
|
||||||
array=connection.MapVars;
|
array = connection.MapVars;
|
||||||
dts=DataTypeSend.SetMapVar;
|
dts = DataTypeSend.SetMapVar;
|
||||||
break;
|
break;
|
||||||
case Mode.SGlobals:
|
case Mode.SGlobals:
|
||||||
array=connection.sGlobals;
|
array = connection.sGlobals;
|
||||||
dts=DataTypeSend.SetSGlobal;
|
dts = DataTypeSend.SetSGlobal;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(e.ColumnIndex==2) {
|
if (e.ColumnIndex == 2) {
|
||||||
int val;
|
int val;
|
||||||
if(!int.TryParse(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out val)) {
|
if (!int.TryParse(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out val)) {
|
||||||
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value=array[e.RowIndex];
|
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = array[e.RowIndex];
|
||||||
} else {
|
} else {
|
||||||
array[e.RowIndex]=val;
|
array[e.RowIndex] = val;
|
||||||
connection.WriteDataType(dts);
|
connection.WriteDataType(dts);
|
||||||
connection.WriteInt(e.RowIndex);
|
connection.WriteInt(e.RowIndex);
|
||||||
connection.WriteInt(val);
|
connection.WriteInt(val);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float val;
|
float val;
|
||||||
if(!float.TryParse(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out val)) {
|
if (!float.TryParse(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out val)) {
|
||||||
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value=array[e.RowIndex];
|
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = array[e.RowIndex];
|
||||||
} else {
|
} else {
|
||||||
array[e.RowIndex]=converter.GetAsInt(val);
|
array[e.RowIndex] = converter.GetAsInt(val);
|
||||||
connection.WriteDataType(dts);
|
connection.WriteDataType(dts);
|
||||||
connection.WriteInt(e.RowIndex);
|
connection.WriteInt(e.RowIndex);
|
||||||
connection.WriteInt(converter.GetAsInt(val));
|
connection.WriteInt(converter.GetAsInt(val));
|
||||||
@@ -202,43 +217,49 @@ namespace FalloutClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void bEdit_Click(object sender, EventArgs e) {
|
private void bEdit_Click(object sender, EventArgs e) {
|
||||||
if(dataGridView1.SelectedRows.Count!=1) return;
|
if (dataGridView1.SelectedRows.Count == 0) return;
|
||||||
int i=dataGridView1.SelectedRows[0].Index;
|
int i = dataGridView1.SelectedRows[0].Index;
|
||||||
switch(mode) {
|
switch (mode) {
|
||||||
case Mode.Arrays: {
|
case Mode.Arrays: {
|
||||||
DataType[] types=new DataType[connection.ArrayLengths[i]];
|
DataType[] types = new DataType[connection.ArrayLengths[i]];
|
||||||
string[] strings=new string[connection.ArrayLengths[i]];
|
int[] lenType = new int[connection.ArrayLengths[i]];
|
||||||
connection.WriteDataType(DataTypeSend.GetArray);
|
string[] strings = new string[connection.ArrayLengths[i]];
|
||||||
connection.WriteInt(i);
|
connection.WriteDataType(DataTypeSend.GetArray); // code
|
||||||
for(int j=0;j<strings.Length;j++) types[j]=(DataType)connection.ReadInt();
|
connection.WriteInt(i); // index
|
||||||
byte[] buf=connection.ReadBytes(connection.ArrayLengths[i]*connection.ArrayDataSizes[i]);
|
int lenData = 0;
|
||||||
|
for (int j = 0; j < strings.Length; j++) {
|
||||||
|
types[j] = (DataType)connection.ReadInt();
|
||||||
|
lenType[j] = connection.ReadInt(); // len data of type
|
||||||
|
lenData += lenType[j];
|
||||||
|
}
|
||||||
|
byte[] buf = connection.ReadBytes(lenData); // read data
|
||||||
MemoryStream ms=new MemoryStream(buf);
|
MemoryStream ms=new MemoryStream(buf);
|
||||||
BinaryReader br=new BinaryReader(ms);
|
BinaryReader br=new BinaryReader(ms);
|
||||||
for(int j=0;j<strings.Length;j++) {
|
ms.Position = 0;
|
||||||
ms.Position=j*connection.ArrayDataSizes[i];
|
for (int j = 0; j < strings.Length; j++) {
|
||||||
switch(types[j]) {
|
switch (types[j]) {
|
||||||
case DataType.Int:
|
case DataType.Int:
|
||||||
strings[j]=br.ReadInt32().ToString();
|
strings[j] = br.ReadInt32().ToString();
|
||||||
break;
|
break;
|
||||||
case DataType.Float:
|
case DataType.Float:
|
||||||
strings[j]=br.ReadSingle().ToString();
|
strings[j] = br.ReadSingle().ToString();
|
||||||
break;
|
break;
|
||||||
case DataType.String:
|
case DataType.String:
|
||||||
byte[] bytes=br.ReadBytes(connection.ArrayDataSizes[i]);
|
byte[] bytes = br.ReadBytes(lenType[j]);
|
||||||
strings[j]=System.Text.Encoding.ASCII.GetString(bytes, 0, Array.IndexOf<byte>(bytes, 0));
|
strings[j] = System.Text.Encoding.ASCII.GetString(bytes, 0, lenType[j] - 1); //Array.IndexOf<byte>(bytes, 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
br.Close();
|
br.Close();
|
||||||
strings=EditorWindow.ShowEditor(null, types, strings);
|
strings = EditorWindow.ShowEditor(null, types, strings);
|
||||||
if(strings!=null) {
|
if (strings != null) { // save
|
||||||
connection.WriteDataType(DataTypeSend.SetArray);
|
connection.WriteDataType(DataTypeSend.SetArray);
|
||||||
connection.WriteInt(i);
|
connection.WriteInt(i);
|
||||||
ms=new MemoryStream(connection.ArrayLengths[i]*connection.ArrayDataSizes[i]);
|
ms = new MemoryStream(connection.ArrayLengths[i] * connection.ArrayDataSizes[i]);
|
||||||
BinaryWriter bw=new BinaryWriter(ms);
|
BinaryWriter bw=new BinaryWriter(ms);
|
||||||
for(int j=0;j<strings.Length;j++) {
|
for (int j = 0; j < strings.Length; j++) {
|
||||||
ms.Position=j*connection.ArrayDataSizes[i];
|
ms.Position = j * connection.ArrayDataSizes[i];
|
||||||
switch(types[j]) {
|
switch (types[j]) {
|
||||||
case DataType.Int:
|
case DataType.Int:
|
||||||
bw.Write(int.Parse(strings[j]));
|
bw.Write(int.Parse(strings[j]));
|
||||||
break;
|
break;
|
||||||
@@ -247,54 +268,71 @@ namespace FalloutClient {
|
|||||||
break;
|
break;
|
||||||
case DataType.String:
|
case DataType.String:
|
||||||
byte[] bytes=System.Text.Encoding.ASCII.GetBytes(strings[j]);
|
byte[] bytes=System.Text.Encoding.ASCII.GetBytes(strings[j]);
|
||||||
if(bytes.Length<connection.ArrayDataSizes[i]) bw.Write(bytes);
|
if (bytes.Length < connection.ArrayDataSizes[i]) bw.Write(bytes);
|
||||||
else bw.Write(bytes, 0, connection.ArrayDataSizes[i]-1);
|
else bw.Write(bytes, 0, connection.ArrayDataSizes[i] - 1);
|
||||||
bw.Write(0);
|
bw.Write(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
connection.WriteBytes(ms.GetBuffer(), 0, connection.ArrayLengths[i]*connection.ArrayDataSizes[i]);
|
connection.WriteBytes(ms.GetBuffer(), 0, connection.ArrayLengths[i] * connection.ArrayDataSizes[i]);
|
||||||
bw.Close();
|
bw.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Mode.Critters: {
|
case Mode.Critters: {
|
||||||
DataType[] types=new DataType[29];
|
DataType[] types=new DataType[33];
|
||||||
string[] strings=new string[29];
|
string[] strings=new string[33];
|
||||||
string[] names=new string[29];
|
string[] names=new string[33];
|
||||||
connection.WriteDataType(DataTypeSend.RetrieveCritter);
|
connection.WriteDataType(DataTypeSend.RetrieveCritter);
|
||||||
connection.WriteInt(i);
|
connection.WriteInt(i);
|
||||||
BinaryReader br=new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(29*4)));
|
BinaryReader br=new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(33 * 4)));
|
||||||
for(int j=0;j<29;j++) {
|
for (int j = 0; j < 33; j++) {
|
||||||
types[j]=DataType.Int;
|
types[j] = DataType.Int;
|
||||||
strings[j]=br.ReadInt32().ToString();
|
strings[j] = br.ReadInt32().ToString();
|
||||||
names[j]="0x"+(j*4).ToString("x");
|
|
||||||
}
|
}
|
||||||
br.Close();
|
br.Close();
|
||||||
names[1]="Tile";
|
names[0] = " ID";
|
||||||
names[10]="Elevation";
|
names[1] = " Tile";
|
||||||
names[11]="Inventory count";
|
names[6] = " Current frame";
|
||||||
names[13]="Inventory pointer";
|
names[7] = " Rotation";
|
||||||
names[16]="Current AP";
|
names[8] = " FID";
|
||||||
names[17]="Crippled limbs";
|
names[9] = " Flags";
|
||||||
names[22]="HP";
|
names[10] = " Elevation";
|
||||||
names[23]="Rads";
|
names[11] = " Inventory count";
|
||||||
names[24]="Poison";
|
names[13] = " Inventory pointer";
|
||||||
names[25]="Proto ID";
|
names[14] = " Reaction";
|
||||||
strings=EditorWindow.ShowEditor(names, types, strings);
|
names[15] = " Combat state";
|
||||||
if(strings!=null) {
|
names[16] = " Current AP";
|
||||||
MemoryStream ms=new MemoryStream(29*4);
|
names[17] = " Combat flags";
|
||||||
BinaryWriter bw=new BinaryWriter(ms);
|
names[18] = " Last Turn Damage";
|
||||||
for(int j=0;j<29;j++) bw.Write(int.Parse(strings[j]));
|
names[19] = " AI Packet";
|
||||||
|
names[20] = " Team";
|
||||||
|
names[21] = " Who hit me";
|
||||||
|
names[22] = " HP";
|
||||||
|
names[23] = " Rads";
|
||||||
|
names[24] = " Poison";
|
||||||
|
names[25] = " Proto ID";
|
||||||
|
names[26] = " Combat ID";
|
||||||
|
names[29] = " Outline flags";
|
||||||
|
names[30] = " Script ID";
|
||||||
|
names[32] = " Script index";
|
||||||
|
strings = EditorWindow.ShowEditor(names, types, strings);
|
||||||
|
if (strings != null) {
|
||||||
|
MemoryStream ms = new MemoryStream(33 * 4);
|
||||||
|
BinaryWriter bw = new BinaryWriter(ms);
|
||||||
|
for (int j = 0; j < 33; j++) bw.Write(int.Parse(strings[j]));
|
||||||
connection.WriteDataType(DataTypeSend.SetCritter);
|
connection.WriteDataType(DataTypeSend.SetCritter);
|
||||||
connection.WriteInt(i);
|
connection.WriteInt(i);
|
||||||
connection.WriteBytes(ms.GetBuffer(), 0, 29*4);
|
connection.WriteBytes(ms.GetBuffer(), 0, 33 * 4);
|
||||||
bw.Close();
|
bw.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) {
|
||||||
|
bEdit.PerformClick();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ using System.Net.Sockets;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace FalloutClient {
|
namespace FalloutClient {
|
||||||
class EditorConnection {
|
|
||||||
|
class EditorConnection
|
||||||
|
{
|
||||||
private TcpClient client;
|
private TcpClient client;
|
||||||
private NetworkStream stream;
|
private NetworkStream stream;
|
||||||
private BinaryReader br;
|
private BinaryReader br;
|
||||||
@@ -11,73 +13,81 @@ namespace FalloutClient {
|
|||||||
|
|
||||||
public readonly int[] Globals;
|
public readonly int[] Globals;
|
||||||
public readonly int[] MapVars;
|
public readonly int[] MapVars;
|
||||||
public readonly uint[] Critters;
|
public readonly uint[,] Critters;
|
||||||
public readonly ulong[] SGlobalKeys;
|
public readonly ulong[] SGlobalKeys;
|
||||||
public readonly int[] sGlobals;
|
public readonly int[] sGlobals;
|
||||||
public readonly uint[] Arrays;
|
public readonly uint[] Arrays;
|
||||||
public readonly int[] ArrayLengths;
|
public readonly int[] ArrayLengths;
|
||||||
public readonly int[] ArrayDataSizes;
|
public readonly int[] ArrayDataSizes;
|
||||||
|
public readonly bool[] ArrayIsMap;
|
||||||
|
|
||||||
public EditorConnection() {
|
public EditorConnection() {
|
||||||
System.Threading.Thread.Sleep(1000);
|
System.Threading.Thread.Sleep(1000);
|
||||||
client=new TcpClient("127.0.0.1", 4245);
|
client = new TcpClient("127.0.0.1", 4245);
|
||||||
stream=client.GetStream();
|
stream = client.GetStream();
|
||||||
br=new BinaryReader(stream);
|
br = new BinaryReader(stream);
|
||||||
bw=new BinaryWriter(stream);
|
bw = new BinaryWriter(stream);
|
||||||
Globals=new int[br.ReadInt32()];
|
Globals = new int[br.ReadInt32()];
|
||||||
MapVars=new int[br.ReadInt32()];
|
MapVars = new int[br.ReadInt32()];
|
||||||
SGlobalKeys=new ulong[br.ReadInt32()];
|
SGlobalKeys = new ulong[br.ReadInt32()];
|
||||||
sGlobals=new int[SGlobalKeys.Length];
|
sGlobals = new int[SGlobalKeys.Length];
|
||||||
Arrays=new uint[br.ReadInt32()];
|
Arrays = new uint[br.ReadInt32()];
|
||||||
ArrayLengths=new int[Arrays.Length];
|
ArrayLengths = new int[Arrays.Length];
|
||||||
ArrayDataSizes=new int[Arrays.Length];
|
ArrayDataSizes = new int[Arrays.Length];
|
||||||
Critters=new uint[br.ReadInt32()];
|
ArrayIsMap = new bool[Arrays.Length];
|
||||||
|
Critters = new uint[br.ReadInt32(), 2];
|
||||||
|
|
||||||
for(int i=0;i<Globals.Length;i++) Globals[i]=br.ReadInt32();
|
for (int i = 0; i < Globals.Length; i++) Globals[i] = br.ReadInt32();
|
||||||
for(int i=0;i<MapVars.Length;i++) MapVars[i]=br.ReadInt32();
|
for (int i = 0; i < MapVars.Length; i++) MapVars[i] = br.ReadInt32();
|
||||||
for(int i=0;i<sGlobals.Length;i++) {
|
for (int i = 0; i < sGlobals.Length; i++) {
|
||||||
SGlobalKeys[i]=br.ReadUInt64();
|
SGlobalKeys[i] = br.ReadUInt64();
|
||||||
sGlobals[i]=br.ReadInt32();
|
sGlobals[i] = br.ReadInt32();
|
||||||
br.ReadInt32();
|
br.ReadInt32();
|
||||||
}
|
}
|
||||||
for(int i=0;i<Arrays.Length;i++) {
|
for (int i = 0; i < Arrays.Length; i++) {
|
||||||
Arrays[i]=br.ReadUInt32();
|
Arrays[i] = br.ReadUInt32();
|
||||||
ArrayLengths[i]=br.ReadInt32();
|
ArrayIsMap[i] = (br.ReadInt32() != 0);
|
||||||
ArrayDataSizes[i]=br.ReadInt32();
|
ArrayLengths[i] = br.ReadInt32();
|
||||||
|
ArrayDataSizes[i] = br.ReadInt32();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < Critters.Length / 2; i++) {
|
||||||
|
Critters[i, 0] = br.ReadUInt32();
|
||||||
|
Critters[i, 1] = br.ReadUInt32();
|
||||||
}
|
}
|
||||||
for(int i=0;i<Critters.Length;i++) Critters[i]=br.ReadUInt32();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close() {
|
public void Close() {
|
||||||
stream.Close();
|
stream.Close();
|
||||||
client.Close();
|
client.Close();
|
||||||
stream=null;
|
stream = null;
|
||||||
client=null;
|
client = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteDataType(DataTypeSend type) {
|
public void WriteDataType(DataTypeSend type) {
|
||||||
stream.WriteByte((byte)type);
|
stream.WriteByte((byte)type);
|
||||||
//bw.Write((byte)type);
|
//bw.Write((byte)type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteByte(byte b) { bw.Write(b); }
|
public void WriteByte(byte b) { bw.Write(b); }
|
||||||
public void WriteInt16(short value) { bw.Write(value); }
|
public void WriteInt16(short value) { bw.Write(value); }
|
||||||
public void WriteInt(int value) { bw.Write(value); }
|
public void WriteInt(int value) { bw.Write(value); }
|
||||||
public void WriteBytes(byte[] buf) { bw.Write(buf); }
|
public void WriteBytes(byte[] buf) { bw.Write(buf); }
|
||||||
|
|
||||||
public void WriteBytes(byte[] buf, int start, int len) {
|
public void WriteBytes(byte[] buf, int start, int len) {
|
||||||
bw.Write(buf, start, len);
|
bw.Write(buf, start, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Read(byte[] buffer) {
|
public void Read(byte[] buffer) {
|
||||||
int upto=0;
|
int upto = 0;
|
||||||
while(upto<buffer.Length) {
|
while (upto < buffer.Length) {
|
||||||
upto+=stream.Read(buffer, upto, buffer.Length-upto);
|
upto += stream.Read(buffer, upto, buffer.Length - upto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void Read(byte[] buffer, int offset, int length) {
|
public void Read(byte[] buffer, int offset, int length) {
|
||||||
int upto=0;
|
int upto = 0;
|
||||||
//System.Diagnostics.Debug.WriteLine("Read - offset: "+offset+" length: "+length);
|
//System.Diagnostics.Debug.WriteLine("Read - offset: "+offset+" length: "+length);
|
||||||
while(upto<length) {
|
while (upto < length) {
|
||||||
upto+=stream.Read(buffer, offset+upto, length-upto);
|
upto += stream.Read(buffer, offset + upto, length - upto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int ReadByte() {
|
public int ReadByte() {
|
||||||
|
|||||||
Generated
+11
-6
@@ -35,7 +35,7 @@
|
|||||||
// bSave
|
// bSave
|
||||||
//
|
//
|
||||||
this.bSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.bSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.bSave.Location = new System.Drawing.Point(281, 265);
|
this.bSave.Location = new System.Drawing.Point(12, 265);
|
||||||
this.bSave.Name = "bSave";
|
this.bSave.Name = "bSave";
|
||||||
this.bSave.Size = new System.Drawing.Size(75, 23);
|
this.bSave.Size = new System.Drawing.Size(75, 23);
|
||||||
this.bSave.TabIndex = 0;
|
this.bSave.TabIndex = 0;
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
// bCancel
|
// bCancel
|
||||||
//
|
//
|
||||||
this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.bCancel.Location = new System.Drawing.Point(200, 265);
|
this.bCancel.Location = new System.Drawing.Point(281, 265);
|
||||||
this.bCancel.Name = "bCancel";
|
this.bCancel.Name = "bCancel";
|
||||||
this.bCancel.Size = new System.Drawing.Size(75, 23);
|
this.bCancel.Size = new System.Drawing.Size(75, 23);
|
||||||
this.bCancel.TabIndex = 1;
|
this.bCancel.TabIndex = 1;
|
||||||
@@ -58,9 +58,10 @@
|
|||||||
//
|
//
|
||||||
this.dataGridView1.AllowUserToAddRows = false;
|
this.dataGridView1.AllowUserToAddRows = false;
|
||||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView1.AllowUserToResizeRows = false;
|
||||||
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
this.Column1,
|
this.Column1,
|
||||||
@@ -68,13 +69,15 @@
|
|||||||
this.Column3});
|
this.Column3});
|
||||||
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
|
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
|
||||||
this.dataGridView1.Name = "dataGridView1";
|
this.dataGridView1.Name = "dataGridView1";
|
||||||
|
this.dataGridView1.RowHeadersVisible = false;
|
||||||
this.dataGridView1.Size = new System.Drawing.Size(344, 247);
|
this.dataGridView1.Size = new System.Drawing.Size(344, 247);
|
||||||
this.dataGridView1.TabIndex = 2;
|
this.dataGridView1.TabIndex = 2;
|
||||||
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
|
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
|
||||||
//
|
//
|
||||||
// Column1
|
// Column1
|
||||||
//
|
//
|
||||||
this.Column1.HeaderText = "Name";
|
this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
this.Column1.HeaderText = "Element";
|
||||||
this.Column1.Name = "Column1";
|
this.Column1.Name = "Column1";
|
||||||
this.Column1.ReadOnly = true;
|
this.Column1.ReadOnly = true;
|
||||||
//
|
//
|
||||||
@@ -83,11 +86,13 @@
|
|||||||
this.Column2.HeaderText = "Type";
|
this.Column2.HeaderText = "Type";
|
||||||
this.Column2.Name = "Column2";
|
this.Column2.Name = "Column2";
|
||||||
this.Column2.ReadOnly = true;
|
this.Column2.ReadOnly = true;
|
||||||
|
this.Column2.Width = 90;
|
||||||
//
|
//
|
||||||
// Column3
|
// Column3
|
||||||
//
|
//
|
||||||
this.Column3.HeaderText = "Value";
|
this.Column3.HeaderText = "Value";
|
||||||
this.Column3.Name = "Column3";
|
this.Column3.Name = "Column3";
|
||||||
|
this.Column3.Width = 125;
|
||||||
//
|
//
|
||||||
// EditorWindow
|
// EditorWindow
|
||||||
//
|
//
|
||||||
@@ -98,7 +103,7 @@
|
|||||||
this.Controls.Add(this.bCancel);
|
this.Controls.Add(this.bCancel);
|
||||||
this.Controls.Add(this.bSave);
|
this.Controls.Add(this.bSave);
|
||||||
this.Name = "EditorWindow";
|
this.Name = "EditorWindow";
|
||||||
this.Text = "EditorWindow";
|
this.Text = "Editor Window";
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
|||||||
+23
-14
@@ -3,31 +3,38 @@ using System.Collections.Generic;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace FalloutClient {
|
namespace FalloutClient {
|
||||||
public enum DataType : int { None=0, Int=1, Float=2, String=3 }
|
|
||||||
public partial class EditorWindow : Form {
|
public enum DataType : int { None = 0, Int = 1, Float = 2, String = 3 }
|
||||||
|
|
||||||
|
public partial class EditorWindow : Form
|
||||||
|
{
|
||||||
private readonly DataType[] types;
|
private readonly DataType[] types;
|
||||||
private readonly string[] values;
|
private readonly string[] values;
|
||||||
private bool save;
|
private bool save;
|
||||||
|
|
||||||
private EditorWindow(string[] names, DataType[] types, string[] values) {
|
private EditorWindow(string[] names, DataType[] types, string[] values) {
|
||||||
this.types=types;
|
this.types = types;
|
||||||
this.values=values;
|
this.values = values;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
dataGridView1.SuspendLayout();
|
dataGridView1.SuspendLayout();
|
||||||
if(names==null) for(int i=0;i<types.Length;i++) dataGridView1.Rows.Add(i.ToString(), types[i].ToString(), values[i]);
|
if (names == null)
|
||||||
else for(int i=0;i<types.Length;i++) dataGridView1.Rows.Add(names[i], types[i].ToString(), values[i]);
|
for (int i = 0; i < types.Length; i++) dataGridView1.Rows.Add(i.ToString(), types[i].ToString(), values[i]);
|
||||||
|
else
|
||||||
|
for (int i = 0; i < types.Length; i++) dataGridView1.Rows.Add("0x" + (i * 4).ToString("x").ToUpper() + names[i], types[i].ToString(), values[i]);
|
||||||
dataGridView1.ResumeLayout();
|
dataGridView1.ResumeLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string[] ShowEditor(string[] names, DataType[] types, string[] values) {
|
public static string[] ShowEditor(string[] names, DataType[] types, string[] values) {
|
||||||
EditorWindow editor=new EditorWindow(names, types, values);
|
EditorWindow editor = new EditorWindow(names, types, values);
|
||||||
editor.ShowDialog();
|
editor.ShowDialog();
|
||||||
if(editor.save) return editor.values;
|
if (editor.save)
|
||||||
else return null;
|
return editor.values;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckInput(DataType type, string str) {
|
private bool CheckInput(DataType type, string str) {
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case DataType.Int:
|
case DataType.Int:
|
||||||
int i;
|
int i;
|
||||||
return int.TryParse(str, out i);
|
return int.TryParse(str, out i);
|
||||||
@@ -39,9 +46,11 @@ namespace FalloutClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
|
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
|
||||||
string str=(string)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
string str = (string)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||||
if(CheckInput(types[e.RowIndex], str)) values[e.RowIndex]=str;
|
if (CheckInput(types[e.RowIndex], str))
|
||||||
else dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value=values[e.RowIndex];
|
values[e.RowIndex] = str;
|
||||||
|
else
|
||||||
|
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = values[e.RowIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bCancel_Click(object sender, EventArgs e) {
|
private void bCancel_Click(object sender, EventArgs e) {
|
||||||
@@ -49,7 +58,7 @@ namespace FalloutClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void bSave_Click(object sender, EventArgs e) {
|
private void bSave_Click(object sender, EventArgs e) {
|
||||||
save=true;
|
save = true;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,13 +126,4 @@
|
|||||||
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
</root>
|
||||||
+9
-4
@@ -12,7 +12,7 @@ namespace FalloutClient {
|
|||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
if(args.Length==1&&args[0]=="-debugedit") {
|
if (args.Length == 1 && args[0] == "-debugedit") {
|
||||||
Application.Run(new DebugEditor(new EditorConnection()));
|
Application.Run(new DebugEditor(new EditorConnection()));
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Multiplayer is no longer supported");
|
throw new Exception("Multiplayer is no longer supported");
|
||||||
@@ -21,8 +21,13 @@ namespace FalloutClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum DataTypeSend {
|
enum DataTypeSend {
|
||||||
Mouse=0, LMouseDown=1, LMouseUp=2, RMouseDown=3, RMouseUp=4, TakeChar=5, ReleaseChar=6,
|
SetGlobal = 0,
|
||||||
SetGlobal=0, SetMapVar=1, RetrieveCritter=2, SetCritter=3, SetSGlobal=4, GetArray=9, SetArray=10,
|
SetMapVar = 1,
|
||||||
Exit=254
|
RetrieveCritter = 2,
|
||||||
|
SetCritter = 3,
|
||||||
|
SetSGlobal = 4,
|
||||||
|
GetArray = 9,
|
||||||
|
SetArray = 10,
|
||||||
|
Exit = 254
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
|
|||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("FalloutClient")]
|
[assembly: AssemblyTitle("Fallout sfall Debug Editor")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("FalloutClient")]
|
[assembly: AssemblyProduct("sfall")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2009")]
|
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("4.1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("4.1.7.0")]
|
||||||
|
|||||||
@@ -16,6 +16,21 @@
|
|||||||
<UpgradeBackupLocation>
|
<UpgradeBackupLocation>
|
||||||
</UpgradeBackupLocation>
|
</UpgradeBackupLocation>
|
||||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||||
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -33,6 +48,8 @@
|
|||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
@@ -62,6 +79,23 @@
|
|||||||
<DependentUpon>EditorWindow.cs</DependentUpon>
|
<DependentUpon>EditorWindow.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Клиентский профиль .NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Установщик Windows 3.1</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
@@ -71,6 +105,7 @@
|
|||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>copy "$(TargetPath)" "C:\Games\Fallout2\$(TargetName)$(TargetExt)"</PostBuildEvent>
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
# Visual Studio 2010
|
# Visual Studio 2010
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPClient", "MPClient.csproj", "{80ED0DCE-100E-4EC9-A79D-2FBFA4CAD1E3}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SfallDebugEditor", "SfallDebugEditor.csproj", "{80ED0DCE-100E-4EC9-A79D-2FBFA4CAD1E3}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -48,6 +48,13 @@ static const char* debugGnw = "GNW";
|
|||||||
|
|
||||||
static DWORD debugEditorKey = 0;
|
static DWORD debugEditorKey = 0;
|
||||||
|
|
||||||
|
struct sArray {
|
||||||
|
DWORD id;
|
||||||
|
long isMap;
|
||||||
|
long size;
|
||||||
|
long flag;
|
||||||
|
};
|
||||||
|
|
||||||
static bool SetBlocking(SOCKET s, bool block) {
|
static bool SetBlocking(SOCKET s, bool block) {
|
||||||
DWORD d = !block;
|
DWORD d = !block;
|
||||||
ioctlsocket(s, FIONBIO, &d);
|
ioctlsocket(s, FIONBIO, &d);
|
||||||
@@ -113,15 +120,16 @@ static void RunEditorInternal(SOCKET &s) {
|
|||||||
|
|
||||||
GlobalVar* sglobals = new GlobalVar[numSGlobals];
|
GlobalVar* sglobals = new GlobalVar[numSGlobals];
|
||||||
GetGlobals(sglobals);
|
GetGlobals(sglobals);
|
||||||
int* arrays = new int[numArrays * 3];
|
sArray* arrays = new sArray[numArrays];
|
||||||
script::GetArrays(arrays);
|
script::GetArrays((int*)arrays);
|
||||||
|
|
||||||
InternalSend(s, reinterpret_cast<void*>(fo::var::game_global_vars), 4 * numGlobals);
|
InternalSend(s, reinterpret_cast<void*>(fo::var::game_global_vars), 4 * numGlobals);
|
||||||
InternalSend(s, reinterpret_cast<void*>(fo::var::map_global_vars), 4 * numMapVars);
|
InternalSend(s, reinterpret_cast<void*>(fo::var::map_global_vars), 4 * numMapVars);
|
||||||
InternalSend(s, sglobals, sizeof(GlobalVar)*numSGlobals);
|
InternalSend(s, sglobals, sizeof(GlobalVar)*numSGlobals);
|
||||||
InternalSend(s, arrays, numArrays * 3 * 4);
|
InternalSend(s, arrays, numArrays * sizeof(sArray));
|
||||||
for (int i = 0; i < numCritters; i++) {
|
for (int i = 0; i < numCritters; i++) {
|
||||||
InternalSend(s, &vec[i][25], 4);
|
InternalSend(s, &vec[i][25], 4);
|
||||||
|
InternalSend(s, &vec[i], 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -140,38 +148,44 @@ static void RunEditorInternal(SOCKET &s) {
|
|||||||
InternalRecv(s, &val, 4);
|
InternalRecv(s, &val, 4);
|
||||||
fo::var::map_global_vars[id] = val;
|
fo::var::map_global_vars[id] = val;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: // Retrieve Critter
|
||||||
InternalRecv(s, &id, 4);
|
InternalRecv(s, &id, 4);
|
||||||
InternalSend(s, vec[id], 0x74);
|
InternalSend(s, vec[id], 0x84);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3: // Set Critter
|
||||||
InternalRecv(s, &id, 4);
|
InternalRecv(s, &id, 4);
|
||||||
InternalRecv(s, vec[id], 0x74);
|
InternalRecv(s, vec[id], 0x84);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
InternalRecv(s, &id, 4);
|
InternalRecv(s, &id, 4);
|
||||||
InternalRecv(s, &val, 4);
|
InternalRecv(s, &val, 4);
|
||||||
sglobals[id].val = val;
|
sglobals[id].val = val;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9: // get array values
|
||||||
{
|
{
|
||||||
InternalRecv(s, &id, 4);
|
InternalRecv(s, &id, 4);
|
||||||
DWORD *types = new DWORD[arrays[id * 3 + 1]];
|
DWORD *types = new DWORD[arrays[id].size * 2]; // type, len
|
||||||
char *data = new char[arrays[id * 3 + 1] * arrays[id * 3 + 2]];
|
script::DEGetArray(arrays[id].id, types, nullptr);
|
||||||
script::DEGetArray(arrays[id * 3], types, data);
|
int dataLen = 0;
|
||||||
InternalSend(s, types, arrays[id * 3 + 1] * 4);
|
for (long i = 0; i < arrays[id].size; i++) {
|
||||||
InternalSend(s, data, arrays[id * 3 + 1] * arrays[id * 3 + 2]);
|
dataLen += types[i * 2 + 1];
|
||||||
delete[] data;
|
}
|
||||||
delete[] types;
|
char *data = new char[dataLen];
|
||||||
|
script::DEGetArray(arrays[id].id, nullptr, data);
|
||||||
|
InternalSend(s, types, arrays[id].size * 8);
|
||||||
|
InternalSend(s, data, dataLen);
|
||||||
|
delete[] data;
|
||||||
|
delete[] types;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10: // set array values
|
||||||
{
|
{
|
||||||
InternalRecv(s, &id, 4);
|
//InternalRecv(s, &id, 4);
|
||||||
char *data = new char[arrays[id * 3 + 1] * arrays[id * 3 + 2]];
|
//InternalRecv(s, &val, 4);
|
||||||
InternalRecv(s, data, arrays[id * 3 + 1] * arrays[id * 3 + 2]);
|
//char *data = new char[arrays[id].size * arrays[id * 3 + 2]];
|
||||||
script::DESetArray(arrays[id * 3], 0, data);
|
//InternalRecv(s, data, arrays[id].size * arrays[id * 3 + 2]);
|
||||||
delete[] data;
|
//script::DESetArray(arrays[id].id, 0, data);
|
||||||
|
//delete[] data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,19 +310,37 @@ void GetArrays(int* _arrays) {
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
array_citr itr = arrays.begin();
|
array_citr itr = arrays.begin();
|
||||||
while (itr != arrays.end()) {
|
while (itr != arrays.end()) {
|
||||||
_arrays[pos++] = itr->first;
|
_arrays[pos++] = itr->first; // array id
|
||||||
_arrays[pos++] = itr->second.size();
|
_arrays[pos++] = itr->second.isAssoc() ? 1 : 0;
|
||||||
|
_arrays[pos++] = itr->second.val.size();
|
||||||
_arrays[pos++] = itr->second.flags;
|
_arrays[pos++] = itr->second.flags;
|
||||||
itr++;
|
itr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// those too are not really used yet in FalloutClient (AFAIK) -- phobos2077
|
void DEGetArray(int id, DWORD* types, char* data) {
|
||||||
void DEGetArray(int id, DWORD* types, void* data) {
|
int pos = 0;
|
||||||
//memcpy(types, arrays[id].types, arrays[id].len*4);
|
if (types != nullptr) {
|
||||||
//memcpy(data, arrays[id].data, arrays[id].len*arrays[id].datalen);
|
for (size_t i = 0; i < arrays[id].val.size(); i++) {
|
||||||
|
const auto& arVal = arrays[id].val[i];
|
||||||
|
types[pos++] = (DWORD)arVal.type;
|
||||||
|
types[pos++] = (arVal.type == DataType::STR) ? arVal.len : 4; // in bytes
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (size_t i = 0; i < arrays[id].val.size(); i++) {
|
||||||
|
const auto& arVal = arrays[id].val[i];
|
||||||
|
if (arVal.type != DataType::STR) {
|
||||||
|
*(long*)(data + pos) = arVal.intVal;
|
||||||
|
pos += 4;
|
||||||
|
} else {
|
||||||
|
strcpy(data + pos, arVal.strVal);
|
||||||
|
pos += arVal.len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// those too are not really used yet in FalloutClient (AFAIK) -- phobos2077
|
||||||
void DESetArray(int id, const DWORD* types, const void* data) {
|
void DESetArray(int id, const DWORD* types, const void* data) {
|
||||||
//if (types) memcpy(arrays[id].types, types, arrays[id].len * 4);
|
//if (types) memcpy(arrays[id].types, types, arrays[id].len * 4);
|
||||||
//memcpy(arrays[id].data, data, arrays[id].len*arrays[id].datalen);
|
//memcpy(arrays[id].data, data, arrays[id].len*arrays[id].datalen);
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ void SaveArrays(HANDLE h);
|
|||||||
int GetNumArrays();
|
int GetNumArrays();
|
||||||
void GetArrays(int* arrays);
|
void GetArrays(int* arrays);
|
||||||
|
|
||||||
void DEGetArray(int id, DWORD* types, void* data);
|
void DEGetArray(int id, DWORD* types, char* data);
|
||||||
void DESetArray(int id, const DWORD* types, const void* data);
|
void DESetArray(int id, const DWORD* types, const void* data);
|
||||||
|
|
||||||
// creates new normal (persistent) array. len == -1 specifies associative array (map)
|
// creates new normal (persistent) array. len == -1 specifies associative array (map)
|
||||||
|
|||||||
Reference in New Issue
Block a user