Debian Codegraph @

src/editship.c

raw symbols SCIP
1 /*
2 * OpenTyrian: A modern cross-platform port of Tyrian
3 * Copyright (C) 2007-2009 The OpenTyrian Development Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 #include "editship.h"cxx . . $ `<file>/src/editship.h`/
20
21 #include "config.h"cxx . . $ `<file>/src/config.h`/
22 #include "file.h"cxx . . $ `<file>/src/file.h`/
23 #include "opentyr.h"cxx . . $ `<file>/src/opentyr.h`/
24
25 #define SAScxx . . $ `src/editship.c:25:9`! (sizeof(JE_ShipsType) - 4)
26
27 const JE_bytecxx . . $ JE_byte# extraCryptKeycxx . . $ extraCryptKey.[10] = { 58, 23, 16, 192, 254, 82, 113, 147, 62, 99 };
28
29 JE_booleancxx . . $ JE_boolean# extraAvailcxx . . $ extraAvail.;
30 JE_ShipsTypecxx . . $ JE_ShipsType# extraShipscxx . . $ extraShips.;
31 void *extraShapescxx . . $ extraShapes.;
32 JE_wordcxx . . $ JE_word# extraShapeSizecxx . . $ extraShapeSize.;
33
34 void JE_decryptShipscxx . . $ JE_decryptShips(49f6e7a06ebc5aa8).(void)
35 {
36 JE_booleancxx . . $ JE_boolean# correct = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
37 JE_ShipsTypecxx . . $ JE_ShipsType# s2;
38 JE_bytecxx . . $ JE_byte# y;
39
40 for (int x = SAScxx . . $ `src/editship.c:25:9`! - 1; x >= 0; x--)
41 {
42 s2[x] = extraShipscxx . . $ extraShips.[x] ^ extraCryptKeycxx . . $ extraCryptKey.[(x + 1) % 10];
43 if (x > 0)
44 s2[x] ^= extraShipscxx . . $ extraShips.[x - 1];
45 } /* <= Key Decryption Test (Reversed key) */
46
47 y = 0;
48 for (uintcxx . . $ uint# x = 0; x < SAScxx . . $ `src/editship.c:25:9`!; x++)
49 y += s2[x];
50 if (extraShipscxx . . $ extraShips.[SAScxx . . $ `src/editship.c:25:9`! + 0] != y)
51 correct = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
52
53 y = 0;
54 for (uintcxx . . $ uint# x = 0; x < SAScxx . . $ `src/editship.c:25:9`!; x++)
55 y -= s2[x];
56 if (extraShipscxx . . $ extraShips.[SAScxx . . $ `src/editship.c:25:9`! + 1] != y)
57 correct = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
58
59 y = 1;
60 for (uintcxx . . $ uint# x = 0; x < SAScxx . . $ `src/editship.c:25:9`!; x++)
61 y = y * s2[x] + 1;
62 if (extraShipscxx . . $ extraShips.[SAScxx . . $ `src/editship.c:25:9`! + 2] != y)
63 correct = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
64
65 y = 0;
66 for (uintcxx . . $ uint# x = 0; x < SAScxx . . $ `src/editship.c:25:9`!; x++)
67 y ^= s2[x];
68 if (extraShipscxx . . $ extraShips.[SAScxx . . $ `src/editship.c:25:9`! + 3] != y)
69 correct = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
70
71 if (!correct)
72 exitcxx . . $ exit(3ca292c338df9bb3).(255);
73
74 memcpycxx . . $ memcpy(cc817cb175f282d).(extraShipscxx . . $ extraShips., s2, sizeof(extraShipscxx . . $ extraShips.));
75 }
76
77 void JE_loadExtraShapescxx . . $ JE_loadExtraShapes(49f6e7a06ebc5aa8).(void)
78 {
79 FILEcxx . . $ FILE# *f = dir_fopencxx . . $ dir_fopen(2493aa730c89ee72).(get_user_directorycxx . . $ get_user_directory(33a1f659e94feb42).(), "newsh$.shp", "rb");
80
81 if (f)
82 {
83 extraAvailcxx . . $ extraAvail. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
84 extraShapeSizecxx . . $ extraShapeSize. = ftell_eofcxx . . $ ftell_eof(1dcafcd8ef4c6e6c).(f) - sizeof(extraShipscxx . . $ extraShips.);
85 extraShapescxx . . $ extraShapes. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(extraShapeSizecxx . . $ extraShapeSize.);
86 fread_diecxx . . $ fread_die(82d71c9ec5b61e0f).(extraShapescxx . . $ extraShapes., extraShapeSizecxx . . $ extraShapeSize., 1, f);
87 fread_diecxx . . $ fread_die(82d71c9ec5b61e0f).(extraShipscxx . . $ extraShips., sizeof(extraShipscxx . . $ extraShips.), 1, f);
88 JE_decryptShipscxx . . $ JE_decryptShips(49f6e7a06ebc5aa8).();
89 fclosecxx . . $ fclose(89bc1efcdac0ca22).(f);
90 }
91 }