24 _sopen_s(&handle,
"patchdate.txt", _O_RDONLY | _O_TEXT | _O_SEQUENTIAL, _SH_DENYNO, _S_IWRITE);
28 sprintf_s(msg, 199,
"Could not open patchdate.txt for reading: %i", errno);
29 MessageBoxA(
nullptr, msg,
"Fatal Exception", MB_ICONERROR | MB_OK);
32 const int bytes = _read(handle,
patchdate, 24);
42 _sopen_s(&handle,
"patchdate.txt", _O_WRONLY | _O_CREAT | _O_TRUNC | _O_TEXT | _O_SEQUENTIAL, _SH_SECURE, _S_IWRITE);
46 sprintf_s(msg, 199,
"Could not open patchdate.txt for writing: %i", errno);
47 MessageBoxA(
nullptr, msg,
"Fatal Exception", MB_ICONERROR | MB_OK);
51 sprintf_s(newdate, 24,
"%s\n",
patchdate);
52 _write(handle, newdate, strlen(newdate) + 1);
63 _sopen_s(&config,
"Save\\client.cfg", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYNO, _S_IWRITE);
67 if (rename(
"client.cfg",
"Save\\client.cfg") == 0)
69 rename(
"waypoint.dat",
"Save\\waypoint.dat");
70 _sopen_s(&config,
"Save\\client.cfg", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYNO, _S_IWRITE);
77 _lseek(config, 0L, SEEK_SET);
78 _read(config, &unused, 1);
80 _read(config, &unused, 1);
81 _read(config, &unused, 1);
82 _read(config, &unused, 1);
83 _read(config, &unused, 1);
89 MessageBox(
nullptr, L
"Your \"Save\\client.cfg\" was corrupt and has been rebuilt. Please report this error.", L
"Version error!", MB_ICONERROR | MB_OK);
109 _lseek(config, 8L, SEEK_SET);
120 _lseek(config, 40L, SEEK_SET);
131 _lseek(config, 42L, SEEK_SET);
144 _lseek(config, 24L, SEEK_SET);
146 char encryptpass[16];
148 _lseek(config, 24L, SEEK_SET);
149 _write(config, encryptpass, 16);
153 char encryptpass[16];
154 _lseek(config, 24L, SEEK_SET);
155 _read(config, encryptpass, 16);
174 _lseek(config, 700L, SEEK_SET);
187 _lseek(config, 75L, SEEK_SET);
203 _lseek(config, 500L, SEEK_SET);
221 _lseek(config, 400L, SEEK_SET);
234 _lseek(config, 796L, SEEK_SET);
250 _lseek(config, 900L, SEEK_SET);
261 _lseek(config, 43L, SEEK_SET);
262 _read(config, &
scale, 4);
267 _unlink(
"Save/gui.cfg");
309 _lseek(config, 932L, SEEK_SET);
323 _lseek(config, 828L, SEEK_SET);
331 _lseek(config, 128L, SEEK_SET);
344 if (_access(
"Languages\\chinese.default", 0) != -1)
language = 1;
345 else if (_access(
"Languages\\dutch.default", 0) != -1)
language = 2;
346 else if (_access(
"Languages\\french.default", 0) != -1)
language = 3;
347 else if (_access(
"Languages\\german.default", 0) != -1)
language = 4;
348 else if (_access(
"Languages\\greek.default", 0) != -1)
language = 5;
349 else if (_access(
"Languages\\italian.default", 0) != -1)
language = 6;
350 else if (_access(
"Languages\\japanese.default", 0) != -1)
language = 7;
351 else if (_access(
"Languages\\korean.default", 0) != -1)
language = 8;
352 else if (_access(
"Languages\\portuguese.default", 0) != -1)
language = 9;
353 else if (_access(
"Languages\\russian.default", 0) != -1)
language = 10;
354 else if (_access(
"Languages\\spanish.default", 0) != -1)
language = 11;
367 _sopen_s(&config,
"Save\\client.cfg", _O_WRONLY | O_CREAT | _O_BINARY | _O_SEQUENTIAL, _SH_SECURE, _S_IWRITE);
370 MessageBox(
nullptr, L
"Could not save to the \"Save\\client.cfg\" file!", L
"File system error!", MB_ICONERROR | MB_OK);
374 _lseek(config, 0L, SEEK_SET);
375 unsigned char unused[24];
376 ZeroMemory(unused, 24);
377 _write(config, &unused, 1);
379 _write(config, &unused, 1);
380 _write(config, &unused, 1);
381 _write(config, &unused, 1);
382 _write(config, &unused, 1);
384 _write(config, &unused, 1);
386 _write(config, &unused, 1);
387 _write(config, &unused, 1);
388 _write(config, &unused, 1);
389 char encryptpass[16];
391 _write(config, encryptpass, 16);
393 _write(config, &unused, 1);
395 _write(config, &
scale, 4);
396 _write(config, &unused, 1);
397 _write(config, &unused, 1);
398 _write(config, &unused, 1);
399 _write(config, &unused, 24);
400 _write(config, &unused, 1);
403 _lseek(config, 400L, SEEK_SET);
408 _lseek(config, 500L, SEEK_SET);
416 _lseek(config, 700L, SEEK_SET);
424 _lseek(config, 900L, SEEK_SET);
InputConfig inputConfigLeftToeBrake
void SavePatchDate() const
bool g_bCheckSteamLanguage
static bool EncryptString(char *szPassword, char *szEncryptPwd, char *szKey)
SoundConfig soundConfigLegacy
InputConfig inputConfigGas
InputConfig inputConfigRoll
InputConfig inputConfigLookVertical
static bool DecryptString(char *szEncryptPwd, char *szPassword, char *szKey)
InputConfig inputConfigThrustLeft
InputConfig inputConfigThrustRight
static bool SetupCryptoClient()
InputConfig inputConfigPitchTrim
InputConfig inputConfigPitch
SoundConfig soundConfigComms
InputConfig inputConfigBrake
InputConfig inputConfigRightToeBrake
SoundConfig soundConfigRadio
InputConfig inputConfigWalkVertical
InputConfig inputConfigWalkLateral
InputConfig inputConfigYaw
SoundConfig soundConfigComputer
InputConfig inputConfigSteer
InputConfig inputConfigLookLateral