mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba3ad33587 | ||
|
|
6e74c3166a | ||
|
|
e320acce0b | ||
|
|
4f48926105 | ||
|
|
5611931063 | ||
|
|
f00022fed6 | ||
|
|
78815425e2 | ||
|
|
9ddddcc120 | ||
|
|
11c15cec93 | ||
|
|
f36bd6fb61 | ||
|
|
26ab38c6c3 | ||
|
|
9b50e6be1e | ||
|
|
2427634ee8 | ||
|
|
36d1d0a5fc | ||
|
|
486f00cdf4 | ||
|
|
b6fd424665 | ||
|
|
3d679db758 | ||
|
|
92e1f919d9 | ||
|
|
d259e8c903 | ||
|
|
dea0e596c3 | ||
|
|
90b39f3dde | ||
|
|
c80224f661 | ||
|
|
d7d8de5e1a | ||
|
|
0a21e4abfa | ||
|
|
1340eeb0d3 | ||
|
|
a350fed4d1 | ||
|
|
402d4f40f2 | ||
|
|
0f49c7f68d | ||
|
|
deb0299776 | ||
|
|
4bb3fa0275 | ||
|
|
da31455cef | ||
|
|
4da10e2fdb | ||
|
|
5426d043c1 | ||
|
|
719cec74d1 | ||
|
|
627fe11c29 | ||
|
|
dcca405b89 | ||
|
|
cce9437d19 | ||
|
|
09b3bf3aed | ||
|
|
08a891a0fc | ||
|
|
e9df81ac78 | ||
|
|
3e982be4b6 | ||
|
|
8a888f387d | ||
|
|
712b4de5f7 | ||
|
|
a3b456cf0a | ||
|
|
9f689863d7 | ||
|
|
b5306406b3 | ||
|
|
ce3b9c172c | ||
|
|
b8a77d77fb | ||
|
|
a01da656c7 | ||
|
|
5eda8dd7a0 | ||
|
|
c05babeda7 | ||
|
|
cc2b95d64e | ||
|
|
fb62bd51b5 | ||
|
|
f4d7ccef40 | ||
|
|
85bb34377c | ||
|
|
af24c6eae4 | ||
|
|
930f463000 | ||
|
|
e1aefcc1ed | ||
|
|
25554ff0b2 | ||
|
|
dad0860d6e | ||
|
|
a7e492a80f | ||
|
|
d9b748c261 | ||
|
|
0aad511e3e | ||
|
|
d117296990 | ||
|
|
e672db53c7 | ||
|
|
25bbd91fc5 | ||
|
|
8db528330b | ||
|
|
f761f7834e | ||
|
|
f6c4e5133c | ||
|
|
2e30c86467 | ||
|
|
1679f7c59d | ||
|
|
9a4cbd4fa9 | ||
|
|
0c561ba677 | ||
|
|
20ccdacee8 | ||
|
|
d44663ce76 | ||
|
|
a196160258 | ||
|
|
55a97a5793 | ||
|
|
3eaa64ee16 | ||
|
|
aa9257ab1c | ||
|
|
81a8fd4863 | ||
|
|
ed260ad7e5 | ||
|
|
9dce3c8d62 | ||
|
|
f28a179c78 | ||
|
|
540abbe273 | ||
|
|
8dda3940d0 | ||
|
|
44b9b24490 | ||
|
|
dafbc357b2 | ||
|
|
02572a5193 | ||
|
|
cab19b5ca0 | ||
|
|
d6952a0c93 | ||
|
|
b996867d65 | ||
|
|
bd18c240f9 | ||
|
|
2ad28e3086 | ||
|
|
ef5ff4e90f | ||
|
|
0a672c1e10 | ||
|
|
01214633f4 | ||
|
|
334e98c4c1 | ||
|
|
78a29ad556 | ||
|
|
e5d14ff845 | ||
|
|
716bfd4156 | ||
|
|
9b67db7208 | ||
|
|
e92ded34e4 | ||
|
|
1689542165 | ||
|
|
2c86201db9 | ||
|
|
d7c9acf713 | ||
|
|
399da0d322 | ||
|
|
774adaa3b0 | ||
|
|
b4d174d91b | ||
|
|
3291f6fe17 | ||
|
|
84f442ca08 | ||
|
|
f5c35eb639 | ||
|
|
514894ed59 | ||
|
|
204810d067 | ||
|
|
ec4ba13a28 | ||
|
|
14a6ef7fc6 | ||
|
|
c3a74070ca | ||
|
|
302fd4bb51 | ||
|
|
c7520c71cf | ||
|
|
45632d6887 | ||
|
|
866c9165c0 | ||
|
|
813abbf452 | ||
|
|
c6864e01f6 | ||
|
|
0eab48932a | ||
|
|
6c3efc5b84 | ||
|
|
cb8d7dc94a | ||
|
|
5786cfb267 | ||
|
|
78dfb530a9 | ||
|
|
d588f2e691 | ||
|
|
daf7a82997 | ||
|
|
9ad2b19e1a | ||
|
|
4b66dd3682 | ||
|
|
4899aeece1 | ||
|
|
946266e367 | ||
|
|
438ea071fc | ||
|
|
89760235c7 | ||
|
|
321f1c6034 | ||
|
|
513338f160 | ||
|
|
08b92542f4 | ||
|
|
46013c94b0 | ||
|
|
7a4ab59089 | ||
|
|
e505e204cb | ||
|
|
7343754d53 | ||
|
|
ae1e17d359 | ||
|
|
32dbe5581d | ||
|
|
a93ad5a9ba | ||
|
|
874b047ce1 | ||
|
|
afa590c5a8 | ||
|
|
b89c52fcec | ||
|
|
ec2d323f75 | ||
|
|
586679b07f |
@@ -1,51 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'develop'
|
||||
- 'github-action'
|
||||
paths:
|
||||
- '.github/workflows/build.yml'
|
||||
- 'action.yml'
|
||||
- 'sfall/**'
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
name: sfall
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
|
||||
- name: Clone sfall
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Action is used twice for self-testing only
|
||||
# DevXP build results are intentionally *not* included in artifact
|
||||
|
||||
- name: ReleaseXP build
|
||||
id: build
|
||||
uses: ./
|
||||
with:
|
||||
release-xp: true
|
||||
|
||||
- name: DevXP build
|
||||
uses: ./
|
||||
with:
|
||||
dev-xp: true
|
||||
|
||||
- name: Prepare artifact
|
||||
run: |
|
||||
:
|
||||
mkdir -p sfall-build
|
||||
|
||||
cp artifacts/ddraw.ini sfall-build
|
||||
cp artifacts/sfall.dat sfall-build
|
||||
cp "${{ steps.build.outputs.release-xp }}" sfall-build
|
||||
shell: bash
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: sfall-build
|
||||
path: sfall-build
|
||||
retention-days: 14
|
||||
@@ -1,34 +0,0 @@
|
||||
name: github pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt -y -qq install bundler python3-pip
|
||||
pip3 install ruamel.yaml --user
|
||||
|
||||
- name: Build
|
||||
run: ./docs/generate.sh
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/_site
|
||||
user_name: 'github-actions[bot]'
|
||||
user_email: 'github-actions[bot]@users.noreply.github.com'
|
||||
-10
@@ -46,8 +46,6 @@ nb-configuration.xml
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
*.VC.db
|
||||
*.VC.opendb
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
@@ -55,10 +53,8 @@ nb-configuration.xml
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Dd]evXP
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
[Rr]eleaseXP/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
@@ -224,9 +220,3 @@ FakesAssemblies/
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
sfall/postbuild.cmd
|
||||
|
||||
# jekyll build files
|
||||
docs/_site
|
||||
docs/.sass-cache
|
||||
docs/.jekyll-metadata
|
||||
docs/pages/*.md
|
||||
|
||||
@@ -1,385 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using File = System.IO.File;
|
||||
using StreamReader = System.IO.StreamReader;
|
||||
using MemoryStream = System.IO.MemoryStream;
|
||||
using BinaryReader = System.IO.BinaryReader;
|
||||
using BinaryWriter = System.IO.BinaryWriter;
|
||||
|
||||
namespace FalloutClient {
|
||||
|
||||
public partial class DebugEditor : Form
|
||||
{
|
||||
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)]
|
||||
private struct ByteConverter {
|
||||
[System.Runtime.InteropServices.FieldOffset(0)]
|
||||
private int i;
|
||||
[System.Runtime.InteropServices.FieldOffset(0)]
|
||||
private float f;
|
||||
|
||||
public int GetAsInt(float f) {
|
||||
this.f = f;
|
||||
return i;
|
||||
}
|
||||
public float GetAsFloat(int i) {
|
||||
this.i = i;
|
||||
return f;
|
||||
}
|
||||
public byte[] GetAsBytes(ulong ul) {
|
||||
byte[] b = new byte[8];
|
||||
for (int i = 0; i < 8; i++) b[i] = (byte)((ul & ((ulong)0xff << (i * 8))) >> (i * 8));
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
private static ByteConverter converter = new ByteConverter();
|
||||
|
||||
private enum Mode { Globals, MapVars, SGlobals, Arrays, Critters, LocalVars }
|
||||
|
||||
private readonly EditorConnection connection;
|
||||
private Mode mode;
|
||||
|
||||
private readonly Dictionary<int, string> GlobNames = new Dictionary<int, string>();
|
||||
private readonly Dictionary<uint, string> CritNames = new Dictionary<uint, string>();
|
||||
|
||||
private void Redraw() {
|
||||
bCrittersLvar.Enabled = false;
|
||||
bEdit.Enabled = false;
|
||||
Column2.ReadOnly = false;
|
||||
Column3.ReadOnly = false;
|
||||
Column2.HeaderText = "Value (Int)";
|
||||
Column3.HeaderText = "Value (Float)";
|
||||
dataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect;
|
||||
dataGridView1.SuspendLayout();
|
||||
dataGridView1.Rows.Clear();
|
||||
switch (mode) {
|
||||
case Mode.Globals:
|
||||
for (int i = 0; i < connection.Globals.Length; i++) {
|
||||
string name = GlobNames.ContainsKey(i) ? GlobNames[i] : "";
|
||||
dataGridView1.Rows.Add(i, name, connection.Globals[i], converter.GetAsFloat(connection.Globals[i]));
|
||||
}
|
||||
break;
|
||||
case Mode.MapVars:
|
||||
for (int i = 0; i < connection.MapVars.Length; i++) {
|
||||
dataGridView1.Rows.Add(i, "", connection.MapVars[i], converter.GetAsFloat(connection.MapVars[i]));
|
||||
}
|
||||
break;
|
||||
case Mode.SGlobals:
|
||||
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])))
|
||||
: (connection.SGlobalKeys[i].ToString());
|
||||
dataGridView1.Rows.Add(s, "", connection.sGlobals[i], converter.GetAsFloat(connection.sGlobals[i]));
|
||||
}
|
||||
break;
|
||||
case Mode.Arrays:
|
||||
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
Column2.ReadOnly = true;
|
||||
Column3.ReadOnly = true;
|
||||
Column2.HeaderText = "Array size";
|
||||
Column3.HeaderText = "Array flags";
|
||||
bEdit.Enabled = true;
|
||||
for (int i = 0; i < connection.Arrays.Length; 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.ArrayFlag[i].ToString("x").ToUpper());
|
||||
}
|
||||
break;
|
||||
case Mode.Critters:
|
||||
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
Column2.ReadOnly = true;
|
||||
Column3.ReadOnly = true;
|
||||
Column2.HeaderText = "PID";
|
||||
Column3.HeaderText = "Pointer";
|
||||
bEdit.Enabled = true;
|
||||
bCrittersLvar.Enabled = true;
|
||||
for (int i = 0; i < connection.Critters.Length / 2; i++) {
|
||||
uint modcrit = (connection.Critters[i, 0] & 0xfffff);
|
||||
string name = CritNames.ContainsKey(modcrit) ? CritNames[modcrit] : "";
|
||||
dataGridView1.Rows.Add(i + 1, name, connection.Critters[i, 0].ToString("x").ToUpper(), connection.Critters[i, 1].ToString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
dataGridView1.ResumeLayout();
|
||||
}
|
||||
|
||||
internal DebugEditor(EditorConnection connection) {
|
||||
InitializeComponent();
|
||||
this.connection = connection;
|
||||
mode = Mode.Globals;
|
||||
if (File.Exists(".\\data\\data\\vault13.gam")) {
|
||||
StreamReader sr=new StreamReader(".\\data\\data\\vault13.gam");
|
||||
int gvar = 0;
|
||||
while (!sr.EndOfStream) {
|
||||
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();
|
||||
}
|
||||
if (File.Exists("critters.txt")) {
|
||||
StreamReader sr = new StreamReader("critters.txt");
|
||||
while (!sr.EndOfStream) {
|
||||
string line = sr.ReadLine();
|
||||
CritNames[uint.Parse(line.Remove(line.IndexOf(' ')))] = line.Substring(line.IndexOf(' ') + 1);
|
||||
}
|
||||
sr.Close();
|
||||
}
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void DebugEditor_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
connection.WriteDataType(DataTypeSend.Exit);
|
||||
connection.Close();
|
||||
}
|
||||
|
||||
private void bGlobals_Click(object sender, EventArgs e) {
|
||||
mode = Mode.Globals;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void bMapVars_Click(object sender, EventArgs e) {
|
||||
mode = Mode.MapVars;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void bSGlobals_Click(object sender, EventArgs e) {
|
||||
mode = Mode.SGlobals;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void bArrays_Click(object sender, EventArgs e) {
|
||||
mode = Mode.Arrays;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void bCritters_Click(object sender, EventArgs e) {
|
||||
mode = Mode.Critters;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
|
||||
int[] array = null;
|
||||
DataTypeSend dts;
|
||||
switch (mode) {
|
||||
case Mode.Globals:
|
||||
array = connection.Globals;
|
||||
dts = DataTypeSend.SetGlobal;
|
||||
break;
|
||||
case Mode.MapVars:
|
||||
array = connection.MapVars;
|
||||
dts = DataTypeSend.SetMapVar;
|
||||
break;
|
||||
case Mode.SGlobals:
|
||||
array = connection.sGlobals;
|
||||
dts = DataTypeSend.SetSGlobal;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (e.ColumnIndex == 2) {
|
||||
string str = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
|
||||
int val;
|
||||
if (str == null || !int.TryParse(str, out val)) {
|
||||
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = array[e.RowIndex];
|
||||
} else {
|
||||
array[e.RowIndex] = val;
|
||||
connection.WriteDataType(dts);
|
||||
connection.WriteInt(e.RowIndex);
|
||||
connection.WriteInt(val);
|
||||
}
|
||||
} else {
|
||||
string str = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
|
||||
float val;
|
||||
if (str == null || !float.TryParse(str, out val)) {
|
||||
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = array[e.RowIndex];
|
||||
} else {
|
||||
array[e.RowIndex] = converter.GetAsInt(val);
|
||||
connection.WriteDataType(dts);
|
||||
connection.WriteInt(e.RowIndex);
|
||||
connection.WriteInt(converter.GetAsInt(val));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void bEdit_Click(object sender, EventArgs e) {
|
||||
if (dataGridView1.SelectedRows.Count == 0) return;
|
||||
int i = (int)dataGridView1.SelectedRows[0].Tag;
|
||||
switch (mode) {
|
||||
case Mode.Arrays: {
|
||||
DataType[] types = new DataType[connection.ArrayLengths[i]];
|
||||
int[] lenType = new int[connection.ArrayLengths[i]];
|
||||
string[] strings = new string[connection.ArrayLengths[i]];
|
||||
connection.WriteDataType(DataTypeSend.GetArray); // code
|
||||
connection.WriteInt(i); // index
|
||||
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
|
||||
BinaryReader br = new BinaryReader(new MemoryStream(buf));
|
||||
for (int j = 0; j < strings.Length; j++) {
|
||||
switch (types[j]) {
|
||||
case DataType.None:
|
||||
br.BaseStream.Position += 4;
|
||||
break;
|
||||
case DataType.Int:
|
||||
strings[j] = br.ReadInt32().ToString();
|
||||
break;
|
||||
case DataType.Float:
|
||||
strings[j] = br.ReadSingle().ToString();
|
||||
break;
|
||||
case DataType.String:
|
||||
byte[] bytes = br.ReadBytes(lenType[j]);
|
||||
strings[j] = System.Text.Encoding.ASCII.GetString(bytes, 0, Array.IndexOf<byte>(bytes, 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
br.Close();
|
||||
strings = EditorWindow.ShowEditor(this, null, types, strings, connection.ArrayIsMap[i]);
|
||||
if (strings != null) { // save
|
||||
MemoryStream ms = new MemoryStream(lenData);
|
||||
BinaryWriter bw = new BinaryWriter(ms);
|
||||
for (int j = 0; j < strings.Length; j++) {
|
||||
switch (types[j]) {
|
||||
case DataType.None:
|
||||
bw.BaseStream.Position += 4;
|
||||
break;
|
||||
case DataType.Int:
|
||||
bw.Write(int.Parse(strings[j]));
|
||||
break;
|
||||
case DataType.Float:
|
||||
bw.Write(float.Parse(strings[j]));
|
||||
break;
|
||||
case DataType.String:
|
||||
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(strings[j]);
|
||||
if (bytes.Length < lenType[j])
|
||||
bw.Write(bytes);
|
||||
else
|
||||
bw.Write(bytes, 0, lenType[j] - 1);
|
||||
bw.Write((byte)0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// send data to sfall
|
||||
connection.WriteDataType(DataTypeSend.SetArray);
|
||||
connection.WriteInt(i); // index
|
||||
connection.WriteInt(lenData);
|
||||
connection.WriteBytes(ms.GetBuffer(), 0, lenData);
|
||||
bw.Close();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Mode.Critters: {
|
||||
DataType[] types = new DataType[33];
|
||||
string[] strings = new string[33];
|
||||
string[] names = new string[33];
|
||||
connection.WriteDataType(DataTypeSend.RetrieveCritter);
|
||||
connection.WriteInt(i);
|
||||
BinaryReader br = new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(33 * 4)));
|
||||
for (int j = 0; j < 33; j++) {
|
||||
types[j] = DataType.Int;
|
||||
strings[j] = br.ReadInt32().ToString();
|
||||
}
|
||||
br.Close();
|
||||
names[0] = " ID";
|
||||
names[1] = " Tile";
|
||||
names[6] = " Current frame";
|
||||
names[7] = " Rotation";
|
||||
names[8] = " FID";
|
||||
names[9] = " Flags";
|
||||
names[10] = " Elevation";
|
||||
names[11] = " Inventory count";
|
||||
names[13] = " Inventory pointer";
|
||||
names[14] = " Reaction";
|
||||
names[15] = " Combat state";
|
||||
names[16] = " Current AP";
|
||||
names[17] = " Combat flags";
|
||||
names[18] = " Last Turn Damage";
|
||||
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(this, 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.WriteInt(i);
|
||||
connection.WriteBytes(ms.GetBuffer(), 0, 33 * 4);
|
||||
bw.Close();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void bCrittersLvar_Click(object sender, EventArgs e) {
|
||||
if (dataGridView1.SelectedRows.Count == 0) return;
|
||||
int i = (int)dataGridView1.SelectedRows[0].Tag;
|
||||
|
||||
connection.WriteDataType(DataTypeSend.RetrieveCritter);
|
||||
connection.WriteInt(i);
|
||||
BinaryReader br = new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(33 * 4)));
|
||||
br.BaseStream.Position = 30 * 4;
|
||||
int sid = br.ReadInt32();
|
||||
br.Close();
|
||||
if (sid != -1) {
|
||||
connection.WriteDataType(DataTypeSend.GetLocal);
|
||||
connection.WriteInt(sid);
|
||||
int totalVar = connection.ReadInt();
|
||||
string[] values = new string[totalVar];
|
||||
if (totalVar > 0) {
|
||||
br = new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(totalVar * 4)));
|
||||
for (int j = 0; j < totalVar; j++) {
|
||||
values[j] = br.ReadInt32().ToString();
|
||||
}
|
||||
br.Close();
|
||||
}
|
||||
values = EditorWindow.ShowEditor(this, values);
|
||||
if (values != null) {
|
||||
int countVar = values.Length;
|
||||
MemoryStream ms = new MemoryStream(countVar * 4);
|
||||
BinaryWriter bw = new BinaryWriter(ms);
|
||||
for (int j = 0; j < countVar; j++) bw.Write(int.Parse(values[j]));
|
||||
connection.WriteDataType(DataTypeSend.SetLocal);
|
||||
connection.WriteInt(sid);
|
||||
connection.WriteInt(countVar);
|
||||
connection.WriteBytes(ms.GetBuffer(), 0, countVar * 4);
|
||||
bw.Close();
|
||||
}
|
||||
} else {
|
||||
MessageBox.Show("This critter has no script attached.");
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) {
|
||||
bEdit.PerformClick();
|
||||
}
|
||||
|
||||
private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) {
|
||||
dataGridView1.Rows[e.RowIndex].Tag = e.RowIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FalloutClient {
|
||||
|
||||
public enum DataType : int { None = 0, Int = 1, Float = 2, String = 3 }
|
||||
|
||||
public partial class EditorWindow : Form
|
||||
{
|
||||
private readonly DataType[] types = null;
|
||||
private string[] values;
|
||||
private bool save;
|
||||
private static bool valueInHex = false;
|
||||
|
||||
private void ConvertValues(bool toHex) {
|
||||
for (int i = 0; i < values.Length; i++) {
|
||||
if (toHex) {
|
||||
if (types == null || types[i] == DataType.Int) {
|
||||
int val = int.Parse(values[i]);
|
||||
values[i] = "0x" + val.ToString("x").ToUpper();
|
||||
}
|
||||
} else {
|
||||
if (types == null || types[i] == DataType.Int) {
|
||||
values[i] = Convert.ToInt32(values[i], 16).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private EditorWindow(string[] names, DataType[] types, string[] values, bool isMap) {
|
||||
this.types = types;
|
||||
this.values = values;
|
||||
|
||||
InitializeComponent();
|
||||
checkBox.Checked = EditorWindow.valueInHex;
|
||||
dataGridView1.SuspendLayout();
|
||||
if (valueInHex) ConvertValues(true);
|
||||
if (names == null)
|
||||
for (int i = 0; i < types.Length; i++) {
|
||||
string element = i.ToString();
|
||||
if (isMap && (i % 2) == 0) element += " - Key";
|
||||
dataGridView1.Rows.Add(element, 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();
|
||||
}
|
||||
|
||||
public static string[] ShowEditor(DebugEditor form, string[] names, DataType[] types, string[] values, bool isMap = false) {
|
||||
EditorWindow editor = new EditorWindow(names, types, values, isMap);
|
||||
editor.ShowDialog();
|
||||
if (editor.save) {
|
||||
if (valueInHex) editor.ConvertValues(false);
|
||||
return editor.values;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private EditorWindow(string[] values) {
|
||||
this.values = values;
|
||||
InitializeComponent();
|
||||
checkBox.Checked = EditorWindow.valueInHex;
|
||||
dataGridView1.SuspendLayout();
|
||||
if (valueInHex) ConvertValues(true);
|
||||
for (int i = 0; i < values.Length; i++) {
|
||||
dataGridView1.Rows.Add(i.ToString(), "Int", values[i]);
|
||||
}
|
||||
dataGridView1.ResumeLayout();
|
||||
}
|
||||
|
||||
public static string[] ShowEditor(DebugEditor form, string[] lvalues) {
|
||||
EditorWindow editor = new EditorWindow(lvalues);
|
||||
editor.ShowDialog();
|
||||
if (editor.save) {
|
||||
if (valueInHex) editor.ConvertValues(false);
|
||||
return editor.values;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool CheckInput(DataType type, string str) {
|
||||
switch (type) {
|
||||
case DataType.Int:
|
||||
if (valueInHex) {
|
||||
try {
|
||||
Convert.ToInt32(str, 16);
|
||||
return true;
|
||||
} catch (Exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int i;
|
||||
return int.TryParse(str, out i);
|
||||
case DataType.Float:
|
||||
float f;
|
||||
return float.TryParse(str, out f);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
|
||||
string str = (string)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
if (str != null && CheckInput(((types != null) ? types[e.RowIndex] : DataType.Int), str))
|
||||
values[e.RowIndex] = str;
|
||||
else
|
||||
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = values[e.RowIndex];
|
||||
}
|
||||
|
||||
private void bCancel_Click(object sender, EventArgs e) {
|
||||
Close();
|
||||
}
|
||||
|
||||
private void bSave_Click(object sender, EventArgs e) {
|
||||
save = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void checkBox_Click(object sender, EventArgs e) {
|
||||
valueInHex = checkBox.Checked;
|
||||
ConvertValues(valueInHex);
|
||||
for (int i = 0; i < values.Length; i++) {
|
||||
dataGridView1.Rows[i].Cells[2].Value = values[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace FalloutClient {
|
||||
static class Program {
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main(string[] args) {
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
if (args.Length == 1 && args[0] == "-debugedit") {
|
||||
Application.Run(new DebugEditor(new EditorConnection()));
|
||||
} else {
|
||||
MessageBox.Show("The debug editor can only be run from the game.\n" +
|
||||
"Use the key assigned to the DebugEditorKey option in ddraw.ini to run the debugger.",
|
||||
"sfall Debug Editor", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum DataTypeSend {
|
||||
SetGlobal = 0,
|
||||
SetMapVar = 1,
|
||||
RetrieveCritter = 2,
|
||||
SetCritter = 3,
|
||||
SetSGlobal = 4,
|
||||
GetArray = 9,
|
||||
SetArray = 10,
|
||||
GetLocal = 11,
|
||||
SetLocal = 12,
|
||||
Exit = 254
|
||||
}
|
||||
}
|
||||
+69
-95
@@ -24,17 +24,16 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.bGlobals = new System.Windows.Forms.Button();
|
||||
this.bMapVars = new System.Windows.Forms.Button();
|
||||
this.bCritters = new System.Windows.Forms.Button();
|
||||
this.bSGlobals = new System.Windows.Forms.Button();
|
||||
this.bArrays = new System.Windows.Forms.Button();
|
||||
this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.bEdit = new System.Windows.Forms.Button();
|
||||
this.bCrittersLvar = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -42,38 +41,84 @@
|
||||
//
|
||||
this.dataGridView1.AllowUserToAddRows = 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)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dataGridView1.ColumnHeadersHeight = 22;
|
||||
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.Right)));
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Column0,
|
||||
this.Column1,
|
||||
this.Column2,
|
||||
this.Column3});
|
||||
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
|
||||
this.dataGridView1.MultiSelect = false;
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.RowHeadersVisible = false;
|
||||
this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
|
||||
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(561, 354);
|
||||
this.dataGridView1.Size = new System.Drawing.Size(444, 215);
|
||||
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.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.dataGridView1_RowsAdded);
|
||||
//
|
||||
// bGlobals
|
||||
//
|
||||
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.Name = "bGlobals";
|
||||
this.bGlobals.Size = new System.Drawing.Size(100, 23);
|
||||
this.bGlobals.TabIndex = 1;
|
||||
this.bGlobals.Text = "Globals";
|
||||
this.bGlobals.UseVisualStyleBackColor = true;
|
||||
this.bGlobals.Click += new System.EventHandler(this.bGlobals_Click);
|
||||
//
|
||||
// bMapVars
|
||||
//
|
||||
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.Name = "bMapVars";
|
||||
this.bMapVars.Size = new System.Drawing.Size(100, 23);
|
||||
this.bMapVars.TabIndex = 2;
|
||||
this.bMapVars.Text = "Map variables";
|
||||
this.bMapVars.UseVisualStyleBackColor = true;
|
||||
this.bMapVars.Click += new System.EventHandler(this.bMapVars_Click);
|
||||
//
|
||||
// bCritters
|
||||
//
|
||||
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.Name = "bCritters";
|
||||
this.bCritters.Size = new System.Drawing.Size(100, 23);
|
||||
this.bCritters.TabIndex = 3;
|
||||
this.bCritters.Text = "Critters";
|
||||
this.bCritters.UseVisualStyleBackColor = true;
|
||||
this.bCritters.Click += new System.EventHandler(this.bCritters_Click);
|
||||
//
|
||||
// bSGlobals
|
||||
//
|
||||
this.bSGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.bSGlobals.Location = new System.Drawing.Point(225, 233);
|
||||
this.bSGlobals.Name = "bSGlobals";
|
||||
this.bSGlobals.Size = new System.Drawing.Size(100, 23);
|
||||
this.bSGlobals.TabIndex = 4;
|
||||
this.bSGlobals.Text = "sfall globals";
|
||||
this.bSGlobals.UseVisualStyleBackColor = true;
|
||||
this.bSGlobals.Click += new System.EventHandler(this.bSGlobals_Click);
|
||||
//
|
||||
// bArrays
|
||||
//
|
||||
this.bArrays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.bArrays.Location = new System.Drawing.Point(12, 262);
|
||||
this.bArrays.Name = "bArrays";
|
||||
this.bArrays.Size = new System.Drawing.Size(100, 23);
|
||||
this.bArrays.TabIndex = 5;
|
||||
this.bArrays.Text = "sfall arrays";
|
||||
this.bArrays.UseVisualStyleBackColor = true;
|
||||
this.bArrays.Click += new System.EventHandler(this.bArrays_Click);
|
||||
//
|
||||
// Column0
|
||||
//
|
||||
this.Column0.HeaderText = "ID";
|
||||
this.Column0.Name = "Column0";
|
||||
this.Column0.ReadOnly = true;
|
||||
this.Column0.Width = 50;
|
||||
//
|
||||
// Column1
|
||||
//
|
||||
this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Column1.HeaderText = "Name";
|
||||
this.Column1.Name = "Column1";
|
||||
this.Column1.ReadOnly = true;
|
||||
@@ -88,65 +133,10 @@
|
||||
this.Column3.HeaderText = "Value (Float)";
|
||||
this.Column3.Name = "Column3";
|
||||
//
|
||||
// bGlobals
|
||||
//
|
||||
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, 372);
|
||||
this.bGlobals.Name = "bGlobals";
|
||||
this.bGlobals.Size = new System.Drawing.Size(100, 23);
|
||||
this.bGlobals.TabIndex = 1;
|
||||
this.bGlobals.Text = "Globals";
|
||||
this.bGlobals.UseVisualStyleBackColor = true;
|
||||
this.bGlobals.Click += new System.EventHandler(this.bGlobals_Click);
|
||||
//
|
||||
// bMapVars
|
||||
//
|
||||
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, 372);
|
||||
this.bMapVars.Name = "bMapVars";
|
||||
this.bMapVars.Size = new System.Drawing.Size(100, 23);
|
||||
this.bMapVars.TabIndex = 2;
|
||||
this.bMapVars.Text = "Map variables";
|
||||
this.bMapVars.UseVisualStyleBackColor = true;
|
||||
this.bMapVars.Click += new System.EventHandler(this.bMapVars_Click);
|
||||
//
|
||||
// bCritters
|
||||
//
|
||||
this.bCritters.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.bCritters.Location = new System.Drawing.Point(12, 401);
|
||||
this.bCritters.Name = "bCritters";
|
||||
this.bCritters.Size = new System.Drawing.Size(100, 23);
|
||||
this.bCritters.TabIndex = 3;
|
||||
this.bCritters.Text = "Critters";
|
||||
this.bCritters.UseVisualStyleBackColor = true;
|
||||
this.bCritters.Click += new System.EventHandler(this.bCritters_Click);
|
||||
//
|
||||
// bSGlobals
|
||||
//
|
||||
this.bSGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.bSGlobals.Location = new System.Drawing.Point(367, 372);
|
||||
this.bSGlobals.Name = "bSGlobals";
|
||||
this.bSGlobals.Size = new System.Drawing.Size(100, 23);
|
||||
this.bSGlobals.TabIndex = 4;
|
||||
this.bSGlobals.Text = "sfall globals";
|
||||
this.bSGlobals.UseVisualStyleBackColor = true;
|
||||
this.bSGlobals.Click += new System.EventHandler(this.bSGlobals_Click);
|
||||
//
|
||||
// bArrays
|
||||
//
|
||||
this.bArrays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.bArrays.Location = new System.Drawing.Point(473, 372);
|
||||
this.bArrays.Name = "bArrays";
|
||||
this.bArrays.Size = new System.Drawing.Size(100, 23);
|
||||
this.bArrays.TabIndex = 5;
|
||||
this.bArrays.Text = "sfall arrays";
|
||||
this.bArrays.UseVisualStyleBackColor = true;
|
||||
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(473, 401);
|
||||
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;
|
||||
@@ -154,24 +144,11 @@
|
||||
this.bEdit.UseVisualStyleBackColor = true;
|
||||
this.bEdit.Click += new System.EventHandler(this.bEdit_Click);
|
||||
//
|
||||
// bCrittersLvar
|
||||
//
|
||||
this.bCrittersLvar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.bCrittersLvar.Enabled = false;
|
||||
this.bCrittersLvar.Location = new System.Drawing.Point(118, 401);
|
||||
this.bCrittersLvar.Name = "bCrittersLvar";
|
||||
this.bCrittersLvar.Size = new System.Drawing.Size(100, 23);
|
||||
this.bCrittersLvar.TabIndex = 7;
|
||||
this.bCrittersLvar.Text = "Local variables";
|
||||
this.bCrittersLvar.UseVisualStyleBackColor = true;
|
||||
this.bCrittersLvar.Click += new System.EventHandler(this.bCrittersLvar_Click);
|
||||
//
|
||||
// DebugEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(585, 436);
|
||||
this.Controls.Add(this.bCrittersLvar);
|
||||
this.ClientSize = new System.Drawing.Size(468, 297);
|
||||
this.Controls.Add(this.bEdit);
|
||||
this.Controls.Add(this.bArrays);
|
||||
this.Controls.Add(this.bSGlobals);
|
||||
@@ -179,10 +156,8 @@
|
||||
this.Controls.Add(this.bMapVars);
|
||||
this.Controls.Add(this.bGlobals);
|
||||
this.Controls.Add(this.dataGridView1);
|
||||
this.MinimumSize = new System.Drawing.Size(450, 300);
|
||||
this.Name = "DebugEditor";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "sfall Debug Editor";
|
||||
this.Text = "DebugEditor";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DebugEditor_FormClosing);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
@@ -197,12 +172,11 @@
|
||||
private System.Windows.Forms.Button bCritters;
|
||||
private System.Windows.Forms.Button bSGlobals;
|
||||
private System.Windows.Forms.Button bArrays;
|
||||
private System.Windows.Forms.Button bEdit;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column0;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
||||
private System.Windows.Forms.Button bCrittersLvar;
|
||||
private System.Windows.Forms.Button bEdit;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using File=System.IO.File;
|
||||
using StreamReader=System.IO.StreamReader;
|
||||
using MemoryStream=System.IO.MemoryStream;
|
||||
using BinaryReader=System.IO.BinaryReader;
|
||||
using BinaryWriter=System.IO.BinaryWriter;
|
||||
|
||||
namespace FalloutClient {
|
||||
public partial class DebugEditor : Form {
|
||||
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)]
|
||||
private struct ByteConverter {
|
||||
[System.Runtime.InteropServices.FieldOffset(0)]
|
||||
private int i;
|
||||
[System.Runtime.InteropServices.FieldOffset(0)]
|
||||
private float f;
|
||||
|
||||
public int GetAsInt(float f) {
|
||||
this.f=f;
|
||||
return i;
|
||||
}
|
||||
public float GetAsFloat(int i) {
|
||||
this.i=i;
|
||||
return f;
|
||||
}
|
||||
public byte[] GetAsBytes(ulong ul) {
|
||||
byte[] b=new byte[8];
|
||||
for(int i=0;i<8;i++) b[i]=(byte)((ul&((ulong)0xff<<(i*8)))>>(i*8));
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
private static ByteConverter converter=new ByteConverter();
|
||||
|
||||
private enum Mode { Globals, MapVars, SGlobals, Arrays, Critters }
|
||||
|
||||
private readonly EditorConnection connection;
|
||||
private Mode mode;
|
||||
|
||||
private readonly Dictionary<int, string> GlobNames=new Dictionary<int, string>();
|
||||
private readonly Dictionary<uint, string> CritNames=new Dictionary<uint, string>();
|
||||
|
||||
private void Redraw() {
|
||||
dataGridView1.SuspendLayout();
|
||||
dataGridView1.Rows.Clear();
|
||||
switch(mode) {
|
||||
case Mode.Globals:
|
||||
Column2.ReadOnly=false;
|
||||
Column3.ReadOnly=false;
|
||||
Column2.HeaderText="Value (Int)";
|
||||
Column3.HeaderText="Value (Float)";
|
||||
bEdit.Enabled=false;
|
||||
for(int i=0;i<connection.Globals.Length;i++) {
|
||||
string name=GlobNames.ContainsKey(i)?GlobNames[i]:"";
|
||||
dataGridView1.Rows.Add(i, name, connection.Globals[i], converter.GetAsFloat(connection.Globals[i]));
|
||||
}
|
||||
break;
|
||||
case Mode.MapVars:
|
||||
Column2.ReadOnly=false;
|
||||
Column3.ReadOnly=false;
|
||||
Column2.HeaderText="Value (Int)";
|
||||
Column3.HeaderText="Value (Float)";
|
||||
bEdit.Enabled=false;
|
||||
for(int i=0;i<connection.MapVars.Length;i++) {
|
||||
dataGridView1.Rows.Add(i, "", connection.MapVars[i], converter.GetAsFloat(connection.MapVars[i]));
|
||||
}
|
||||
break;
|
||||
case Mode.SGlobals:
|
||||
Column2.ReadOnly=false;
|
||||
Column3.ReadOnly=false;
|
||||
Column2.HeaderText="Value (Int)";
|
||||
Column3.HeaderText="Value (Float)";
|
||||
bEdit.Enabled=false;
|
||||
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"));
|
||||
dataGridView1.Rows.Add(s, "", connection.sGlobals[i], converter.GetAsFloat(connection.sGlobals[i]));
|
||||
}
|
||||
break;
|
||||
case Mode.Arrays:
|
||||
Column2.ReadOnly=true;
|
||||
Column3.ReadOnly=true;
|
||||
Column2.HeaderText="Array length";
|
||||
Column3.HeaderText="Element size";
|
||||
bEdit.Enabled=true;
|
||||
for(int i=0;i<connection.Arrays.Length;i++) {
|
||||
dataGridView1.Rows.Add(connection.Arrays[i], "", connection.ArrayLengths[i], connection.ArrayDataSizes[i]);
|
||||
}
|
||||
break;
|
||||
case Mode.Critters:
|
||||
Column2.ReadOnly=true;
|
||||
Column3.ReadOnly=true;
|
||||
Column2.HeaderText="pid";
|
||||
Column3.HeaderText="";
|
||||
bEdit.Enabled=true;
|
||||
for(int i=0;i<connection.Critters.Length;i++) {
|
||||
uint modcrit=(connection.Critters[i]&0xfffff);
|
||||
string name=CritNames.ContainsKey(modcrit)?CritNames[modcrit]:"";
|
||||
dataGridView1.Rows.Add(i+1, name, connection.Critters[i].ToString("x"), "");
|
||||
}
|
||||
break;
|
||||
}
|
||||
dataGridView1.ResumeLayout();
|
||||
}
|
||||
|
||||
internal DebugEditor(EditorConnection connection) {
|
||||
InitializeComponent();
|
||||
this.connection=connection;
|
||||
mode=Mode.Globals;
|
||||
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();
|
||||
}
|
||||
if(File.Exists("critters.txt")) {
|
||||
StreamReader sr=new StreamReader("critters.txt");
|
||||
while(!sr.EndOfStream) {
|
||||
string line=sr.ReadLine();
|
||||
CritNames[uint.Parse(line.Remove(line.IndexOf(' ')))]=line.Substring(line.IndexOf(' ')+1);
|
||||
}
|
||||
sr.Close();
|
||||
}
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void DebugEditor_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
connection.WriteDataType(DataTypeSend.Exit);
|
||||
connection.Close();
|
||||
}
|
||||
|
||||
private void bGlobals_Click(object sender, EventArgs e) {
|
||||
mode=Mode.Globals;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void bMapVars_Click(object sender, EventArgs e) {
|
||||
mode=Mode.MapVars;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void bSGlobals_Click(object sender, EventArgs e) {
|
||||
mode=Mode.SGlobals;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void bArrays_Click(object sender, EventArgs e) {
|
||||
mode=Mode.Arrays;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void bCritters_Click(object sender, EventArgs e) {
|
||||
mode=Mode.Critters;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
|
||||
int[] array=null;
|
||||
DataTypeSend dts;
|
||||
switch(mode) {
|
||||
case Mode.Globals:
|
||||
array=connection.Globals;
|
||||
dts=DataTypeSend.SetGlobal;
|
||||
break;
|
||||
case Mode.MapVars:
|
||||
array=connection.MapVars;
|
||||
dts=DataTypeSend.SetMapVar;
|
||||
break;
|
||||
case Mode.SGlobals:
|
||||
array=connection.sGlobals;
|
||||
dts=DataTypeSend.SetSGlobal;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if(e.ColumnIndex==2) {
|
||||
int 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];
|
||||
} else {
|
||||
array[e.RowIndex]=val;
|
||||
connection.WriteDataType(dts);
|
||||
connection.WriteInt(e.RowIndex);
|
||||
connection.WriteInt(val);
|
||||
}
|
||||
} else {
|
||||
float 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];
|
||||
} else {
|
||||
array[e.RowIndex]=converter.GetAsInt(val);
|
||||
connection.WriteDataType(dts);
|
||||
connection.WriteInt(e.RowIndex);
|
||||
connection.WriteInt(converter.GetAsInt(val));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void bEdit_Click(object sender, EventArgs e) {
|
||||
if(dataGridView1.SelectedRows.Count!=1) return;
|
||||
int i=dataGridView1.SelectedRows[0].Index;
|
||||
switch(mode) {
|
||||
case Mode.Arrays: {
|
||||
DataType[] types=new DataType[connection.ArrayLengths[i]];
|
||||
string[] strings=new string[connection.ArrayLengths[i]];
|
||||
connection.WriteDataType(DataTypeSend.GetArray);
|
||||
connection.WriteInt(i);
|
||||
for(int j=0;j<strings.Length;j++) types[j]=(DataType)connection.ReadInt();
|
||||
byte[] buf=connection.ReadBytes(connection.ArrayLengths[i]*connection.ArrayDataSizes[i]);
|
||||
MemoryStream ms=new MemoryStream(buf);
|
||||
BinaryReader br=new BinaryReader(ms);
|
||||
for(int j=0;j<strings.Length;j++) {
|
||||
ms.Position=j*connection.ArrayDataSizes[i];
|
||||
switch(types[j]) {
|
||||
case DataType.Int:
|
||||
strings[j]=br.ReadInt32().ToString();
|
||||
break;
|
||||
case DataType.Float:
|
||||
strings[j]=br.ReadSingle().ToString();
|
||||
break;
|
||||
case DataType.String:
|
||||
byte[] bytes=br.ReadBytes(connection.ArrayDataSizes[i]);
|
||||
strings[j]=System.Text.Encoding.ASCII.GetString(bytes, 0, Array.IndexOf<byte>(bytes, 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
br.Close();
|
||||
strings=EditorWindow.ShowEditor(null, types, strings);
|
||||
if(strings!=null) {
|
||||
connection.WriteDataType(DataTypeSend.SetArray);
|
||||
connection.WriteInt(i);
|
||||
ms=new MemoryStream(connection.ArrayLengths[i]*connection.ArrayDataSizes[i]);
|
||||
BinaryWriter bw=new BinaryWriter(ms);
|
||||
for(int j=0;j<strings.Length;j++) {
|
||||
ms.Position=j*connection.ArrayDataSizes[i];
|
||||
switch(types[j]) {
|
||||
case DataType.Int:
|
||||
bw.Write(int.Parse(strings[j]));
|
||||
break;
|
||||
case DataType.Float:
|
||||
bw.Write(float.Parse(strings[j]));
|
||||
break;
|
||||
case DataType.String:
|
||||
byte[] bytes=System.Text.Encoding.ASCII.GetBytes(strings[j]);
|
||||
if(bytes.Length<connection.ArrayDataSizes[i]) bw.Write(bytes);
|
||||
else bw.Write(bytes, 0, connection.ArrayDataSizes[i]-1);
|
||||
bw.Write(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
connection.WriteBytes(ms.GetBuffer(), 0, connection.ArrayLengths[i]*connection.ArrayDataSizes[i]);
|
||||
bw.Close();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Mode.Critters: {
|
||||
DataType[] types=new DataType[29];
|
||||
string[] strings=new string[29];
|
||||
string[] names=new string[29];
|
||||
connection.WriteDataType(DataTypeSend.RetrieveCritter);
|
||||
connection.WriteInt(i);
|
||||
BinaryReader br=new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(29*4)));
|
||||
for(int j=0;j<29;j++) {
|
||||
types[j]=DataType.Int;
|
||||
strings[j]=br.ReadInt32().ToString();
|
||||
names[j]="0x"+(j*4).ToString("x");
|
||||
}
|
||||
br.Close();
|
||||
names[1]="Tile";
|
||||
names[10]="Elevation";
|
||||
names[11]="Inventory count";
|
||||
names[13]="Inventory pointer";
|
||||
names[16]="Current AP";
|
||||
names[17]="Crippled limbs";
|
||||
names[22]="HP";
|
||||
names[23]="Rads";
|
||||
names[24]="Poison";
|
||||
names[25]="Proto ID";
|
||||
strings=EditorWindow.ShowEditor(names, types, strings);
|
||||
if(strings!=null) {
|
||||
MemoryStream ms=new MemoryStream(29*4);
|
||||
BinaryWriter bw=new BinaryWriter(ms);
|
||||
for(int j=0;j<29;j++) bw.Write(int.Parse(strings[j]));
|
||||
connection.WriteDataType(DataTypeSend.SetCritter);
|
||||
connection.WriteInt(i);
|
||||
connection.WriteBytes(ms.GetBuffer(), 0, 29*4);
|
||||
bw.Close();
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,7 @@ using System.Net.Sockets;
|
||||
using System.IO;
|
||||
|
||||
namespace FalloutClient {
|
||||
|
||||
class EditorConnection
|
||||
{
|
||||
class EditorConnection {
|
||||
private TcpClient client;
|
||||
private NetworkStream stream;
|
||||
private BinaryReader br;
|
||||
@@ -13,81 +11,73 @@ namespace FalloutClient {
|
||||
|
||||
public readonly int[] Globals;
|
||||
public readonly int[] MapVars;
|
||||
public readonly uint[,] Critters;
|
||||
public readonly uint[] Critters;
|
||||
public readonly ulong[] SGlobalKeys;
|
||||
public readonly int[] sGlobals;
|
||||
public readonly uint[] Arrays;
|
||||
public readonly int[] ArrayLengths;
|
||||
public readonly int[] ArrayFlag;
|
||||
public readonly bool[] ArrayIsMap;
|
||||
public readonly int[] ArrayDataSizes;
|
||||
|
||||
public EditorConnection() {
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
client = new TcpClient("127.0.0.1", 4245);
|
||||
stream = client.GetStream();
|
||||
br = new BinaryReader(stream);
|
||||
bw = new BinaryWriter(stream);
|
||||
Globals = new int[br.ReadInt32()];
|
||||
MapVars = new int[br.ReadInt32()];
|
||||
SGlobalKeys = new ulong[br.ReadInt32()];
|
||||
sGlobals = new int[SGlobalKeys.Length];
|
||||
Arrays = new uint[br.ReadInt32()];
|
||||
ArrayLengths = new int[Arrays.Length];
|
||||
ArrayFlag = new int[Arrays.Length];
|
||||
ArrayIsMap = new bool[Arrays.Length];
|
||||
Critters = new uint[br.ReadInt32(), 2];
|
||||
client=new TcpClient("127.0.0.1", 4245);
|
||||
stream=client.GetStream();
|
||||
br=new BinaryReader(stream);
|
||||
bw=new BinaryWriter(stream);
|
||||
Globals=new int[br.ReadInt32()];
|
||||
MapVars=new int[br.ReadInt32()];
|
||||
SGlobalKeys=new ulong[br.ReadInt32()];
|
||||
sGlobals=new int[SGlobalKeys.Length];
|
||||
Arrays=new uint[br.ReadInt32()];
|
||||
ArrayLengths=new int[Arrays.Length];
|
||||
ArrayDataSizes=new int[Arrays.Length];
|
||||
Critters=new uint[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 < sGlobals.Length; i++) {
|
||||
SGlobalKeys[i] = br.ReadUInt64();
|
||||
sGlobals[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<sGlobals.Length;i++) {
|
||||
SGlobalKeys[i]=br.ReadUInt64();
|
||||
sGlobals[i]=br.ReadInt32();
|
||||
br.ReadInt32();
|
||||
}
|
||||
for (int i = 0; i < Arrays.Length; i++) {
|
||||
Arrays[i] = br.ReadUInt32();
|
||||
ArrayIsMap[i] = (br.ReadInt32() != 0);
|
||||
ArrayLengths[i] = br.ReadInt32();
|
||||
ArrayFlag[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<Arrays.Length;i++) {
|
||||
Arrays[i]=br.ReadUInt32();
|
||||
ArrayLengths[i]=br.ReadInt32();
|
||||
ArrayDataSizes[i]=br.ReadInt32();
|
||||
}
|
||||
for(int i=0;i<Critters.Length;i++) Critters[i]=br.ReadUInt32();
|
||||
}
|
||||
|
||||
public void Close() {
|
||||
stream.Close();
|
||||
client.Close();
|
||||
stream = null;
|
||||
client = null;
|
||||
stream=null;
|
||||
client=null;
|
||||
}
|
||||
|
||||
public void WriteDataType(DataTypeSend type) {
|
||||
stream.WriteByte((byte)type);
|
||||
//bw.Write((byte)type);
|
||||
}
|
||||
|
||||
public void WriteByte(byte b) { bw.Write(b); }
|
||||
public void WriteInt16(short 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, int start, int len) {
|
||||
bw.Write(buf, start, len);
|
||||
}
|
||||
|
||||
public void Read(byte[] buffer) {
|
||||
int upto = 0;
|
||||
while (upto < buffer.Length) {
|
||||
upto += stream.Read(buffer, upto, buffer.Length - upto);
|
||||
int upto=0;
|
||||
while(upto<buffer.Length) {
|
||||
upto+=stream.Read(buffer, upto, buffer.Length-upto);
|
||||
}
|
||||
}
|
||||
public void Read(byte[] buffer, int offset, int length) {
|
||||
int upto = 0;
|
||||
int upto=0;
|
||||
//System.Diagnostics.Debug.WriteLine("Read - offset: "+offset+" length: "+length);
|
||||
while (upto < length) {
|
||||
upto += stream.Read(buffer, offset + upto, length - upto);
|
||||
while(upto<length) {
|
||||
upto+=stream.Read(buffer, offset+upto, length-upto);
|
||||
}
|
||||
}
|
||||
public int ReadByte() {
|
||||
+11
-41
@@ -29,14 +29,13 @@
|
||||
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.checkBox = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// bSave
|
||||
//
|
||||
this.bSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.bSave.Location = new System.Drawing.Point(12, 336);
|
||||
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.Name = "bSave";
|
||||
this.bSave.Size = new System.Drawing.Size(75, 23);
|
||||
this.bSave.TabIndex = 0;
|
||||
@@ -47,7 +46,7 @@
|
||||
// bCancel
|
||||
//
|
||||
this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.bCancel.Location = new System.Drawing.Point(371, 336);
|
||||
this.bCancel.Location = new System.Drawing.Point(200, 265);
|
||||
this.bCancel.Name = "bCancel";
|
||||
this.bCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.bCancel.TabIndex = 1;
|
||||
@@ -59,77 +58,49 @@
|
||||
//
|
||||
this.dataGridView1.AllowUserToAddRows = 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)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dataGridView1.ColumnHeadersHeight = 22;
|
||||
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.Right)));
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Column1,
|
||||
this.Column2,
|
||||
this.Column3});
|
||||
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
|
||||
this.dataGridView1.MultiSelect = false;
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.RowHeadersVisible = false;
|
||||
this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
|
||||
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(434, 318);
|
||||
this.dataGridView1.Size = new System.Drawing.Size(344, 247);
|
||||
this.dataGridView1.TabIndex = 2;
|
||||
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
|
||||
//
|
||||
// Column1
|
||||
//
|
||||
this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Column1.HeaderText = "Element";
|
||||
this.Column1.HeaderText = "Name";
|
||||
this.Column1.Name = "Column1";
|
||||
this.Column1.ReadOnly = true;
|
||||
this.Column1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column2
|
||||
//
|
||||
this.Column2.HeaderText = "Type";
|
||||
this.Column2.Name = "Column2";
|
||||
this.Column2.ReadOnly = true;
|
||||
this.Column2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.Column2.Width = 75;
|
||||
//
|
||||
// Column3
|
||||
//
|
||||
this.Column3.HeaderText = "Value";
|
||||
this.Column3.Name = "Column3";
|
||||
this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.Column3.Width = 150;
|
||||
//
|
||||
// checkBox
|
||||
//
|
||||
this.checkBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.checkBox.AutoSize = true;
|
||||
this.checkBox.Location = new System.Drawing.Point(103, 341);
|
||||
this.checkBox.Name = "checkBox";
|
||||
this.checkBox.Size = new System.Drawing.Size(91, 17);
|
||||
this.checkBox.TabIndex = 3;
|
||||
this.checkBox.Text = "Values in Hex";
|
||||
this.checkBox.UseVisualStyleBackColor = true;
|
||||
this.checkBox.Click += new System.EventHandler(this.checkBox_Click);
|
||||
//
|
||||
// EditorWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(458, 371);
|
||||
this.Controls.Add(this.checkBox);
|
||||
this.ClientSize = new System.Drawing.Size(368, 300);
|
||||
this.Controls.Add(this.dataGridView1);
|
||||
this.Controls.Add(this.bCancel);
|
||||
this.Controls.Add(this.bSave);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
|
||||
this.MinimumSize = new System.Drawing.Size(300, 200);
|
||||
this.Name = "EditorWindow";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Edit Values";
|
||||
this.Text = "EditorWindow";
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -141,6 +112,5 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
||||
private System.Windows.Forms.CheckBox checkBox;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FalloutClient {
|
||||
public enum DataType : int { None=0, Int=1, Float=2, String=3 }
|
||||
public partial class EditorWindow : Form {
|
||||
private readonly DataType[] types;
|
||||
private readonly string[] values;
|
||||
private bool save;
|
||||
|
||||
private EditorWindow(string[] names, DataType[] types, string[] values) {
|
||||
this.types=types;
|
||||
this.values=values;
|
||||
InitializeComponent();
|
||||
dataGridView1.SuspendLayout();
|
||||
if(names==null) 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(names[i], types[i].ToString(), values[i]);
|
||||
dataGridView1.ResumeLayout();
|
||||
}
|
||||
|
||||
public static string[] ShowEditor(string[] names, DataType[] types, string[] values) {
|
||||
EditorWindow editor=new EditorWindow(names, types, values);
|
||||
editor.ShowDialog();
|
||||
if(editor.save) return editor.values;
|
||||
else return null;
|
||||
}
|
||||
|
||||
private bool CheckInput(DataType type, string str) {
|
||||
switch(type) {
|
||||
case DataType.Int:
|
||||
int i;
|
||||
return int.TryParse(str, out i);
|
||||
case DataType.Float:
|
||||
float f;
|
||||
return float.TryParse(str, out f);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
|
||||
string str=(string)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
if(CheckInput(types[e.RowIndex], str)) values[e.RowIndex]=str;
|
||||
else dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value=values[e.RowIndex];
|
||||
}
|
||||
|
||||
private void bCancel_Click(object sender, EventArgs e) {
|
||||
Close();
|
||||
}
|
||||
|
||||
private void bSave_Click(object sender, EventArgs e) {
|
||||
save=true;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,28 +9,13 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FalloutClient</RootNamespace>
|
||||
<AssemblyName>FalloutDebug</AssemblyName>
|
||||
<AssemblyName>FalloutClient</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<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>false</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -42,14 +27,12 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@@ -79,18 +62,6 @@
|
||||
<DependentUpon>EditorWindow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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.
|
||||
@@ -100,7 +71,6 @@
|
||||
</Target>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>copy "$(TargetPath)" "C:\Games\Fallout2\$(TargetName)$(TargetExt)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,6 +1,6 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SfallDebugEditor", "SfallDebugEditor.csproj", "{80ED0DCE-100E-4EC9-A79D-2FBFA4CAD1E3}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPClient", "MPClient.csproj", "{80ED0DCE-100E-4EC9-A79D-2FBFA4CAD1E3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace FalloutClient {
|
||||
static class Program {
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main(string[] args) {
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
if(args.Length==1&&args[0]=="-debugedit") {
|
||||
Application.Run(new DebugEditor(new EditorConnection()));
|
||||
} else {
|
||||
throw new Exception("Multiplayer is no longer supported");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum DataTypeSend {
|
||||
Mouse=0, LMouseDown=1, LMouseUp=2, RMouseDown=3, RMouseUp=4, TakeChar=5, ReleaseChar=6,
|
||||
SetGlobal=0, SetMapVar=1, 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
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("sfall Debug Editor")]
|
||||
[assembly: AssemblyTitle("FalloutClient")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("sfall")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyProduct("FalloutClient")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("4.1.9.0")]
|
||||
[assembly: AssemblyFileVersion("4.1.9.0")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,9 +1,8 @@
|
||||
# sfall
|
||||
[](https://github.com/phobos2077/sfall/actions/workflows/gh-pages.yml)
|
||||
|
||||
A set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
|
||||
A set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
|
||||
|
||||
**Engine modifications include:**
|
||||
Engine modifications include:
|
||||
- Better support for modern operating systems
|
||||
- Externalizing many settings like starting map and game time, skills, perks, critical hit tables, books, etc.
|
||||
- Bug fixes
|
||||
@@ -11,7 +10,7 @@ A set of engine modifications for the classic game Fallout 2 in form of a DLL, w
|
||||
- Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions)
|
||||
|
||||
|
||||
Original author: timeslip
|
||||
Original author: timeslip
|
||||
|
||||
Original description: A set of engine modifications for the classic game Fallout 2 by Interplay. Includes fixes for bugs in the original engine, allows fallout to run correctly on modern operating systems, and adds additional features for modders.
|
||||
Original description: A set of engine modifications for the classic game Fallout 2 by Interplay. Includes fixes for bugs in the original engine, allows fallout to run correctly on modern operating systems, and adds additional features for modders.
|
||||
|
||||
|
||||
-138
@@ -1,138 +0,0 @@
|
||||
name: 'sfall'
|
||||
description: 'Builds sfall binaries'
|
||||
author: '@wipe2238'
|
||||
|
||||
###
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# - name: Build sfall
|
||||
# id: sfall
|
||||
# uses: phobos2077/sfall@develop
|
||||
# with:
|
||||
# release-xp: true
|
||||
#
|
||||
# - name: Copy sfall to mod directory
|
||||
# run: copy "${{ steps.sfall.outputs.release-xp }}" "my/mod/directory/ddraw.dll"
|
||||
#
|
||||
###
|
||||
|
||||
# While both inputs are marked as required, users needs to set only one of them (at minimum) to 'true' for action to work
|
||||
inputs:
|
||||
|
||||
release-xp:
|
||||
description: 'Set to true to enable building with ReleaseXP configuration'
|
||||
required: true
|
||||
|
||||
dev-xp:
|
||||
description: 'Set to true to enable building with DevXP configuration'
|
||||
required: true
|
||||
|
||||
# Outputs are always using Windows directory separator (`\`)
|
||||
outputs:
|
||||
|
||||
release-xp:
|
||||
description: 'Full path to ddraw.dll built with ReleaseXP configuration'
|
||||
value: ${{ steps.build-release-xp.outputs.ddraw-dll }}
|
||||
|
||||
dev-xp:
|
||||
description: 'Full path to ddraw.dll built with DevXP configuration'
|
||||
value: ${{ steps.build-dev-xp.outputs.ddraw-dll }}
|
||||
dev-xp-pdb:
|
||||
description: 'Full path to ddraw.pdb built with DevXP configuration'
|
||||
value: ${{ steps.build-dev-xp.outputs.ddraw-pdb }}
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
|
||||
# Quick check for things which should never happen
|
||||
- name: Sanity checks
|
||||
run: |
|
||||
if [[ "${{ runner.os }}" != "Windows" ]]; then
|
||||
echo "[ERROR] This action can only be used on Windows"
|
||||
exit 1
|
||||
elif [[ "${{ inputs.release-xp }}" != "true" ]] && [[ "${{ inputs.dev-xp }}" != "true" ]]; then
|
||||
echo "[ERROR] At least one of following inputs must be set to 'true' -- 'release-xp', 'dev-xp'"
|
||||
exit 1
|
||||
#
|
||||
elif [[ ! -d "$(cygpath --unix "$GITHUB_ACTION_PATH/sfall/")" ]]; then
|
||||
echo "[ERROR] Solution directory not found -- 'sfall\\'"
|
||||
exit 1
|
||||
elif [[ ! -f "$(cygpath --unix "$GITHUB_ACTION_PATH/sfall/ddraw.sln")" ]]; then
|
||||
echo "[ERROR] Solution file not found -- 'sfall\\ddraw.sln'"
|
||||
exit 1
|
||||
fi
|
||||
#
|
||||
shell: bash
|
||||
|
||||
# DXSDK directory must be prepared only once, in case action is used N times
|
||||
# Using `.lib` suffix to make sure directory is ignored by git in exotic scenarios
|
||||
# Using `::set-output` to make sure workflow environment remains unchanged
|
||||
- name: Prepare DXSDK directory
|
||||
id: dxsdk
|
||||
run: |
|
||||
DXSDK_DIR="$GITHUB_ACTION_PATH/sfall/DXSDK.lib"
|
||||
if [[ ! -d "$DXSDK_DIR" ]]; then
|
||||
echo "::group::Prepare DXSDK directory"
|
||||
#
|
||||
git clone --quiet https://github.com/NovaRain/DXSDK_Collection.git "$DXSDK_DIR"
|
||||
cp "$DXSDK_DIR/DXSDK_Aug2007/Lib/x86/dinput.lib" "$DXSDK_DIR/DXSDK_Jun2010/Lib/x86/"
|
||||
#
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
echo "::set-output name=dir::$(cygpath --windows "$DXSDK_DIR/DXSDK_Jun2010/")"
|
||||
shell: bash
|
||||
|
||||
# MSBuild is not in PATH on Windows machines
|
||||
# Using `::set-output` to make sure workflow environment remains unchanged
|
||||
- name: Prepare MSBuild
|
||||
id: msbuild
|
||||
run: |
|
||||
echo "::group::Prepare MSBuild"
|
||||
|
||||
MSBUILD_EXE="$("/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild/**/Bin/MSBuild.exe)"
|
||||
echo "::set-output name=exe::$MSBUILD_EXE"
|
||||
|
||||
echo "::endgroup::"
|
||||
shell: bash
|
||||
|
||||
# Creating empty `PostBuild.cmd` to avoid false-positive build error
|
||||
- name: Build ReleaseXP
|
||||
id: build-release-xp
|
||||
run: |
|
||||
if [[ "${{ inputs.release-xp }}" == "true" ]]; then
|
||||
echo ::group::Build ReleaseXP
|
||||
|
||||
#
|
||||
echo "@echo off" > "$GITHUB_ACTION_PATH/sfall/PostBuild.cmd"
|
||||
"${{ steps.msbuild.outputs.exe }}" "$GITHUB_ACTION_PATH/sfall/ddraw.sln" -p:Configuration=ReleaseXP -p:Platform=Win32 -p:PlatformToolset=v140_xp
|
||||
#
|
||||
echo "::set-output name=ddraw-dll::$(cygpath --windows "$GITHUB_ACTION_PATH/sfall/ReleaseXP/ddraw.dll")"
|
||||
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
env:
|
||||
DXSDK_DIR: ${{ steps.dxsdk.outputs.dir }}
|
||||
shell: bash
|
||||
|
||||
# Creating empty `PostBuild.cmd` to avoid false-positive build error
|
||||
- name: Build DevXP
|
||||
id: build-dev-xp
|
||||
run: |
|
||||
:
|
||||
if [[ "${{ inputs.dev-xp }}" == "true" ]]; then
|
||||
echo "::group::Build DevXP"
|
||||
|
||||
#
|
||||
echo "@echo off" > "$GITHUB_ACTION_PATH/sfall/PostBuild.cmd"
|
||||
"${{ steps.msbuild.outputs.exe }}" "$GITHUB_ACTION_PATH/sfall/ddraw.sln" -p:Configuration=DevXP -p:Platform=Win32 -p:PlatformToolset=v140_xp
|
||||
#
|
||||
echo "::set-output name=ddraw-dll::$(cygpath --windows "$GITHUB_ACTION_PATH/sfall/DevXP/ddraw.dll")"
|
||||
echo "::set-output name=ddraw-pdb::$(cygpath --windows "$GITHUB_ACTION_PATH/sfall/DevXP/ddraw.pdb")"
|
||||
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
env:
|
||||
DXSDK_DIR: ${{ steps.dxsdk.outputs.dir }}
|
||||
shell: bash
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user