-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathForm1.cs
225 lines (189 loc) · 7.21 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DualSenseAT
{
public partial class Form1 : Form
{
//public Ets2SdkTelemetry Telemetry;
public Form1()
{
InitializeComponent();
}
private void TelemetryOnJobFinished(object sender, EventArgs args)
{
//MessageBox.Show("Job finished, or at least unloaded nearby cargo destination.");
}
//private Mem memLib = new Mem();
private int processID;
private bool processOpen = false;
private bool validNumber = false;
private int temporaryNumb = 0;
public struct Controller
{
public enum Types
{
Normal = 1,
Hard = 2,
VeryHard = 3,
Machine = 4,
Resistance = 5,
}
public enum Triggers
{
LeftTrigger = 1,
RightTrigger = 2,
}
public struct WriteController
{
public static void SetRightTrigger(Controller.Types type, string customargs = "(0)(0)")
{
var MyIni = new IniFile(@"C:\DualsenseX_GameTriggers.txt");
switch (type)
{
case Controller.Types.Normal:
MyIni.Write("RightTrigger", "Normal");
break;
case Controller.Types.Hard:
MyIni.Write("RightTrigger", "Hard");
break;
case Controller.Types.VeryHard:
MyIni.Write("RightTrigger", "VeryHard");
break;
case Controller.Types.Resistance:
MyIni.Write("RightTrigger", "Resistance");
MyIni.Write("ForceRightTrigger", customargs);
break;
}
}
public static void SetLeftTrigger(Controller.Types type, string customargs = "(0)(0)")
{
var MyIni = new IniFile(@"C:\DualsenseX_GameTriggers.txt");
switch (type)
{
case Controller.Types.Normal:
MyIni.Write("LeftTrigger", "Normal");
break;
case Controller.Types.Hard:
MyIni.Write("LeftTrigger", "Hard");
break;
case Controller.Types.VeryHard:
MyIni.Write("LeftTrigger", "VeryHard");
break;
case Controller.Types.Machine:
MyIni.Write("LeftTrigger", "Machine");
MyIni.Write("ForceLeftTrigger", customargs);
break;
}
}
public static void ResetTrigger(Controller.Triggers trigger)
{
var MyIni = new IniFile(@"C:\DualsenseX_GameTriggers.txt");
switch (trigger)
{
case Controller.Triggers.LeftTrigger:
MyIni.Write("LeftTrigger", "Normal");
break;
case Controller.Triggers.RightTrigger:
MyIni.Write("RightTrigger", "Normal");
break;
}
}
}
}
private void findProcessID(string procname)
{
/*processID = memLib.GetProcIdFromName(procname); //Gets process ID
processOpen = memLib.OpenProcess(processID);
if (processID > 0)
{
procIdLabel.Invoke((MethodInvoker)delegate
{
procIdLabel.Text = processID.ToString();
procIdLabel.ForeColor = Color.Lime;
});
gameProcessNameLabel.Invoke((MethodInvoker)delegate {
gameProcessNameLabel.Text = procname + ".exe";
gameProcessNameLabel.ForeColor = Color.Lime;
});
}
else
{
procIdLabel.Invoke((MethodInvoker)delegate
{
procIdLabel.Text = "Process ID Not Found";
procIdLabel.ForeColor = Color.Red;
});
gameProcessNameLabel.Invoke((MethodInvoker)delegate {
gameProcessNameLabel.Text = "N/A";
gameProcessNameLabel.ForeColor = Color.Red;
});
}
if (processOpen)
{
procOpenLabel.Invoke((MethodInvoker)delegate
{
procOpenLabel.Text = "GAME FOUND!";
procOpenLabel.ForeColor = Color.Lime;
});
}
else
{
procOpenLabel.Invoke((MethodInvoker)delegate
{
procOpenLabel.Text = "N/A";
procOpenLabel.ForeColor = Color.Red;
});
}*/
}
private void Form1_Load(object sender, EventArgs e)
{
if (!File.Exists(@"C:\DualsenseX_GameTriggers.txt"))
File.Create(@"C:\DualsenseX_GameTriggers.txt");
}
private void ResidentEvil5Steam()
{
/*
var MyIni = new IniFile(@"C:\DualsenseX_GameTriggers.txt");
int ammo = memLib.ReadInt("re5dx9.exe+00DA2604,84,238,CE4,5C,36C,0,F40");
// MyIni.Write("RightTrigger", "Resistance");
MyIni.Write("LeftTrigger", "Resistance");
MyIni.Write("ForceLeftTrigger", "(4)(2)");
if (ammo > 0)
{
Controller.WriteController.SetRightTrigger(Controller.Types.Hard);
// MyIni.Write("RightTrigger", "SemiAutomaticGun");
// MyIni.Write("ForceLeftTrigger", "(2)(5)(2)");
}
else
Controller.WriteController.SetRightTrigger(Controller.Types.Normal);
Console.WriteLine("Ammo: " + ammo);
*/
}
private void OnTime_Tick(object sender, EventArgs e)
{
if (!processOpen)
return;
if (gameList.SelectedIndex < 0)
return;
if (gameList.SelectedItem.ToString() == "Resident Evil 5 (Steam)")
ResidentEvil5Steam();
}
private void gameList_SelectedIndexChanged(object sender, EventArgs e)
{
if (gameList.SelectedItem.ToString() == "Resident Evil 5 (Steam)")
findProcessID("re5dx9");
else if (gameList.SelectedItem.ToString() == "Euro Truck Simulator 2 (Steam)")
findProcessID("eurotrucks2");
}
}
}