| 1 | /* |
| 2 | Copyright (C) 2000 Marco Ziech ([email protected]) |
| 3 | Copyright (C) 2000 Ross Combs ([email protected]) |
| 4 | |
| 5 | This program is xfree software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 2 of the License, or |
| 8 | (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | */ |
| 19 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 20 | |
| 21 | #include <cerrno> |
| 22 | #include <cstdint> |
| 23 | #include <cstdlib> |
| 24 | #include <cstring> |
| 25 | |
| 26 | #ifdef HAVE_SYS_STAT_Hcxx . . $ `build/config.h:21:9`! |
| 27 | # include <sys/stat.h> |
| 28 | #endif |
| 29 | |
| 30 | #include "compat/mkdir.h"cxx . . $ `<file>/src/compat/mkdir.h`/ |
| 31 | #include "compat/statmacros.h"cxx . . $ `<file>/src/compat/statmacros.h`/ |
| 32 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 33 | #include "common/version.h"cxx . . $ `<file>/src/common/version.h`/ |
| 34 | #include "fileio.h"cxx . . $ `<file>/src/bniutils/fileio.h`/ |
| 35 | #include "tga.h"cxx . . $ `<file>/src/bniutils/tga.h`/ |
| 36 | #include "bni.h"cxx . . $ `<file>/src/bniutils/bni.h`/ |
| 37 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 38 | |
| 39 | using namespace pvpgncxx . . $ pvpgn/::bni; |
| 40 | using namespace pvpgn; |
| 41 | |
| 42 | namespacecxx . . $ `$anonymous_namespace_src/bniutils/bniextract.cpp`/ |
| 43 | { |
| 44 | |
| 45 | /* extract a portion of an image creating a new image */ |
| 46 | t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# * area2imgcxx . . $ `$anonymous_namespace_src/bniutils/bniextract.cpp`/area2img(a871d245ac46735a).(t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# *src, int x, int y, int width, int height, t_tgaimgtypecxx . . $ pvpgn/bni/t_tgaimgtype# type) { |
| 47 | t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# *dst; |
| 48 | int pixelsize; |
| 49 | unsigned char *datap; |
| 50 | unsigned char *destp; |
| 51 | int i; |
| 52 | |
| 53 | if (src == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 54 | if ((x + width) > src->widthcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#width.) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 55 | if ((y + height) > src->heightcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#height.) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 56 | pixelsize = getpixelsizecxx . . $ pvpgn/bni/getpixelsize(5314f7cd3df64b7e).(src); |
| 57 | if (pixelsize == 0) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 58 | |
| 59 | dst = new_tgaimgcxx . . $ pvpgn/bni/new_tgaimg(c336b9b97445332).(width, height, src->bppcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#bpp., type); |
| 60 | dst->datacxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#data. = (stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(width*height*pixelsize); |
| 61 | |
| 62 | datap = src->datacxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#data.; |
| 63 | datap += y*src->widthcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#width.*pixelsize; |
| 64 | destp = dst->datacxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#data.; |
| 65 | for (i = 0; i < height; i++) { |
| 66 | datap += x*pixelsize; |
| 67 | stdcxx . . $ std/::memcpy(destp, datap, width*pixelsize); |
| 68 | destp += width*pixelsize; |
| 69 | datap += (src->widthcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#width. - x)*pixelsize; |
| 70 | } |
| 71 | return dst; |
| 72 | } |
| 73 | |
| 74 | |
| 75 | void usagecxx . . $ `$anonymous_namespace_src/bniutils/bniextract.cpp`/usage(85c52e162fed56f9).(char const * progname) |
| 76 | { |
| 77 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, |
| 78 | "usage: %s [<options>] [--] <BNI file> <output directory>\n" |
| 79 | " -h, --help, --usage show this information and exit\n" |
| 80 | " -v, --version print version number and exit\n", progname); |
| 81 | |
| 82 | stdcxx . . $ std/::exit(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!); |
| 83 | } |
| 84 | |
| 85 | } |
| 86 | |
| 87 | extern int maincxx . . $ main(afcd3168fc1188a4).(int argc, char * argv[]) |
| 88 | { |
| 89 | char const * outdir = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 90 | char const * bnifile = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 91 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fbni; |
| 92 | struct stat s; |
| 93 | int a; |
| 94 | int forcefile = 0; |
| 95 | char dash[] = "-"; /* unique address used as flag */ |
| 96 | |
| 97 | if (argc < 1 || !argv || !argv[0]) |
| 98 | { |
| 99 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "bad arguments\n"); |
| 100 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 101 | } |
| 102 | |
| 103 | for (a = 1; a < argc; a++) |
| 104 | if (forcefile && !bnifile) |
| 105 | bnifile = argv[a]; |
| 106 | else if (stdcxx . . $ std/::strcmp(argv[a], "-") == 0 && !bnifile) |
| 107 | bnifile = dash; |
| 108 | else if (argv[a][0] != '-' && !bnifile) |
| 109 | bnifile = argv[a]; |
| 110 | else if (forcefile && !outdir) |
| 111 | outdir = argv[a]; |
| 112 | else if (stdcxx . . $ std/::strcmp(argv[a], "-") == 0 && !outdir) |
| 113 | outdir = dash; |
| 114 | else if (argv[a][0] != '-' && !outdir) |
| 115 | outdir = argv[a]; |
| 116 | else if (forcefile || argv[a][0] != '-' || stdcxx . . $ std/::strcmp(argv[a], "-") == 0) |
| 117 | { |
| 118 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: extra file argument \"%s\"\n", argv[0], argv[a]); |
| 119 | usagecxx . . $ `$anonymous_namespace_src/bniutils/bniextract.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 120 | } |
| 121 | else if (stdcxx . . $ std/::strcmp(argv[a], "--") == 0) |
| 122 | forcefile = 1; |
| 123 | else if (stdcxx . . $ std/::strcmp(argv[a], "-v") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--version") == 0) |
| 124 | { |
| 125 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("version " PVPGN_VERSIONcxx . . $ `src/common/version.h:23:9`! "\n"); |
| 126 | return EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!; |
| 127 | } |
| 128 | else if (stdcxx . . $ std/::strcmp(argv[a], "-h") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--help") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--usage") |
| 129 | == 0) |
| 130 | usagecxx . . $ `$anonymous_namespace_src/bniutils/bniextract.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 131 | else |
| 132 | { |
| 133 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: unknown option \"%s\"\n", argv[0], argv[a]); |
| 134 | usagecxx . . $ `$anonymous_namespace_src/bniutils/bniextract.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 135 | } |
| 136 | |
| 137 | if (!bnifile) |
| 138 | { |
| 139 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: BNI file not specified\n", argv[0]); |
| 140 | usagecxx . . $ `$anonymous_namespace_src/bniutils/bniextract.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 141 | } |
| 142 | if (!outdir) |
| 143 | { |
| 144 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: output directory not specified\n", argv[0]); |
| 145 | usagecxx . . $ `$anonymous_namespace_src/bniutils/bniextract.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 146 | } |
| 147 | |
| 148 | if (bnifile == dash) |
| 149 | fbni = stdincxx . . $ `<external>/232824719582829767/stdio.h:153:9`!; |
| 150 | else |
| 151 | if (!(fbni = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(bnifile, "r"))) |
| 152 | { |
| 153 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not open BNI file \"%s\" for reading (std::fopen: %s)\n", argv[0], bnifile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 154 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 155 | } |
| 156 | |
| 157 | if (outdir == dash) |
| 158 | { |
| 159 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: can not write directory to <stdout>\n", argv[0]); |
| 160 | if (bnifile != dash && stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fbni) < 0) |
| 161 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close BNI file \"%s\" after reading (std::fclose: %s)\n", argv[0], bnifile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 162 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 163 | } |
| 164 | if (stat(outdir, &s) < 0) { |
| 165 | if (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! == ENOENTcxx . . $ `<external>/8987895939074593727/errno-base.h:6:9`!) { |
| 166 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Info: Creating directory \"%s\" ...\n", outdir); |
| 167 | if (p_mkdircxx . . $ `src/compat/mkdir.h:51:11`!(outdir, S_IRWXUcxx . . $ `<external>/531885356569766532/stat.h:172:9`! + S_IRWXGcxx . . $ `<external>/531885356569766532/stat.h:184:9`! + S_IRWXOcxx . . $ `<external>/531885356569766532/stat.h:190:9`!) < 0) { |
| 168 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not create output directory \"%s\" (mkdir: %s)", argv[0], outdir, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 169 | if (bnifile != dash && stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fbni) < 0) |
| 170 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close BNI file \"%s\" after reading (std::fclose: %s)\n", argv[0], bnifile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 171 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 172 | } |
| 173 | } |
| 174 | else { |
| 175 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not stat output directory \"%s\" (stat: %s)\n", argv[0], outdir, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 176 | if (bnifile != dash && stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fbni) < 0) |
| 177 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close BNI file \"%s\" after reading (std::fclose: %s)\n", argv[0], bnifile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 178 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 179 | } |
| 180 | } |
| 181 | else |
| 182 | if (S_ISDIRcxx . . $ `<external>/531885356569766532/stat.h:125:9`!(s.st_mode) == 0) { |
| 183 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: \"%s\" is not a directory\n", argv[0], outdir); |
| 184 | if (bnifile != dash && stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fbni) < 0) |
| 185 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close BNI file \"%s\" after reading (std::fclose: %s)\n", argv[0], bnifile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 186 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 187 | } |
| 188 | |
| 189 | { |
| 190 | unsigned int i; |
| 191 | int curry; |
| 192 | t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# * iconimg; |
| 193 | t_bnifilecxx . . $ pvpgn/bni/t_bnifile# * bni; |
| 194 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * indexfile; |
| 195 | char * indexfilename; |
| 196 | |
| 197 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Info: Loading \"%s\" ...\n", bnifile); |
| 198 | bni = load_bnicxx . . $ pvpgn/bni/load_bni(740814a27d52ca3d).(fbni); |
| 199 | if (bni == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 200 | if (stdcxx . . $ std/::fseekcxx . . $ std/fseek(543fae30d249f6b1).(fbni, bni->dataoffsetcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#dataoffset., SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!) < 0) { |
| 201 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not seek to TGA data offset %lu (std::fseek: %s)\n", argv[0], (unsigned long int)bni->dataoffsetcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#dataoffset., stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 202 | if (bnifile != dash && stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fbni) < 0) |
| 203 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close BNI file \"%s\" after reading (std::fclose: %s)\n", argv[0], bnifile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 204 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 205 | } |
| 206 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Info: Loading image ...\n"); |
| 207 | iconimg = load_tgacxx . . $ pvpgn/bni/load_tga(d209b58585032934).(fbni); |
| 208 | if (iconimg == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 209 | |
| 210 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Info: Extracting icons ...\n"); |
| 211 | indexfilename = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(outdir) + 14); |
| 212 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(indexfilename, "%s/bniindex.lst", outdir); |
| 213 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Info: Writing Index to \"%s\" ... \n", indexfilename); |
| 214 | indexfile = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(indexfilename, "w"); |
| 215 | if (indexfile == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 216 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not open index file \"%s\" for writing (std::fopen: %s)\n", argv[0], indexfilename, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 217 | if (bnifile != dash && stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fbni) < 0) |
| 218 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close BNI file \"%s\" after reading (std::fclose: %s)\n", argv[0], bnifile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 219 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 220 | } |
| 221 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(indexfile, "unknown1 %08x\n", bni->unknown1cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown1.); |
| 222 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(indexfile, "unknown2 %08x\n", bni->unknown2cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown2.); |
| 223 | curry = 0; |
| 224 | for (i = 0; i < bni->numiconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#numicons.; i++) { |
| 225 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# *dsttga; |
| 226 | char *name; |
| 227 | t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# *icn; |
| 228 | icn = area2imgcxx . . $ `$anonymous_namespace_src/bniutils/bniextract.cpp`/area2img(a871d245ac46735a).(iconimg, 0, curry, bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].xcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#x., bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].ycxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#y., tgaimgtype_uncompressed_truecolorcxx . . $ pvpgn/bni/tgaimgtype_uncompressed_truecolor.); |
| 229 | if (icn == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 230 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Error: area2img failed!\n"); |
| 231 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 232 | } |
| 233 | if (bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].idcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#id. == 0) { |
| 234 | int tag = bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].tagcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#tag.; |
| 235 | name = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(outdir) + 10); |
| 236 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(name, "%s/%c%c%c%c.tga", outdir, ((tag >> 24) & 0xff), ((tag >> 16) & 0xff), ((tag >> 8) & 0xff), ((tag >> 0) & 0xff)); |
| 237 | } |
| 238 | else { |
| 239 | name = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(outdir) + 16); |
| 240 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(name, "%s/%08x.tga", outdir, bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].idcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#id.); |
| 241 | } |
| 242 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Info: Writing icon %u(%ux%u) to file \"%s\" ... \n", i + 1, icn->widthcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#width., icn->heightcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#height., name); |
| 243 | curry += icn->heightcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#height.; |
| 244 | dsttga = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(name, "w"); |
| 245 | if (dsttga == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 246 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not open ouptut TGA file \"%s\" for writing (std::fopen: %s)\n", argv[0], name, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 247 | } |
| 248 | else { |
| 249 | if (write_tgacxx . . $ pvpgn/bni/write_tga(790b6d97a440dd74).(dsttga, icn) < 0) { |
| 250 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Error: Writing to TGA failed.\n"); |
| 251 | } |
| 252 | else { |
| 253 | int tag = bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].tagcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#tag.; |
| 254 | if (bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].idcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#id. == 0) { |
| 255 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(indexfile, "icon !%c%c%c%c %d %d %08x\n", ((tag >> 24) & 0xff), ((tag >> 16) & 0xff), ((tag >> 8) & 0xff), ((tag >> 0) & 0xff), bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].xcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#x., bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].ycxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#y., bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].unknowncxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#unknown.); |
| 256 | } |
| 257 | else { |
| 258 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(indexfile, "icon #%08x %d %d %08x\n", bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].idcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#id., bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].xcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#x., bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].ycxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#y., bni->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].unknowncxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#unknown.); |
| 259 | } |
| 260 | } |
| 261 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(dsttga) < 0) |
| 262 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close TGA file \"%s\" after writing (std::fclose: %s)\n", argv[0], name, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 263 | } |
| 264 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(name); |
| 265 | destroy_imgcxx . . $ pvpgn/bni/destroy_img(537e23c0c2dd1c71).(icn); |
| 266 | } |
| 267 | destroy_imgcxx . . $ pvpgn/bni/destroy_img(537e23c0c2dd1c71).(iconimg); |
| 268 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(indexfile) < 0) { |
| 269 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close index file \"%s\" after writing (std::fclose: %s)\n", argv[0], indexfilename, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 270 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 271 | } |
| 272 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(indexfilename); |
| 273 | } |
| 274 | if (bnifile != dash && stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fbni) < 0) |
| 275 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close BNI file \"%s\" after reading (std::fclose: %s)\n", argv[0], bnifile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 276 | |
| 277 | return EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!; |
| 278 | } |