Skip to content

Commit 0aeef6f

Browse files
committed
supported english version of the game, fix bug in am training schedule, instructions
1 parent 8eb663c commit 0aeef6f

File tree

8 files changed

+127
-103
lines changed

8 files changed

+127
-103
lines changed

Fsm97Trainer/FSM97Patcher/FormMain.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Fsm97Trainer/FSM97Patcher/FormMain.cs

Lines changed: 62 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ private void OnNewFileEntered()
131131
//004A89DC - A3 E8465800 - mov[MENUS.EXE + 1846E8],eax
132132
detectAddress1 = 0xa7dd3;
133133
detectAddress2 = 0xa7ddc;
134-
detectAddressPatch = 0xa7dd7;
134+
detectAddressPatch = 0xa7dd7;
135+
trainingEffectAddress = 0xe0000;
135136
detect1 = new byte[] { 0xfc, 0xff, 0x8b, 0x10 };
136137
detect2 = new byte[] { 0xa3, 0xe8, 0x46, 0x58 };
137138
break;
@@ -204,91 +205,81 @@ private void buttonUnpatch_Click(object sender, EventArgs e)
204205
OnNewFileEntered();
205206

206207
}
207-
208+
string[] headerEn = new string[] {
209+
"200 Times","Speed","Agility","Acceleration","Stamina","Strength","Fitness","Shooting","Passing","Heading","Control","Dribbling",
210+
"Coolness","Awareness","TackleDetermination","TackleSkill","Flair","Kicking","Throwing","Handling",
211+
"ThrowIn","Leadership","Consistency","Determination","Greed","Form","Morale","Energy"
212+
};
213+
string[] headerZh = new string[] {
214+
"200次","速度","敏捷","加速","耐力","力量","健康","射门","传球","头球","控球","盘带",
215+
"冷静","意识","盯人","铲球","才华","踢球","掷球","救球",
216+
"边线球","领导","稳定","逆风","贪婪","状态","士气","体力"
217+
};
208218
private void buttonShowTrainingEffects_Click(object sender, EventArgs e)
209219
{
210220
try
211221
{
222+
string[] headers;
212223
FileInfo fi = new FileInfo(textBox1.Text);
213224
switch (fi.Length)
214225
{
215226
case 1378816:
216227
trainingEffectAddress = 0xe2aa0;
217-
var fileBytes = File.ReadAllBytes(textBox1.Text);
218-
float[] trainingEffectFloat = new float[27 * 19];
219-
Buffer.BlockCopy(fileBytes, trainingEffectAddress, trainingEffectFloat, 0, trainingEffectFloat.Length*4);
220-
if (fileBytes.Length < trainingEffectAddress)
221-
{
222-
MessageBox.Show("不支持的游戏版本 (Unsupported Game Version)");
223-
return;
224-
}
225-
using (SaveFileDialog sfd = new SaveFileDialog())
228+
headers = headerZh;
229+
break;
230+
case 1135104:
231+
headers = headerEn;
232+
trainingEffectAddress = 0xe0000; break;
233+
default:
234+
MessageBox.Show("不支持的游戏版本 (Unsupported Game Version)");
235+
return;
236+
}
237+
var fileBytes = File.ReadAllBytes(textBox1.Text);
238+
float[] trainingEffectFloat = new float[27 * 19];
239+
Buffer.BlockCopy(fileBytes, trainingEffectAddress, trainingEffectFloat, 0, trainingEffectFloat.Length*4);
240+
if (fileBytes.Length < trainingEffectAddress)
241+
{
242+
MessageBox.Show("不支持的游戏版本 (Unsupported Game Version)");
243+
return;
244+
}
245+
using (SaveFileDialog sfd = new SaveFileDialog())
246+
{
247+
sfd.FileName = "trainingEffects.csv";
248+
sfd.Filter = "csv files (*.csv)|*.csv|All files (*.*)|*.*";
249+
sfd.Title = "选择训练效果数据保存路径(Select player data export location)";
250+
if (sfd.ShowDialog() == DialogResult.OK)
251+
{
252+
CsvConfiguration config = new CsvConfiguration();
253+
config.Encoding = Encoding.UTF8;
254+
config.CultureInfo = new CultureInfo("zh-hans");
255+
using (var writer = new StreamWriter(sfd.FileName, false, Encoding.UTF8))
256+
using (var csv = new CsvWriter(writer, config))
226257
{
227-
sfd.FileName = "trainingEffects.csv";
228-
sfd.Filter = "csv files (*.csv)|*.csv|All files (*.*)|*.*";
229-
sfd.Title = "选择训练效果数据保存路径(Select player data export location)";
230-
if (sfd.ShowDialog() == DialogResult.OK)
258+
foreach (var item in headers)
231259
{
232-
CsvConfiguration config = new CsvConfiguration();
233-
config.Encoding = Encoding.UTF8;
234-
config.CultureInfo = new CultureInfo("zh-hans");
235-
using (var writer = new StreamWriter(sfd.FileName, false, Encoding.UTF8))
236-
using (var csv = new CsvWriter(writer, config))
260+
csv.WriteField(item);
261+
}
262+
csv.NextRecord();
263+
for (int i = 0; i < (int)TrainingScheduleType.TrainingMatch + 1; i++)
264+
{
265+
csv.WriteField(Enum.GetName(typeof(TrainingScheduleType), i));
266+
for (int j = 0; j < 27; j++)
237267
{
238-
csv.WriteField("200次");
239-
csv.WriteField("速度");
240-
csv.WriteField("敏捷");
241-
csv.WriteField("加速");
242-
csv.WriteField("耐力");
243-
csv.WriteField("力量");
244-
csv.WriteField("健康");
245-
csv.WriteField("射门");
246-
csv.WriteField("传球");
247-
csv.WriteField("头球");
248-
csv.WriteField("控球");
249-
csv.WriteField("盘带");
250-
csv.WriteField("冷静");
251-
csv.WriteField("意识");
252-
csv.WriteField("盯人");
253-
csv.WriteField("铲球");
254-
csv.WriteField("才华");
255-
csv.WriteField("踢球");
256-
csv.WriteField("掷球");
257-
csv.WriteField("救球");
258-
csv.WriteField("边线球");
259-
csv.WriteField("领导");
260-
csv.WriteField("稳定");
261-
csv.WriteField("逆风");
262-
csv.WriteField("贪婪");
263-
csv.WriteField("状态");
264-
csv.WriteField("士气");
265-
csv.WriteField("体力");
266-
csv.NextRecord();
267-
for (int i = 0; i < (int)TrainingScheduleType.TrainingMatch + 1; i++)
268-
{
269-
csv.WriteField(Enum.GetName(typeof(TrainingScheduleType), i));
270-
for (int j = 0; j < 27; j++)
271-
{
272-
var fieldValue = trainingEffectFloat[i * 27 + j] * 200;
273-
if (fieldValue == 0)
274-
csv.WriteField(string.Empty);
275-
else
276-
csv.WriteField(fieldValue);
277-
}
278-
csv.NextRecord();
279-
}
268+
var fieldValue = trainingEffectFloat[i * 27 + j] * 200;
269+
if (fieldValue == 0)
270+
csv.WriteField(string.Empty);
271+
else
272+
csv.WriteField(fieldValue);
280273
}
281-
ProcessStartInfo psi = new ProcessStartInfo();
282-
psi.UseShellExecute = true;
283-
psi.FileName = sfd.FileName;
284-
Process.Start(psi);
274+
csv.NextRecord();
285275
}
286276
}
287-
break;
288-
default:
289-
MessageBox.Show("不支持的游戏版本 (Unsupported Game Version)");
290-
return;
291-
}
277+
ProcessStartInfo psi = new ProcessStartInfo();
278+
psi.UseShellExecute = true;
279+
psi.FileName = sfd.FileName;
280+
Process.Start(psi);
281+
}
282+
}
292283
}
293284
catch (Exception ex)
294285
{

Fsm97Trainer/Fsm97Trainer/FormMain.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,14 @@ private void buttonBoostYouthPlayer_Click(object sender, EventArgs e)
256256
{
257257
try
258258
{
259-
MenusProcess menusProcess = GetMenusProcess();
260-
menusProcess.BoostYouthPlayer(false);
261-
MessageBox.Show("年轻球员数据已增益(Youth Player data boosted)");
259+
var result = MessageBox.Show("只能在新赛季开始时进行。继续?\r\n"
260+
+ "Can only be done at the beginning of the season. Continue?", "警告(warning)", MessageBoxButtons.YesNo);
261+
if (result == DialogResult.Yes)
262+
{
263+
MenusProcess menusProcess = GetMenusProcess();
264+
menusProcess.BoostYouthPlayer(false);
265+
MessageBox.Show("年轻球员数据已增益(Youth Player data boosted)");
266+
}
262267
}
263268
catch (Exception ex)
264269
{

Fsm97Trainer/Fsm97Trainer/Fsm97Trainer.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
<Compile Include="IDivisionFactor.cs" />
6666
<Compile Include="IObjectWithPersonName.cs" />
6767
<Compile Include="MenusProcess.cs" />
68-
<Compile Include="NamesakePlayers.cs" />
6968
<Compile Include="NativeMethods.cs" />
7069
<Compile Include="Player.cs" />
7170
<Compile Include="ObjectWithNameCollectionWithIndex.cs" />

Fsm97Trainer/Fsm97Trainer/MenusProcess.cs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using Diacritics.Extensions;
2222
using System.CodeDom;
2323
using System.Windows.Forms.VisualStyles;
24+
using System.Security.Cryptography;
2425

2526
namespace Fsm97Trainer
2627
{
@@ -70,6 +71,17 @@ public void Dispose()
7071
Process Process { get; set; }
7172

7273

74+
static string CalculateMD5(string filename)
75+
{
76+
using (var md5 = MD5.Create())
77+
{
78+
using (var stream = File.OpenRead(filename))
79+
{
80+
var hash = md5.ComputeHash(stream);
81+
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
82+
}
83+
}
84+
}
7385

7486
public MenusProcess()
7587
{
@@ -93,13 +105,25 @@ public MenusProcess()
93105
switch (fi.Length)
94106
{
95107
case 1378816:
96-
//menusProcess.SubCountAddress = 0x614610;
97-
//menusProcess.DivisionFactorAddress = 0x4f3a60;
98-
TeamDataAddress = 0x00547102;
99-
DateAddress = 0x00562ED8;
100-
CurrentTeamIndexAddress = 0x562a4c;
101-
TrainingDataAddress = 0x562f50;
102-
TrainingEffectAddress= 0x004e38a0;
108+
var md5 = CalculateMD5(fi.FullName);
109+
switch (md5) {
110+
case "a1e5fe2e30a34a1dbc783aa0e88aafec":
111+
TeamDataAddress = 0x00547102;
112+
DateAddress = 0x00562ED8;
113+
CurrentTeamIndexAddress = 0x562a4c;
114+
TrainingDataAddress = 0x562f50;
115+
TrainingEffectAddress = 0x004e38a0;
116+
break;
117+
default:
118+
//menusProcess.SubCountAddress = 0x614610;
119+
//menusProcess.DivisionFactorAddress = 0x4f3a60;
120+
TeamDataAddress = 0x00547102;
121+
DateAddress = 0x00562ED8;
122+
CurrentTeamIndexAddress = 0x562a4c;
123+
TrainingDataAddress = 0x562f50;
124+
TrainingEffectAddress = 0x004e38a0;
125+
break;
126+
}
103127
Encoding = Encoding.GetEncoding(936);
104128
break;
105129
case 1135104://English Ver
@@ -110,6 +134,7 @@ public MenusProcess()
110134
TeamDataAddress = 0x00588D12;
111135
CurrentTeamIndexAddress = 0x5a465c;
112136
TrainingDataAddress = 0x5a4b60;
137+
TrainingEffectAddress = 0x004e1000;
113138
break;
114139
default:
115140
Process.Dispose();
@@ -340,7 +365,6 @@ private PlayerNodeList ReadPlayers(int nodeAddress, Team team, Encoding encoding
340365
PlayerNodeList result = new PlayerNodeList();
341366
if (nodeAddress == 0) return result;
342367
int nextNodeAddress = NativeMethods.ReadInt(Process, nodeAddress + 4);
343-
//nextNodeAddress =02982f0
344368
do
345369
{
346370
var resultNode = new PlayerNode();

Fsm97Trainer/Fsm97Trainer/NamesakePlayers.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

Fsm97Trainer/Fsm97Trainer/TrainingSchedule.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,18 +502,24 @@ private static TrainingScheduleType[] GetLRAMTrainingScheduleStage(Player player
502502
{
503503
result = ImprovePassingTo(player, stageMinimum, noAlternativeTraining);
504504
if (result != null) return result;
505-
result = ImproveTackleSkillTo(player, stageMinimum , trainingEffectModifier);
505+
result = ImproveTackleSkillTo(player, stageMinimum, trainingEffectModifier);
506506
if (result != null) return result;
507507

508508
}
509509
else
510510
{
511511
result = ImproveTackleSkillTo(player, stageMinimum, trainingEffectModifier);
512512
if (result != null) return result;
513-
result = ImprovePassingTo(player, stageMinimum , noAlternativeTraining);
513+
result = ImprovePassingTo(player, stageMinimum, noAlternativeTraining);
514514
if (result != null) return result;
515515
}
516516
}
517+
else {
518+
result = ImprovePassingTo(player, stageMinimum, noAlternativeTraining);
519+
if (result != null) return result;
520+
result = ImproveTackleSkillTo(player, stageMinimum, trainingEffectModifier);
521+
if (result != null) return result;
522+
}
517523
result = ImproveControlTo(player, stageMinimum);
518524
if (result != null) return result;
519525
result = ImproveDribbleTo(player, stageMinimum);

0 commit comments

Comments
 (0)