XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SeaOfRadiationEditor

【WinForm】SeaOfRadiationEditor游戏修改器

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/SeaOfRadiationEditor

修复部分bug

9fd64a5
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

5 个文件 +81 -75
Modified SeaOfRadiationEditor.sln +6 -13
@@ -4,11 +4,17 @@ VisualStudioVersion = 17.10.34814.14
4 4 MinimumVisualStudioVersion = 10.0.40219.1
5 5 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SeaOfRadiationEditor", "SeaOfRadiationEditor\SeaOfRadiationEditor.csproj", "{49E255F9-BBA4-40F1-BAEE-8895377CFD02}"
6 6 EndProject
7 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XFEExtension.NetCore.MemoryEditor", "..\XFEExtension.NetCore.MemoryEditor\XFEExtension.NetCore.MemoryEditor\XFEExtension.NetCore.MemoryEditor.csproj", "{377109F0-EF73-4849-8539-A0E9B8FA19DA}"
8 EndProject
7 9 Global
8 10 GlobalSection(ExtensibilityGlobals) = postSolution
9 11 SolutionGuid = {323E9E46-3ADA-4FC5-8CD2-95C40584C8CD}
10 12 EndGlobalSection
11 13 GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 {377109F0-EF73-4849-8539-A0E9B8FA19DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 {377109F0-EF73-4849-8539-A0E9B8FA19DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 {377109F0-EF73-4849-8539-A0E9B8FA19DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 {377109F0-EF73-4849-8539-A0E9B8FA19DA}.Release|Any CPU.Build.0 = Release|Any CPU
12 18 {49E255F9-BBA4-40F1-BAEE-8895377CFD02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 19 {49E255F9-BBA4-40F1-BAEE-8895377CFD02}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 20 {49E255F9-BBA4-40F1-BAEE-8895377CFD02}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -22,16 +28,3 @@ Global
22 28 HideSolutionNode = FALSE
23 29 EndGlobalSection
24 30 EndGlobal
25 C-B6F7-7518F9082DD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 {5AADED35-3C2B-432C-B6F7-7518F9082DD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 {5AADED35-3C2B-432C-B6F7-7518F9082DD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 {5AADED35-3C2B-432C-B6F7-7518F9082DD4}.Release|Any CPU.Build.0 = Release|Any CPU
29 EndGlobalSection
30 GlobalSection(SolutionConfigurationPlatforms) = preSolution
31 Debug|Any CPU = Debug|Any CPU
32 Release|Any CPU = Release|Any CPU
33 EndGlobalSection
34 GlobalSection(SolutionProperties) = preSolution
35 HideSolutionNode = FALSE
36 EndGlobalSection
37 EndGlobal
Modified SeaOfRadiationEditor/MainForm.cs +58 -23
@@ -19,21 +19,21 @@ public partial class MainForm : Form
19 19 switch (e.CustomName)
20 20 {
21 21 case "Reset":
22 if (e.CurrentValueGetSuccessful && SystemProfile.ResetFuncStart)
22 if (e.CurrentValueGetSuccessful && checkBox1.Checked)
23 23 {
24 24 if (!sender.Write(int.Parse(textBox1.Text)))
25 25 Trace.WriteLine($"Resetд��ʧ��");
26 26 }
27 27 break;
28 28 case "TimeCounter":
29 if (e.CurrentValueGetSuccessful && SystemProfile.TimeCounterFuncStart)
29 if (e.CurrentValueGetSuccessful && checkBox2.Checked)
30 30 {
31 31 if (!sender.Write(float.Parse(textBox2.Text)))
32 32 Trace.WriteLine("TimeCounterд��ʧ��");
33 33 }
34 34 break;
35 35 case "Stamina":
36 if (e.CurrentValueGetSuccessful && SystemProfile.StaminaFuncStart)
36 if (e.CurrentValueGetSuccessful && checkBox3.Checked)
37 37 {
38 38 if (!sender.Write(float.Parse(textBox3.Text)))
39 39 Trace.WriteLine("Staminaд��ʧ��");
@@ -44,69 +44,104 @@ public partial class MainForm : Form
44 44 }
45 45 }
46 46
47 private void CheckBox1_CheckedChanged(object sender, EventArgs e)
47 private async void CheckBox1_CheckedChanged(object sender, EventArgs e)
48 48 {
49 49 if (sender is CheckBox checkBox)
50 50 {
51 51 if (checkBox.Checked)
52 52 {
53 if (CheckGameStart(checkBox))
53 if (CheckGameStart())
54 54 {
55 SystemProfile.ResetFuncStart = true;
56 Program.Manager["Reset"].Write(int.Parse(textBox1.Text));
55 try
56 {
57 textBox1.Enabled = false;
58 Program.Manager["Reset"].Write(int.Parse(textBox1.Text));
59 await Program.Manager["Stamina"].StartListen();
60 }
61 catch (Exception ex)
62 {
63 Trace.WriteLine(ex.ToString());
64 }
65 }
66 else
67 {
68 checkBox1.Checked = false;
57 69 }
58 70 }
59 71 else
60 72 {
61 SystemProfile.ResetFuncStart = false;
73 textBox1.Enabled = true;
62 74 }
63 75 }
64 76 }
65 77
66 private void CheckBox2_CheckedChanged(object sender, EventArgs e)
78 private async void CheckBox2_CheckedChanged(object sender, EventArgs e)
67 79 {
68 80 if (sender is CheckBox checkBox)
69 81 {
70 82 if (checkBox.Checked)
71 83 {
72 if (CheckGameStart(checkBox))
84 if (CheckGameStart())
85 {
86 try
87 {
88 textBox2.Enabled = false;
89 Program.Manager["TimeCounter"].Write(float.Parse(textBox2.Text));
90 await Program.Manager["Stamina"].StartListen();
91 }
92 catch (Exception ex)
93 {
94 Trace.WriteLine(ex.ToString());
95 }
96 }
97 else
73 98 {
74 SystemProfile.TimeCounterFuncStart = true;
75 Program.Manager["TimeCounter"].Write(float.Parse(textBox2.Text));
99 checkBox2.Checked = false;
76 100 }
77 101 }
78 102 else
79 103 {
80 SystemProfile.TimeCounterFuncStart = false;
104 textBox2.Enabled = true;
81 105 }
82 106 }
83 107 }
84 108
85 private void CheckBox3_CheckedChanged(object sender, EventArgs e)
109 private async void CheckBox3_CheckedChanged(object sender, EventArgs e)
86 110 {
87 111 if (sender is CheckBox checkBox)
88 112 {
89 113 if (checkBox.Checked)
90 114 {
91 if (CheckGameStart(checkBox))
115 if (CheckGameStart())
116 {
117 try
118 {
119 textBox3.Enabled = false;
120 Program.Manager["Stamina"].Write(float.Parse(textBox3.Text));
121 await Program.Manager["Stamina"].StartListen();
122 }
123 catch (Exception ex)
124 {
125 Trace.WriteLine(ex.ToString());
126 }
127 }
128 else
92 129 {
93 SystemProfile.StaminaFuncStart = true;
94 Program.Manager["Stamina"].Write(float.Parse(textBox3.Text));
130 checkBox3.Checked = false;
95 131 }
96 132 }
97 133 else
98 134 {
99 SystemProfile.StaminaFuncStart = false;
135 textBox3.Enabled = true;
100 136 }
101 137 }
102 138 }
103 139
104 private static bool CheckGameStart(CheckBox checkBox)
140 private static bool CheckGameStart()
105 141 {
106 142 if (!SystemProfile.IsGameRunning)
107 143 {
108 144 MessageBox.Show("��������Ϸ");
109 RemoveAllCheck();
110 145 return false;
111 146 }
112 147 return true;
@@ -114,8 +149,8 @@ public partial class MainForm : Form
114 149
115 150 public static void RemoveAllCheck()
116 151 {
117 SystemProfile.ResetFuncStart = false;
118 SystemProfile.TimeCounterFuncStart = false;
119 SystemProfile.StaminaFuncStart = false;
152 Current?.Invoke(() => Current.checkBox1.Checked = false);
153 Current?.Invoke(() => Current.checkBox2.Checked = false);
154 Current?.Invoke(() => Current.checkBox3.Checked = false);
120 155 }
121 156 }
Modified SeaOfRadiationEditor/Program.cs +12 -9
@@ -6,17 +6,16 @@ internal static class Program
6 6 {
7 7 public static DynamicMemoryManager Manager { get; } = MemoryManager.CreateBuilder()
8 8 .WithAutoReacquireProcess("Sea_of_Radiation_Prologue")
9 .WithFindProcessWhenCreate()
10 9 .BuildDynamicManager(
11 10 MemoryItemBuilder.Create<int>("Reset")
12 11 .WithResolvePointer("mono-2.0-bdwgc.dll", 0x0072A200, 0x14A0, 0x0, 0x80, 0xE4, 0x0, 0x1EC)
13 .WithListener(),
12 .WithListener(10),
14 13 MemoryItemBuilder.Create<float>("TimeCounter")
15 14 .WithResolvePointer("mono-2.0-bdwgc.dll", 0x0072A200, 0x12E8, 0x0, 0x80, 0xE4, 0x0, 0x1E0)
16 .WithListener(),
15 .WithListener(10),
17 16 MemoryItemBuilder.Create<float>("Stamina")
18 17 .WithResolvePointer("mono-2.0-bdwgc.dll", 0x0072A200, 0x14E0, 0x48, 0x10, 0x20, 0x50, 0x20, 0x1B0)
19 .WithListener());
18 .WithListener(10));
20 19 /// <summary>
21 20 /// The main entry point for the application.
22 21 /// </summary>
@@ -29,11 +28,15 @@ internal static class Program
29 28 var mainForm = new MainForm();
30 29 Manager.CurrentProcessEntered += Manager_CurrentProcessEntered;
31 30 Manager.CurrentProcessExit += Manager_CurrentProcessExit;
32 if (Manager.CurrentProcess is not null && !Manager.CurrentProcess.HasExited)
33 SystemProfile.IsGameRunning = true;
34 else
35 SystemProfile.IsGameRunning = false;
36 Application.Run(mainForm);
31 Task.Run(async () => await Manager.WaitProcessEnter());
32 try
33 {
34 Application.Run(mainForm);
35 }
36 catch (Exception ex)
37 {
38 MessageBox.Show(ex.ToString());
39 }
37 40 }
38 41 private static void Manager_CurrentProcessExit(object? sender, EventArgs e) => SystemProfile.IsGameRunning = false;
39 42 private static void Manager_CurrentProcessEntered(object? sender, EventArgs e) => SystemProfile.IsGameRunning = true;
Modified SeaOfRadiationEditor/SeaOfRadiationEditor.csproj +1 -1
@@ -9,7 +9,7 @@
9 9 </PropertyGroup>
10 10
11 11 <ItemGroup>
12 <PackageReference Include="XFEExtension.NetCore.MemoryEditor" Version="2.0.2" />
12 <ProjectReference Include="..\..\XFEExtension.NetCore.MemoryEditor\XFEExtension.NetCore.MemoryEditor\XFEExtension.NetCore.MemoryEditor.csproj" />
13 13 </ItemGroup>
14 14
15 15 <ItemGroup>
Modified SeaOfRadiationEditor/SystemProfile.cs +4 -29
@@ -2,7 +2,7 @@
2 2
3 3 namespace SeaOfRadiationEditor;
4 4
5 public static partial class SystemProfile
5 public static class SystemProfile
6 6 {
7 7 private static bool isGameRunning;
8 8
@@ -18,42 +18,17 @@ public static partial class SystemProfile
18 18 {
19 19 MainForm.Current?.Invoke(() => MainForm.Current.Text = "辐射之海:序章 3项修改器[游戏进行中]");
20 20 }
21 catch
22 {
23 MainForm.Current!.Text = "辐射之海:序章 3项修改器[游戏进行中]";
24 }
21 catch { }
25 22 }
26 23 else
27 24 {
28 25 try
29 26 {
30 27 MainForm.Current?.Invoke(() => MainForm.Current.Text = "辐射之海:序章 3项修改器[未启动游戏]");
28 MainForm.RemoveAllCheck();
31 29 }
32 catch
33 {
34 MainForm.Current!.Text = "辐射之海:序章 3项修改器[未启动游戏]";
35 }
36 MainForm.RemoveAllCheck();
30 catch { }
37 31 }
38 32 }
39 33 }
40
41 [ProfileProperty]
42 [ProfilePropertyAddSet(@"try{ MainForm.Current?.Invoke(() => MainForm.Current.checkBox1.Checked = value); } catch {}")]
43 [ProfilePropertyAddSet(@"try{ MainForm.Current?.Invoke(() => MainForm.Current.textBox1.Enabled = !value); } catch {}")]
44 [ProfilePropertyAddSet(@"if(value) Program.Manager[""Reset""].StartListen(10); else Program.Manager[""Reset""].StopListen()")]
45 [ProfilePropertyAddSet("resetFuncStart = value")]
46 static bool resetFuncStart;
47 [ProfileProperty]
48 [ProfilePropertyAddSet(@"try{ MainForm.Current?.Invoke(() => MainForm.Current.checkBox2.Checked = value); } catch {}")]
49 [ProfilePropertyAddSet(@"try{ MainForm.Current?.Invoke(() => MainForm.Current.textBox2.Enabled = !value); } catch {}")]
50 [ProfilePropertyAddSet(@"if(value) Program.Manager[""TimeCounter""].StartListen(10); else Program.Manager[""TimeCounter""].StopListen()")]
51 [ProfilePropertyAddSet("timeCounterFuncStart = value")]
52 static bool timeCounterFuncStart;
53 [ProfileProperty]
54 [ProfilePropertyAddSet(@"try{ MainForm.Current?.Invoke(() => MainForm.Current.checkBox3.Checked = value); } catch {}")]
55 [ProfilePropertyAddSet(@"try{ MainForm.Current?.Invoke(() => MainForm.Current.textBox3.Enabled = !value); } catch {}")]
56 [ProfilePropertyAddSet(@"if(value) Program.Manager[""Stamina""].StartListen(10); else Program.Manager[""Stamina""].StopListen()")]
57 [ProfilePropertyAddSet("staminaFuncStart = value")]
58 static bool staminaFuncStart;
59 34 }