| 1 | /* |
| 2 | * Copyright (C) 2000,2001 Onlyer ([email protected]) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 19 | #include "setup.h"cxx . . $ `<file>/src/d2cs/setup.h`/ |
| 20 | #include "d2charfile.h"cxx . . $ `<file>/src/d2cs/d2charfile.h`/ |
| 21 | |
| 22 | #include <algorithm> |
| 23 | #include <cstring> |
| 24 | #include <ctime> |
| 25 | #include <cstdio> |
| 26 | #include <cctype> |
| 27 | #include <cerrno> |
| 28 | |
| 29 | #include "compat/access.h"cxx . . $ `<file>/src/compat/access.h`/ |
| 30 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 31 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 32 | #include "common/d2char_checksum.h"cxx . . $ `<file>/src/common/d2char_checksum.h`/ |
| 33 | #include "common/xstring.h"cxx . . $ `<file>/src/common/xstring.h`/ |
| 34 | #include "prefs.h"cxx . . $ `<file>/src/d2cs/prefs.h`/ |
| 35 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 36 | |
| 37 | namespace pvpgncxx . . $ pvpgn/ |
| 38 | { |
| 39 | |
| 40 | namespace d2cscxx . . $ pvpgn/d2cs/ |
| 41 | { |
| 42 | typedef enumcxx . . $ pvpgn/d2cs/$anonymous_type_aa14d38df8a7ef6c_0# |
| 43 | { |
| 44 | character_class_amazoncxx . . $ pvpgn/d2cs/character_class_amazon., |
| 45 | character_class_sorceresscxx . . $ pvpgn/d2cs/character_class_sorceress., |
| 46 | character_class_necromancercxx . . $ pvpgn/d2cs/character_class_necromancer., |
| 47 | character_class_paladincxx . . $ pvpgn/d2cs/character_class_paladin., |
| 48 | character_class_barbariancxx . . $ pvpgn/d2cs/character_class_barbarian., |
| 49 | character_class_druidcxx . . $ pvpgn/d2cs/character_class_druid., |
| 50 | character_class_assassincxx . . $ pvpgn/d2cs/character_class_assassin. |
| 51 | } t_character_classcxx . . $ pvpgn/d2cs/t_character_class#; |
| 52 | |
| 53 | static int d2charsave_initcxx . . $ pvpgn/d2cs/d2charsave_init(ce7c83014af972c1).(void * buffer, char const * charname, unsigned char chclass, unsigned short status); |
| 54 | static int d2charsave_init_from_d2scxx . . $ pvpgn/d2cs/d2charsave_init_from_d2s(58a8bfa786bd2fa4).(unsigned char * buffer, char const * charname, unsigned char chclass, unsigned short status, unsigned int size); |
| 55 | static int d2charinfo_initcxx . . $ pvpgn/d2cs/d2charinfo_init(2d928ea81497a866).(t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file# * chardata, char const * account, char const * charname, |
| 56 | unsigned char chclass, unsigned short status); |
| 57 | |
| 58 | static int d2charsave_initcxx . . $ pvpgn/d2cs/d2charsave_init(ce7c83014af972c1).(void * buffer, char const * charname, unsigned char chclass, unsigned short status) |
| 59 | { |
| 60 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(buffer, -1); |
| 61 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 62 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).((bn_bytecxx . . $ pvpgn/bn_byte# *)((char *)buffer + D2CHARSAVE_CLASS_OFFSETcxx . . $ `src/d2cs/d2charfile.h:27:9`!), chclass); |
| 63 | bn_short_setcxx . . $ pvpgn/bn_short_set(d9a03b44e43bbca3).((bn_shortcxx . . $ pvpgn/bn_short# *)((char *)buffer + D2CHARSAVE_STATUS_OFFSETcxx . . $ `src/d2cs/d2charfile.h:26:9`!), status); |
| 64 | stdcxx . . $ std/::strncpy((char *)buffer + D2CHARSAVE_CHARNAME_OFFSETcxx . . $ `src/d2cs/d2charfile.h:28:9`!, charname, MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.); |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | /* create new character from newbie.save that is normal d2s character file */ |
| 69 | static int d2charsave_init_from_d2scxx . . $ pvpgn/d2cs/d2charsave_init_from_d2s(58a8bfa786bd2fa4).(unsigned char * buffer, char const * charname, unsigned char chclass, unsigned short status, unsigned int size) |
| 70 | { |
| 71 | unsigned int checksum; |
| 72 | |
| 73 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(buffer, -1); |
| 74 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 75 | |
| 76 | // class |
| 77 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).((bn_bytecxx . . $ pvpgn/bn_byte# *)((char *)buffer + D2CHARSAVE_CLASS_OFFSET_109cxx . . $ `src/d2cs/d2charfile.h:31:9`!), chclass); |
| 78 | |
| 79 | // status (ladder, hardcore, expansion, etc) |
| 80 | bn_short_setcxx . . $ pvpgn/bn_short_set(d9a03b44e43bbca3).((bn_shortcxx . . $ pvpgn/bn_short# *)((char *)buffer + D2CHARSAVE_STATUS_OFFSET_109cxx . . $ `src/d2cs/d2charfile.h:32:9`!), status); |
| 81 | |
| 82 | // charname |
| 83 | stdcxx . . $ std/::memset(buffer + D2CHARSAVE_CHARNAME_OFFSET_109cxx . . $ `src/d2cs/d2charfile.h:33:9`!, '\0', MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.); // clear first |
| 84 | stdcxx . . $ std/::strncpy((char *)buffer + D2CHARSAVE_CHARNAME_OFFSET_109cxx . . $ `src/d2cs/d2charfile.h:33:9`!, charname, MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.); |
| 85 | stdcxx . . $ std/::memset(buffer + D2CHARSAVE_CHARNAME_OFFSET_109cxx . . $ `src/d2cs/d2charfile.h:33:9`! + MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN. - 1, '\0', 1); |
| 86 | |
| 87 | // checksum |
| 88 | checksum = d2charsave_checksumcxx . . $ pvpgn/d2charsave_checksum(eb174da03ea1718f).((unsigned char *)buffer, size, D2CHARSAVE_CHECKSUM_OFFSETcxx . . $ `src/common/d2char_checksum.h:21:9`!); |
| 89 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).((bn_intcxx . . $ pvpgn/bn_int# *)(buffer + D2CHARSAVE_CHECKSUM_OFFSETcxx . . $ `src/common/d2char_checksum.h:21:9`!), 0); // clear first |
| 90 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).((bn_intcxx . . $ pvpgn/bn_int# *)(buffer + D2CHARSAVE_CHECKSUM_OFFSETcxx . . $ `src/common/d2char_checksum.h:21:9`!), checksum); |
| 91 | |
| 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | |
| 96 | static int d2charinfo_initcxx . . $ pvpgn/d2cs/d2charinfo_init(2d928ea81497a866).(t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file# * chardata, char const * account, char const * charname, |
| 97 | unsigned char chclass, unsigned short status) |
| 98 | { |
| 99 | unsigned int i; |
| 100 | stdcxx . . $ std/::time_tcxx . . $ std/time_t# now; |
| 101 | |
| 102 | now = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 103 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..magicwordcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#magicword., D2CHARINFO_MAGICWORDcxx . . $ `src/common/d2cs_d2gs_character.h:31:9`!); |
| 104 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..versioncxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#version., D2CHARINFO_VERSIONcxx . . $ `src/common/d2cs_d2gs_character.h:32:9`!); |
| 105 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..create_timecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#create_time., now); |
| 106 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..last_timecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#last_time., now); |
| 107 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..total_play_timecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#total_play_time., 0); |
| 108 | |
| 109 | stdcxx . . $ std/::memset(chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..charnamecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#charname., 0, MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.); |
| 110 | stdcxx . . $ std/::strncpy((char*)chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..charnamecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#charname., charname, MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.); |
| 111 | stdcxx . . $ std/::memset(chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..accountcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#account., 0, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.); |
| 112 | stdcxx . . $ std/::strncpy((char*)chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..accountcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#account., account, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.); |
| 113 | stdcxx . . $ std/::memset(chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..realmnamecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#realmname., 0, MAX_REALMNAME_LENcxx . . $ MAX_REALMNAME_LEN.); |
| 114 | stdcxx . . $ std/::strncpy((char*)chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..realmnamecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#realmname., prefs_get_realmnamecxx . . $ pvpgn/d2cs/prefs_get_realmname(33a1f659e94feb42).(), MAX_REALMNAME_LENcxx . . $ MAX_REALMNAME_LEN.); |
| 115 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..checksumcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#checksum., 0); |
| 116 | for (i = 0; i < NELEMScxx . . $ `src/d2cs/setup.h:69:9`!(chardata->header.reserved); i++) { |
| 117 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..reservedcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#reserved.[i], 0); |
| 118 | } |
| 119 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..charlevelcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#charlevel., 1); |
| 120 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..experiencecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#experience., 0); |
| 121 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..charclasscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#charclass., chclass); |
| 122 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&chardata->summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..charstatuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#charstatus., status); |
| 123 | |
| 124 | stdcxx . . $ std/::memset(chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..gfxcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#gfx., D2CHARINFO_PORTRAIT_PADBYTEcxx . . $ `src/d2cs/d2charfile.h:41:9`!, sizeof(chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..gfxcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#gfx.)); |
| 125 | stdcxx . . $ std/::memset(chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..colorcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#color., D2CHARINFO_PORTRAIT_PADBYTEcxx . . $ `src/d2cs/d2charfile.h:41:9`!, sizeof(chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..colorcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#color.)); |
| 126 | stdcxx . . $ std/::memset(chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..u2cxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#u2., D2CHARINFO_PORTRAIT_PADBYTEcxx . . $ `src/d2cs/d2charfile.h:41:9`!, sizeof(chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..u2cxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#u2.)); |
| 127 | stdcxx . . $ std/::memset(chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..u1cxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#u1., D2CHARINFO_PORTRAIT_MASKcxx . . $ `src/d2cs/d2charfile.h:43:9`!, sizeof(chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..u1cxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#u1.)); |
| 128 | stdcxx . . $ std/::memset(chardata->padcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#pad., 0, sizeof(chardata->padcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#pad.)); |
| 129 | |
| 130 | bn_short_setcxx . . $ pvpgn/bn_short_set(d9a03b44e43bbca3).(&chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#header., D2CHARINFO_PORTRAIT_HEADERcxx . . $ `src/d2cs/d2charfile.h:42:9`!); |
| 131 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..statuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#status., status | D2CHARINFO_PORTRAIT_MASKcxx . . $ `src/d2cs/d2charfile.h:43:9`!); |
| 132 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..chclasscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#chclass., chclass + 1); |
| 133 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..levelcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#level., 1); |
| 134 | if (charstatus_get_laddercxx . . $ `src/d2cs/d2charfile.h:65:9`!(status)) |
| 135 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..laddercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#ladder., 1); |
| 136 | else |
| 137 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..laddercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#ladder., D2CHARINFO_PORTRAIT_PADBYTEcxx . . $ `src/d2cs/d2charfile.h:41:9`!); |
| 138 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&chardata->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..endcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#end., '\0'); |
| 139 | |
| 140 | stdcxx . . $ std/::memset(chardata->padcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#pad., 0, sizeof(chardata->padcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#pad.)); |
| 141 | |
| 142 | return 0; |
| 143 | } |
| 144 | |
| 145 | |
| 146 | extern int d2char_createcxx . . $ pvpgn/d2cs/d2char_create(c348fa9f1d8d7613).(char const * account, char const * charname, unsigned char chclass, unsigned short status) |
| 147 | { |
| 148 | t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file# chardata; |
| 149 | char * savefile, *infofile; |
| 150 | const char * newbiefile; |
| 151 | unsigned char buffer[MAX_SAVEFILE_SIZEcxx . . $ `src/d2cs/setup.h:71:9`!]; |
| 152 | unsigned int size; |
| 153 | unsigned int version; |
| 154 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fp; |
| 155 | |
| 156 | |
| 157 | int status_init = status; |
| 158 | |
| 159 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(account, -1); |
| 160 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 161 | if (chclass > D2CHAR_MAX_CLASScxx . . $ `src/d2cs/d2charfile.h:39:9`!) chclass = 0; |
| 162 | status &= D2CHARINFO_STATUS_FLAG_INIT_MASKcxx . . $ `src/d2cs/d2charfile.h:51:9`!; |
| 163 | charstatus_set_initcxx . . $ `src/d2cs/d2charfile.h:56:9`!(status, 1); |
| 164 | |
| 165 | /* We need to make sure we are creating the correct character (Classic or Expansion) |
| 166 | for the type of game server we are running. If lod_realm = 1 then only Expansion |
| 167 | characters can be created and if set to 0 then only Classic character can |
| 168 | be created */ |
| 169 | |
| 170 | if (!(prefs_get_lod_realmcxx . . $ pvpgn/d2cs/prefs_get_lod_realm(db52760e79bf9054).() == 2)) { |
| 171 | if (prefs_get_lod_realmcxx . . $ pvpgn/d2cs/prefs_get_lod_realm(db52760e79bf9054).() && ((status & 0x20) != 0x20)) { |
| 172 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "This Realm is for LOD Characters Only"); |
| 173 | return -1; |
| 174 | } |
| 175 | if (!prefs_get_lod_realmcxx . . $ pvpgn/d2cs/prefs_get_lod_realm(db52760e79bf9054).() && ((status & 0x20) != 0x0)) { |
| 176 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "This Realm is for Classic Characters Only"); |
| 177 | return -1; |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | /* Once correct type of character is varified then continue with creation of character */ |
| 182 | |
| 183 | if (!prefs_allow_newcharcxx . . $ pvpgn/d2cs/prefs_allow_newchar(db52760e79bf9054).()) { |
| 184 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "creation of new character is disabled"); |
| 185 | return -1; |
| 186 | } |
| 187 | if (d2char_check_charnamecxx . . $ pvpgn/d2cs/d2char_check_charname(5c4306d8553b3696).(charname) < 0) { |
| 188 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad character name \"{}\"", charname); |
| 189 | return -1; |
| 190 | } |
| 191 | if (d2char_check_acctnamecxx . . $ pvpgn/d2cs/d2char_check_acctname(5c4306d8553b3696).(account) < 0) { |
| 192 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad account name \"{}\"", account); |
| 193 | return -1; |
| 194 | } |
| 195 | |
| 196 | /* get character template file depending of it's class */ |
| 197 | switch ((t_character_classcxx . . $ pvpgn/d2cs/t_character_class#)chclass) |
| 198 | { |
| 199 | case character_class_amazoncxx . . $ pvpgn/d2cs/character_class_amazon.: |
| 200 | newbiefile = prefs_get_charsave_newbie_amazoncxx . . $ pvpgn/d2cs/prefs_get_charsave_newbie_amazon(33a1f659e94feb42).(); |
| 201 | break; |
| 202 | case character_class_sorceresscxx . . $ pvpgn/d2cs/character_class_sorceress.: |
| 203 | newbiefile = prefs_get_charsave_newbie_sorceresscxx . . $ pvpgn/d2cs/prefs_get_charsave_newbie_sorceress(33a1f659e94feb42).(); |
| 204 | break; |
| 205 | case character_class_necromancercxx . . $ pvpgn/d2cs/character_class_necromancer.: |
| 206 | newbiefile = prefs_get_charsave_newbie_necromancercxx . . $ pvpgn/d2cs/prefs_get_charsave_newbie_necromancer(33a1f659e94feb42).(); |
| 207 | break; |
| 208 | case character_class_paladincxx . . $ pvpgn/d2cs/character_class_paladin.: |
| 209 | newbiefile = prefs_get_charsave_newbie_paladincxx . . $ pvpgn/d2cs/prefs_get_charsave_newbie_paladin(33a1f659e94feb42).(); |
| 210 | break; |
| 211 | case character_class_barbariancxx . . $ pvpgn/d2cs/character_class_barbarian.: |
| 212 | newbiefile = prefs_get_charsave_newbie_barbariancxx . . $ pvpgn/d2cs/prefs_get_charsave_newbie_barbarian(33a1f659e94feb42).(); |
| 213 | break; |
| 214 | case character_class_druidcxx . . $ pvpgn/d2cs/character_class_druid.: |
| 215 | newbiefile = prefs_get_charsave_newbie_druidcxx . . $ pvpgn/d2cs/prefs_get_charsave_newbie_druid(33a1f659e94feb42).(); |
| 216 | break; |
| 217 | case character_class_assassincxx . . $ pvpgn/d2cs/character_class_assassin.: |
| 218 | newbiefile = prefs_get_charsave_newbie_assasincxx . . $ pvpgn/d2cs/prefs_get_charsave_newbie_assasin(33a1f659e94feb42).(); |
| 219 | break; |
| 220 | } |
| 221 | |
| 222 | size = sizeof(buffer); |
| 223 | if (file_readcxx . . $ pvpgn/d2cs/file_read(9ad435d3417d65ba).(newbiefile, buffer, &size) < 0) { |
| 224 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error loading newbie save file"); |
| 225 | return -1; |
| 226 | } |
| 227 | if (size >= sizeof(buffer)) { |
| 228 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "newbie save file \"{}\" is corrupt (length {}, expected <{})", newbiefile, (unsigned long)size, (unsigned long)sizeof(buffer)); |
| 229 | return -1; |
| 230 | } |
| 231 | |
| 232 | savefile = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_charsave_dir()) + 1 + std::strlen(charname) + 1); |
| 233 | d2char_get_savefile_namecxx . . $ pvpgn/d2cs/d2char_get_savefile_name(e4809bc172bbfbe1).(savefile, charname); |
| 234 | if ((fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(savefile, "rb"))) { |
| 235 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "character save file \"{}\" for \"{}\" already exist", savefile, charname); |
| 236 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 237 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(savefile); |
| 238 | return -1; |
| 239 | } |
| 240 | |
| 241 | infofile = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_charinfo_dir()) + 1 + std::strlen(account) + 1 + std::strlen(charname) + 1); |
| 242 | d2char_get_infofile_namecxx . . $ pvpgn/d2cs/d2char_get_infofile_name(eea3c0012f596317).(infofile, account, charname); |
| 243 | |
| 244 | stdcxx . . $ std/::time_tcxx . . $ std/time_t# now = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(nullptr); |
| 245 | stdcxx . . $ std/::time_tcxx . . $ std/time_t# ladder_time = prefs_get_ladder_start_timecxx . . $ pvpgn/d2cs/prefs_get_ladder_start_time(da6335ded91d79c2).(); |
| 246 | if ((ladder_time > 0) && (now < ladder_time)) |
| 247 | charstatus_set_laddercxx . . $ `src/d2cs/d2charfile.h:58:9`!(status, 0); |
| 248 | |
| 249 | /* create from newbie.save or normal d2s template? */ |
| 250 | version = bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(buffer + D2CHARSAVE_VERSION_OFFSETcxx . . $ `src/d2cs/d2charfile.h:22:9`!); |
| 251 | if (version >= 0x0000005C) |
| 252 | d2charsave_init_from_d2scxx . . $ pvpgn/d2cs/d2charsave_init_from_d2s(58a8bfa786bd2fa4).(buffer, charname, chclass, status_init, size); |
| 253 | else |
| 254 | d2charsave_initcxx . . $ pvpgn/d2cs/d2charsave_init(ce7c83014af972c1).(buffer, charname, chclass, status); |
| 255 | |
| 256 | d2charinfo_initcxx . . $ pvpgn/d2cs/d2charinfo_init(2d928ea81497a866).(&chardata, account, charname, chclass, status); |
| 257 | |
| 258 | if (file_writecxx . . $ pvpgn/d2cs/file_write(a1a540be165300a2).(infofile, &chardata, sizeof(chardata)) < 0) { |
| 259 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error writing info file \"{}\"", infofile); |
| 260 | stdcxx . . $ std/::removecxx . . $ std/remove(f5ecf3191ed0cd93).(infofile); |
| 261 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(infofile); |
| 262 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(savefile); |
| 263 | return -1; |
| 264 | } |
| 265 | |
| 266 | if (file_writecxx . . $ pvpgn/d2cs/file_write(a1a540be165300a2).(savefile, buffer, size) < 0) { |
| 267 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error writing save file \"{}\"", savefile); |
| 268 | stdcxx . . $ std/::removecxx . . $ std/remove(f5ecf3191ed0cd93).(infofile); |
| 269 | stdcxx . . $ std/::removecxx . . $ std/remove(f5ecf3191ed0cd93).(savefile); |
| 270 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(savefile); |
| 271 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(infofile); |
| 272 | return -1; |
| 273 | } |
| 274 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(savefile); |
| 275 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(infofile); |
| 276 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "character {}(*{}) class {} status 0x{:X} created", charname, account, chclass, status); |
| 277 | return 0; |
| 278 | } |
| 279 | |
| 280 | |
| 281 | extern int d2char_findcxx . . $ pvpgn/d2cs/d2char_find(5ae29d726ae57f88).(char const * account, char const * charname) |
| 282 | { |
| 283 | char * file; |
| 284 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fp; |
| 285 | |
| 286 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(account, -1); |
| 287 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 288 | file = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_charinfo_dir()) + 1 + std::strlen(account) + 1 + std::strlen(charname) + 1); |
| 289 | d2char_get_infofile_namecxx . . $ pvpgn/d2cs/d2char_get_infofile_name(eea3c0012f596317).(file, account, charname); |
| 290 | fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(file, "rb"); |
| 291 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 292 | if (fp) { |
| 293 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 294 | return 0; |
| 295 | } |
| 296 | return -1; |
| 297 | } |
| 298 | |
| 299 | |
| 300 | extern int d2char_convertcxx . . $ pvpgn/d2cs/d2char_convert(5ae29d726ae57f88).(char const * account, char const * charname) |
| 301 | { |
| 302 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fp; |
| 303 | char * file; |
| 304 | unsigned char buffer[MAX_SAVEFILE_SIZEcxx . . $ `src/d2cs/setup.h:71:9`!]; |
| 305 | unsigned int status_offset; |
| 306 | unsigned char status; |
| 307 | unsigned int charstatus; |
| 308 | t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file# charinfo; |
| 309 | unsigned int size; |
| 310 | unsigned int version; |
| 311 | unsigned int checksum; |
| 312 | |
| 313 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(account, -1); |
| 314 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 315 | |
| 316 | /* Playing with a expanstion char on a classic realm |
| 317 | will cause the game server to crash, therefore |
| 318 | I recommed setting allow_convert = 0 in the d2cs.conf |
| 319 | We need to do this to prevent creating classic char |
| 320 | and converting to expantion on a classic realm. |
| 321 | LOD Char must be created on LOD realm */ |
| 322 | |
| 323 | if (!prefs_get_allow_convertcxx . . $ pvpgn/d2cs/prefs_get_allow_convert(db52760e79bf9054).()) { |
| 324 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "Convert char has been disabled"); |
| 325 | return -1; |
| 326 | } |
| 327 | |
| 328 | /* Procedure is stopped here and returned if |
| 329 | allow_convet = 0 in d2cs.conf */ |
| 330 | |
| 331 | if (d2char_check_charnamecxx . . $ pvpgn/d2cs/d2char_check_charname(5c4306d8553b3696).(charname) < 0) { |
| 332 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad character name \"{}\"", charname); |
| 333 | return -1; |
| 334 | } |
| 335 | if (d2char_check_acctnamecxx . . $ pvpgn/d2cs/d2char_check_acctname(5c4306d8553b3696).(account) < 0) { |
| 336 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad account name \"{}\"", account); |
| 337 | return -1; |
| 338 | } |
| 339 | file = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_charinfo_dir()) + 1 + std::strlen(account) + 1 + std::strlen(charname) + 1); |
| 340 | d2char_get_infofile_namecxx . . $ pvpgn/d2cs/d2char_get_infofile_name(eea3c0012f596317).(file, account, charname); |
| 341 | if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(file, "rb+"))) { |
| 342 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "unable to open charinfo file \"{}\" for reading and writing (std::fopen: {})", file, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 343 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 344 | return -1; |
| 345 | } |
| 346 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 347 | if (stdcxx . . $ std/::freadcxx . . $ std/fread(738fc8ac1d711e58).(&charinfo, 1, sizeof(charinfo), fp) != sizeof(charinfo)) { |
| 348 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error reading charinfo file for character \"{}\" (std::fread: {})", charname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 349 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 350 | return -1; |
| 351 | } |
| 352 | charstatus = bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(charinfo.summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..charstatuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#charstatus.); |
| 353 | charstatus_set_expansioncxx . . $ `src/d2cs/d2charfile.h:57:9`!(charstatus, 1); |
| 354 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&charinfo.summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..charstatuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#charstatus., charstatus); |
| 355 | |
| 356 | status = bn_byte_getcxx . . $ pvpgn/bn_byte_get(f3688bc2ee54ea05).(charinfo.portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..statuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#status.); |
| 357 | charstatus_set_expansioncxx . . $ `src/d2cs/d2charfile.h:57:9`!(status, 1); |
| 358 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&charinfo.portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..statuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#status., status); |
| 359 | |
| 360 | stdcxx . . $ std/::fseekcxx . . $ std/fseek(543fae30d249f6b1).(fp, 0, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!); /* FIXME: check return */ |
| 361 | if (stdcxx . . $ std/::fwritecxx . . $ std/fwrite(ab0609fa07c47d6e).(&charinfo, 1, sizeof(charinfo), fp) != sizeof(charinfo)) { |
| 362 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error writing charinfo file for character \"{}\" (std::fwrite: {})", charname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 363 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 364 | return -1; |
| 365 | } |
| 366 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) { |
| 367 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not close charinfo file for character \"{}\" after writing (std::fclose: {})", charname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 368 | return -1; |
| 369 | } |
| 370 | |
| 371 | file = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_charsave_dir()) + 1 + std::strlen(charname) + 1); |
| 372 | d2char_get_savefile_namecxx . . $ pvpgn/d2cs/d2char_get_savefile_name(e4809bc172bbfbe1).(file, charname); |
| 373 | if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(file, "rb+"))) { |
| 374 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not open charsave file \"{}\" for reading and writing (std::fopen: {})", file, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 375 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 376 | return -1; |
| 377 | } |
| 378 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 379 | size = stdcxx . . $ std/::freadcxx . . $ std/fread(738fc8ac1d711e58).(buffer, 1, sizeof(buffer), fp); |
| 380 | if (!stdcxx . . $ std/::feofcxx . . $ std/feof(7a688d7338757b98).(fp)) { |
| 381 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error reading charsave file for character \"{}\" (std::fread: {})", charname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 382 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 383 | return -1; |
| 384 | } |
| 385 | version = bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(buffer + D2CHARSAVE_VERSION_OFFSETcxx . . $ `src/d2cs/d2charfile.h:22:9`!); |
| 386 | if (version >= 0x0000005C) { |
| 387 | status_offset = D2CHARSAVE_STATUS_OFFSET_109cxx . . $ `src/d2cs/d2charfile.h:32:9`!; |
| 388 | } |
| 389 | else { |
| 390 | status_offset = D2CHARSAVE_STATUS_OFFSETcxx . . $ `src/d2cs/d2charfile.h:26:9`!; |
| 391 | } |
| 392 | status = bn_byte_getcxx . . $ pvpgn/bn_byte_get(f3688bc2ee54ea05).(buffer + status_offset); |
| 393 | charstatus_set_expansioncxx . . $ `src/d2cs/d2charfile.h:57:9`!(status, 1); |
| 394 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).((bn_bytecxx . . $ pvpgn/bn_byte# *)(buffer + status_offset), status); /* FIXME: shouldn't abuse bn_*_set()... what's the best way to do this? */ |
| 395 | if (version >= 0x0000005C) { |
| 396 | checksum = d2charsave_checksumcxx . . $ pvpgn/d2charsave_checksum(eb174da03ea1718f).(buffer, size, D2CHARSAVE_CHECKSUM_OFFSETcxx . . $ `src/common/d2char_checksum.h:21:9`!); |
| 397 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).((bn_intcxx . . $ pvpgn/bn_int# *)(buffer + D2CHARSAVE_CHECKSUM_OFFSETcxx . . $ `src/common/d2char_checksum.h:21:9`!), checksum); /* FIXME: shouldn't abuse bn_*_set()... what's the best way to do this? */ |
| 398 | } |
| 399 | stdcxx . . $ std/::fseekcxx . . $ std/fseek(543fae30d249f6b1).(fp, 0, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!); /* FIXME: check return */ |
| 400 | if (stdcxx . . $ std/::fwritecxx . . $ std/fwrite(ab0609fa07c47d6e).(buffer, 1, size, fp) != size) { |
| 401 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error writing charsave file for character {} (std::fwrite: {})", charname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 402 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 403 | return -1; |
| 404 | } |
| 405 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) { |
| 406 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not close charsave file for character \"{}\" after writing (std::fclose: {})", charname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 407 | return -1; |
| 408 | } |
| 409 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "character {}(*{}) converted to expansion", charname, account); |
| 410 | return 0; |
| 411 | } |
| 412 | |
| 413 | |
| 414 | extern int d2char_deletecxx . . $ pvpgn/d2cs/d2char_delete(5ae29d726ae57f88).(char const * account, char const * charname) |
| 415 | { |
| 416 | char * file; |
| 417 | |
| 418 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(account, -1); |
| 419 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 420 | if (d2char_check_charnamecxx . . $ pvpgn/d2cs/d2char_check_charname(5c4306d8553b3696).(charname) < 0) { |
| 421 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad character name \"{}\"", charname); |
| 422 | return -1; |
| 423 | } |
| 424 | if (d2char_check_acctnamecxx . . $ pvpgn/d2cs/d2char_check_acctname(5c4306d8553b3696).(account) < 0) { |
| 425 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad account name \"{}\"", account); |
| 426 | return -1; |
| 427 | } |
| 428 | |
| 429 | /* charsave file */ |
| 430 | file = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_charinfo_dir()) + 1 + std::strlen(account) + 1 + std::strlen(charname) + 1); |
| 431 | d2char_get_infofile_namecxx . . $ pvpgn/d2cs/d2char_get_infofile_name(eea3c0012f596317).(file, account, charname); |
| 432 | if (stdcxx . . $ std/::removecxx . . $ std/remove(f5ecf3191ed0cd93).(file) < 0) { |
| 433 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "failed to delete charinfo file \"{}\" (std::remove: {})", file, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 434 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 435 | return -1; |
| 436 | } |
| 437 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 438 | |
| 439 | /* charinfo file */ |
| 440 | file = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_charsave_dir()) + 1 + std::strlen(charname) + 1); |
| 441 | d2char_get_savefile_namecxx . . $ pvpgn/d2cs/d2char_get_savefile_name(e4809bc172bbfbe1).(file, charname); |
| 442 | if (stdcxx . . $ std/::removecxx . . $ std/remove(f5ecf3191ed0cd93).(file) < 0) { |
| 443 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "failed to delete charsave file \"{}\" (std::remove: {})", file, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 444 | } |
| 445 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 446 | |
| 447 | /* bak charsave file */ |
| 448 | file = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_bak_charinfo_dir()) + 1 + std::strlen(account) + 1 + std::strlen(charname) + 1); |
| 449 | d2char_get_bak_infofile_namecxx . . $ pvpgn/d2cs/d2char_get_bak_infofile_name(eea3c0012f596317).(file, account, charname); |
| 450 | if (access(file, F_OKcxx . . $ `<external>/12628407106812493757/unistd.h:284:9`!) == 0) { |
| 451 | if (stdcxx . . $ std/::removecxx . . $ std/remove(f5ecf3191ed0cd93).(file) < 0) { |
| 452 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "failed to delete bak charinfo file \"{}\" (std::remove: {})", file, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 453 | } |
| 454 | } |
| 455 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 456 | |
| 457 | /* bak charinfo file */ |
| 458 | file = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_bak_charsave_dir()) + 1 + std::strlen(charname) + 1); |
| 459 | d2char_get_bak_savefile_namecxx . . $ pvpgn/d2cs/d2char_get_bak_savefile_name(e4809bc172bbfbe1).(file, charname); |
| 460 | if (access(file, F_OKcxx . . $ `<external>/12628407106812493757/unistd.h:284:9`!) == 0) { |
| 461 | if (stdcxx . . $ std/::removecxx . . $ std/remove(f5ecf3191ed0cd93).(file) < 0) { |
| 462 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "failed to delete bak charsave file \"{}\" (std::remove: {})", file, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 463 | } |
| 464 | } |
| 465 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 466 | |
| 467 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "character {}(*{}) deleted", charname, account); |
| 468 | return 0; |
| 469 | } |
| 470 | |
| 471 | |
| 472 | extern int d2char_get_summarycxx . . $ pvpgn/d2cs/d2char_get_summary(241dab12521a2f8b).(char const * account, char const * charname, t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# * charinfo) |
| 473 | { |
| 474 | t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file# data; |
| 475 | |
| 476 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(account, -1); |
| 477 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 478 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charinfo, -1); |
| 479 | if (d2charinfo_loadcxx . . $ pvpgn/d2cs/d2charinfo_load(aca657f4e6b90ade).(account, charname, &data) < 0) { |
| 480 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error loading character {}(*{})", charname, account); |
| 481 | return -1; |
| 482 | } |
| 483 | stdcxx . . $ std/::memcpy(charinfo, &data.summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary., sizeof(data.summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary.)); |
| 484 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "character {} difficulty {} expansion {} hardcore {} dead {} loaded", charname, |
| 485 | d2charinfo_get_difficultycxx . . $ pvpgn/d2cs/d2charinfo_get_difficulty(cae5a827379a95b4).(charinfo), d2charinfo_get_expansioncxx . . $ pvpgn/d2cs/d2charinfo_get_expansion(cae5a827379a95b4).(charinfo), |
| 486 | d2charinfo_get_hardcorecxx . . $ pvpgn/d2cs/d2charinfo_get_hardcore(cae5a827379a95b4).(charinfo), d2charinfo_get_deadcxx . . $ pvpgn/d2cs/d2charinfo_get_dead(cae5a827379a95b4).(charinfo)); |
| 487 | return 0; |
| 488 | } |
| 489 | |
| 490 | |
| 491 | extern int d2charinfo_loadcxx . . $ pvpgn/d2cs/d2charinfo_load(aca657f4e6b90ade).(char const * account, char const * charname, t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file# * data) |
| 492 | { |
| 493 | char * file; |
| 494 | int size; |
| 495 | |
| 496 | if (d2char_check_charnamecxx . . $ pvpgn/d2cs/d2char_check_charname(5c4306d8553b3696).(charname) < 0) { |
| 497 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad character name \"{}\"", charname); |
| 498 | return -1; |
| 499 | } |
| 500 | if (d2char_check_acctnamecxx . . $ pvpgn/d2cs/d2char_check_acctname(5c4306d8553b3696).(account) < 0) { |
| 501 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad account name \"{}\"", account); |
| 502 | return -1; |
| 503 | } |
| 504 | file = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_charinfo_dir()) + 1 + std::strlen(account) + 1 + std::strlen(charname) + 1); |
| 505 | d2char_get_infofile_namecxx . . $ pvpgn/d2cs/d2char_get_infofile_name(eea3c0012f596317).(file, account, charname); |
| 506 | size = sizeof(t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file#); |
| 507 | if (file_readcxx . . $ pvpgn/d2cs/file_read(9ad435d3417d65ba).(file, data, (unsigned int*)&size) < 0) { |
| 508 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error loading character file {}", file); |
| 509 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 510 | return -1; |
| 511 | } |
| 512 | if (size != sizeof(t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file#)) { |
| 513 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad charinfo file {} (length {})", charname, size); |
| 514 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 515 | return -1; |
| 516 | } |
| 517 | d2char_portrait_initcxx . . $ pvpgn/d2cs/d2char_portrait_init(b390b41629cb07d5).(&data->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait.); |
| 518 | if (d2charinfo_checkcxx . . $ pvpgn/d2cs/d2charinfo_check(26bd541493669eb).(data) < 0) { |
| 519 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 520 | return -1; |
| 521 | } |
| 522 | if (!(charstatus_get_laddercxx . . $ `src/d2cs/d2charfile.h:65:9`!(bn_int_get(data->summary.charstatus)))) { |
| 523 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&data->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..laddercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#ladder., D2CHARINFO_PORTRAIT_PADBYTEcxx . . $ `src/d2cs/d2charfile.h:41:9`!); |
| 524 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 525 | return 0; |
| 526 | } |
| 527 | unsigned int ladder_time = prefs_get_ladder_start_timecxx . . $ pvpgn/d2cs/prefs_get_ladder_start_time(da6335ded91d79c2).(); |
| 528 | if ((ladder_time > 0) && bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(data->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..create_timecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#create_time.) < ladder_time) { |
| 529 | char buffer[MAX_SAVEFILE_SIZEcxx . . $ `src/d2cs/setup.h:71:9`!]; |
| 530 | unsigned int status_offset; |
| 531 | unsigned char status; |
| 532 | unsigned int charstatus; |
| 533 | unsigned int size; |
| 534 | unsigned int version; |
| 535 | unsigned int checksum; |
| 536 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fp; |
| 537 | |
| 538 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "{}(*{}) was created in old ladder season, set to non-ladder", charname, account); |
| 539 | if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(file, "wb"))) { |
| 540 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "charinfo file \"{}\" does not exist for account \"{}\"", file, account); |
| 541 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 542 | return 0; |
| 543 | } |
| 544 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 545 | charstatus = bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(data->summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..charstatuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#charstatus.); |
| 546 | charstatus_set_laddercxx . . $ `src/d2cs/d2charfile.h:58:9`!(charstatus, 0); |
| 547 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).(&data->summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..charstatuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#charstatus., charstatus); |
| 548 | |
| 549 | status = bn_byte_getcxx . . $ pvpgn/bn_byte_get(f3688bc2ee54ea05).(data->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..statuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#status.); |
| 550 | charstatus_set_laddercxx . . $ `src/d2cs/d2charfile.h:58:9`!(status, 0); |
| 551 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&data->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..statuscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#status., status); |
| 552 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&data->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..laddercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#ladder., D2CHARINFO_PORTRAIT_PADBYTEcxx . . $ `src/d2cs/d2charfile.h:41:9`!); |
| 553 | |
| 554 | if (stdcxx . . $ std/::fwritecxx . . $ std/fwrite(ab0609fa07c47d6e).(data, 1, sizeof(*data), fp) != sizeof(*data)) { |
| 555 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error writing charinfo file for character \"{}\" (std::fwrite: {})", charname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 556 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 557 | return 0; |
| 558 | } |
| 559 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 560 | |
| 561 | file = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(prefs_get_charsave_dir()) + 1 + std::strlen(charname) + 1); |
| 562 | d2char_get_savefile_namecxx . . $ pvpgn/d2cs/d2char_get_savefile_name(e4809bc172bbfbe1).(file, charname); |
| 563 | |
| 564 | if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(file, "rb+"))) { |
| 565 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not open charsave file \"{}\" for reading and writing (std::fopen: {})", file, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 566 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 567 | return 0; |
| 568 | } |
| 569 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 570 | size = stdcxx . . $ std/::freadcxx . . $ std/fread(738fc8ac1d711e58).(buffer, 1, sizeof(buffer), fp); |
| 571 | if (!stdcxx . . $ std/::feofcxx . . $ std/feof(7a688d7338757b98).(fp)) { |
| 572 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error reading charsave file for character \"{}\" (std::fread: {})", charname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 573 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 574 | return 0; |
| 575 | } |
| 576 | version = bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).((bn_basiccxx . . $ pvpgn/bn_basic#*)(buffer + D2CHARSAVE_VERSION_OFFSETcxx . . $ `src/d2cs/d2charfile.h:22:9`!)); |
| 577 | if (version >= 0x5C) { |
| 578 | status_offset = D2CHARSAVE_STATUS_OFFSET_109cxx . . $ `src/d2cs/d2charfile.h:32:9`!; |
| 579 | } |
| 580 | else { |
| 581 | status_offset = D2CHARSAVE_STATUS_OFFSETcxx . . $ `src/d2cs/d2charfile.h:26:9`!; |
| 582 | } |
| 583 | status = bn_byte_getcxx . . $ pvpgn/bn_byte_get(f3688bc2ee54ea05).((bn_basiccxx . . $ pvpgn/bn_basic#*)(buffer + status_offset)); |
| 584 | charstatus_set_laddercxx . . $ `src/d2cs/d2charfile.h:58:9`!(status, 0); |
| 585 | /* FIXME: shouldn't abuse bn_*_set()... what's the best way to do this? */ |
| 586 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).((bn_bytecxx . . $ pvpgn/bn_byte# *)(buffer + status_offset), status); |
| 587 | if (version >= 0x5C) { |
| 588 | checksum = d2charsave_checksumcxx . . $ pvpgn/d2charsave_checksum(eb174da03ea1718f).((unsigned char*)buffer, size, D2CHARSAVE_CHECKSUM_OFFSETcxx . . $ `src/common/d2char_checksum.h:21:9`!); |
| 589 | bn_int_setcxx . . $ pvpgn/bn_int_set(e97e500db3ec3c79).((bn_intcxx . . $ pvpgn/bn_int# *)(buffer + D2CHARSAVE_CHECKSUM_OFFSETcxx . . $ `src/common/d2char_checksum.h:21:9`!), checksum); |
| 590 | } |
| 591 | stdcxx . . $ std/::fseekcxx . . $ std/fseek(543fae30d249f6b1).(fp, 0, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!); |
| 592 | if (stdcxx . . $ std/::fwritecxx . . $ std/fwrite(ab0609fa07c47d6e).(buffer, 1, size, fp) != size) { |
| 593 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error writing charsave file for character {} (std::fwrite: {})", charname, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 594 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 595 | return 0; |
| 596 | } |
| 597 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 598 | } |
| 599 | else { |
| 600 | bn_byte_setcxx . . $ pvpgn/bn_byte_set(9656657e14223459).(&data->portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait..laddercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_2#ladder., 1); |
| 601 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(file); |
| 602 | } |
| 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | extern int d2charinfo_checkcxx . . $ pvpgn/d2cs/d2charinfo_check(26bd541493669eb).(t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file# * data) |
| 607 | { |
| 608 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(data, -1); |
| 609 | if (bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(data->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..magicwordcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#magicword.) != D2CHARINFO_MAGICWORDcxx . . $ `src/common/d2cs_d2gs_character.h:31:9`!) { |
| 610 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "info data check failed (header 0x{:08X})", bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(data->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..magicwordcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#magicword.)); |
| 611 | return -1; |
| 612 | } |
| 613 | if (bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(data->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..versioncxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#version.) != D2CHARINFO_VERSIONcxx . . $ `src/common/d2cs_d2gs_character.h:32:9`!) { |
| 614 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "info data check failed (version 0x{:08X})", bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(data->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..versioncxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#version.)); |
| 615 | return -1; |
| 616 | } |
| 617 | return 0; |
| 618 | } |
| 619 | |
| 620 | |
| 621 | extern int d2char_portrait_initcxx . . $ pvpgn/d2cs/d2char_portrait_init(b390b41629cb07d5).(t_d2charinfo_portraitcxx . . $ pvpgn/t_d2charinfo_portrait# * portrait) |
| 622 | { |
| 623 | unsigned int i; |
| 624 | unsigned char * p; |
| 625 | |
| 626 | p = (unsigned char *)portrait; |
| 627 | for (i = 0; i < sizeof(t_d2charinfo_portraitcxx . . $ pvpgn/t_d2charinfo_portrait#); i++) { |
| 628 | if (!p[i]) p[i] = D2CHARINFO_PORTRAIT_PADBYTEcxx . . $ `src/d2cs/d2charfile.h:41:9`!; |
| 629 | } |
| 630 | p[i - 1] = '\0'; |
| 631 | return 0; |
| 632 | } |
| 633 | |
| 634 | |
| 635 | extern int d2char_get_portraitcxx . . $ pvpgn/d2cs/d2char_get_portrait(cb6ab3b2d7223f38).(char const * account, char const * charname, t_d2charinfo_portraitcxx . . $ pvpgn/t_d2charinfo_portrait# * portrait) |
| 636 | { |
| 637 | t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file# data; |
| 638 | |
| 639 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 640 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(account, -1); |
| 641 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(portrait, -1); |
| 642 | if (d2charinfo_loadcxx . . $ pvpgn/d2cs/d2charinfo_load(aca657f4e6b90ade).(account, charname, &data) < 0) { |
| 643 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error loading character {}(*{})", charname, account); |
| 644 | return -1; |
| 645 | } |
| 646 | stdcxx . . $ std/::strcpy((char *)portrait, (char *)&data.portraitcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#portrait.); |
| 647 | return 0; |
| 648 | } |
| 649 | |
| 650 | |
| 651 | extern int d2char_check_charnamecxx . . $ pvpgn/d2cs/d2char_check_charname(5c4306d8553b3696).(char const * name) |
| 652 | { |
| 653 | unsigned int i; |
| 654 | unsigned char ch; |
| 655 | |
| 656 | if (!name) return -1; |
| 657 | if (!stdcxx . . $ std/::isalphacxx . . $ std/isalpha(a1851578aea3f541).((int)name[0])) return -1; |
| 658 | |
| 659 | for (i = 1; i <= MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.; i++) { |
| 660 | ch = name[i]; |
| 661 | if (ch == '\0') break; |
| 662 | if (stdcxx . . $ std/::isalphacxx . . $ std/isalpha(a1851578aea3f541).(ch)) continue; |
| 663 | if (ch == '-') continue; |
| 664 | if (ch == '_') continue; |
| 665 | if (ch == '.') continue; |
| 666 | return -1; |
| 667 | } |
| 668 | if (i >= MIN_CHARNAME_LENcxx . . $ MIN_CHARNAME_LEN. || i <= MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.) return 0; |
| 669 | return -1; |
| 670 | } |
| 671 | |
| 672 | |
| 673 | extern int d2char_check_acctnamecxx . . $ pvpgn/d2cs/d2char_check_acctname(5c4306d8553b3696).(char const * name) |
| 674 | { |
| 675 | unsigned int i; |
| 676 | unsigned char ch; |
| 677 | |
| 678 | if (!name) return -1; |
| 679 | if (!stdcxx . . $ std/::isalnumcxx . . $ std/isalnum(a1851578aea3f541).((unsigned char)name[0])) return -1; |
| 680 | |
| 681 | for (i = 1; i <= MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.; i++) { |
| 682 | ch = name[i]; |
| 683 | if (ch == '\0') break; |
| 684 | if (stdcxx . . $ std/::isalnumcxx . . $ std/isalnum(a1851578aea3f541).(ch)) continue; |
| 685 | if (stdcxx . . $ std/::strchr(prefs_get_d2cs_account_allowed_symbolscxx . . $ pvpgn/d2cs/prefs_get_d2cs_account_allowed_symbols(33a1f659e94feb42).(), ch)) continue; |
| 686 | return -1; |
| 687 | } |
| 688 | if (i >= MIN_USERNAME_LENcxx . . $ MIN_USERNAME_LEN. || i <= MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.) return 0; |
| 689 | return -1; |
| 690 | } |
| 691 | |
| 692 | |
| 693 | extern int d2char_get_savefile_namecxx . . $ pvpgn/d2cs/d2char_get_savefile_name(e4809bc172bbfbe1).(char * filename, char const * charname) |
| 694 | { |
| 695 | char tmpchar[MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.]; |
| 696 | |
| 697 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(filename, -1); |
| 698 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 699 | stdcxx . . $ std/::strncpy(tmpchar, charname, sizeof(tmpchar)); |
| 700 | tmpchar[sizeof(tmpchar)-1] = '\0'; |
| 701 | strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(tmpchar); |
| 702 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(filename, "%s/%s", prefs_get_charsave_dircxx . . $ pvpgn/d2cs/prefs_get_charsave_dir(33a1f659e94feb42).(), tmpchar); |
| 703 | return 0; |
| 704 | } |
| 705 | |
| 706 | |
| 707 | extern int d2char_get_bak_savefile_namecxx . . $ pvpgn/d2cs/d2char_get_bak_savefile_name(e4809bc172bbfbe1).(char * filename, char const * charname) |
| 708 | { |
| 709 | char tmpchar[MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.]; |
| 710 | |
| 711 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(filename, -1); |
| 712 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 713 | stdcxx . . $ std/::strncpy(tmpchar, charname, sizeof(tmpchar)); |
| 714 | tmpchar[sizeof(tmpchar)-1] = '\0'; |
| 715 | strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(tmpchar); |
| 716 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(filename, "%s/%s", prefs_get_bak_charsave_dircxx . . $ pvpgn/d2cs/prefs_get_bak_charsave_dir(33a1f659e94feb42).(), tmpchar); |
| 717 | return 0; |
| 718 | } |
| 719 | |
| 720 | |
| 721 | extern int d2char_get_infodir_namecxx . . $ pvpgn/d2cs/d2char_get_infodir_name(e4809bc172bbfbe1).(char * filename, char const * account) |
| 722 | { |
| 723 | char tmpacct[MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.]; |
| 724 | |
| 725 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(filename, -1); |
| 726 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(account, -1); |
| 727 | |
| 728 | stdcxx . . $ std/::strncpy(tmpacct, account, sizeof(tmpacct)); |
| 729 | tmpacct[sizeof(tmpacct)-1] = '\0'; |
| 730 | strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(tmpacct); |
| 731 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(filename, "%s/%s", prefs_get_charinfo_dircxx . . $ pvpgn/d2cs/prefs_get_charinfo_dir(33a1f659e94feb42).(), tmpacct); |
| 732 | return 0; |
| 733 | } |
| 734 | |
| 735 | |
| 736 | extern int d2char_get_infofile_namecxx . . $ pvpgn/d2cs/d2char_get_infofile_name(eea3c0012f596317).(char * filename, char const * account, char const * charname) |
| 737 | { |
| 738 | char tmpchar[MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.]; |
| 739 | char tmpacct[MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.]; |
| 740 | |
| 741 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(filename, -1); |
| 742 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(account, -1); |
| 743 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 744 | stdcxx . . $ std/::strncpy(tmpchar, charname, sizeof(tmpchar)); |
| 745 | tmpchar[sizeof(tmpchar)-1] = '\0'; |
| 746 | strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(tmpchar); |
| 747 | |
| 748 | stdcxx . . $ std/::strncpy(tmpacct, account, sizeof(tmpacct)); |
| 749 | tmpchar[sizeof(tmpacct)-1] = '\0'; |
| 750 | strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(tmpacct); |
| 751 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(filename, "%s/%s/%s", prefs_get_charinfo_dircxx . . $ pvpgn/d2cs/prefs_get_charinfo_dir(33a1f659e94feb42).(), tmpacct, tmpchar); |
| 752 | return 0; |
| 753 | } |
| 754 | |
| 755 | |
| 756 | extern int d2char_get_bak_infofile_namecxx . . $ pvpgn/d2cs/d2char_get_bak_infofile_name(eea3c0012f596317).(char * filename, char const * account, char const * charname) |
| 757 | { |
| 758 | char tmpchar[MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.]; |
| 759 | char tmpacct[MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.]; |
| 760 | |
| 761 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(filename, -1); |
| 762 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(account, -1); |
| 763 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charname, -1); |
| 764 | stdcxx . . $ std/::strncpy(tmpchar, charname, sizeof(tmpchar)); |
| 765 | tmpchar[sizeof(tmpchar)-1] = '\0'; |
| 766 | strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(tmpchar); |
| 767 | |
| 768 | stdcxx . . $ std/::strncpy(tmpacct, account, sizeof(tmpacct)); |
| 769 | tmpchar[sizeof(tmpacct)-1] = '\0'; |
| 770 | strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(tmpacct); |
| 771 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(filename, "%s/%s/%s", prefs_get_bak_charinfo_dircxx . . $ pvpgn/d2cs/prefs_get_bak_charinfo_dir(33a1f659e94feb42).(), tmpacct, tmpchar); |
| 772 | return 0; |
| 773 | } |
| 774 | |
| 775 | |
| 776 | extern unsigned int d2charinfo_get_laddercxx . . $ pvpgn/d2cs/d2charinfo_get_ladder(cae5a827379a95b4).(t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# const * charinfo) |
| 777 | { |
| 778 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charinfo, 0); |
| 779 | return charstatus_get_laddercxx . . $ `src/d2cs/d2charfile.h:65:9`!(bn_int_get(charinfo->charstatus)); |
| 780 | } |
| 781 | |
| 782 | extern unsigned int d2charinfo_get_expansioncxx . . $ pvpgn/d2cs/d2charinfo_get_expansion(cae5a827379a95b4).(t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# const * charinfo) |
| 783 | { |
| 784 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charinfo, 0); |
| 785 | return charstatus_get_expansioncxx . . $ `src/d2cs/d2charfile.h:64:9`!(bn_int_get(charinfo->charstatus)); |
| 786 | } |
| 787 | |
| 788 | |
| 789 | extern unsigned int d2charinfo_get_levelcxx . . $ pvpgn/d2cs/d2charinfo_get_level(cae5a827379a95b4).(t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# const * charinfo) |
| 790 | { |
| 791 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charinfo, 0); |
| 792 | return bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(charinfo->charlevelcxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#charlevel.); |
| 793 | } |
| 794 | |
| 795 | |
| 796 | extern unsigned int d2charinfo_get_classcxx . . $ pvpgn/d2cs/d2charinfo_get_class(cae5a827379a95b4).(t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# const * charinfo) |
| 797 | { |
| 798 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charinfo, 0); |
| 799 | return bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(charinfo->charclasscxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#charclass.); |
| 800 | } |
| 801 | |
| 802 | |
| 803 | extern unsigned int d2charinfo_get_hardcorecxx . . $ pvpgn/d2cs/d2charinfo_get_hardcore(cae5a827379a95b4).(t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# const * charinfo) |
| 804 | { |
| 805 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charinfo, 0); |
| 806 | return charstatus_get_hardcorecxx . . $ `src/d2cs/d2charfile.h:66:9`!(bn_int_get(charinfo->charstatus)); |
| 807 | } |
| 808 | |
| 809 | |
| 810 | extern unsigned int d2charinfo_get_deadcxx . . $ pvpgn/d2cs/d2charinfo_get_dead(cae5a827379a95b4).(t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# const * charinfo) |
| 811 | { |
| 812 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charinfo, 0); |
| 813 | return charstatus_get_deadcxx . . $ `src/d2cs/d2charfile.h:67:9`!(bn_int_get(charinfo->charstatus)); |
| 814 | } |
| 815 | |
| 816 | |
| 817 | extern unsigned int d2charinfo_get_difficultycxx . . $ pvpgn/d2cs/d2charinfo_get_difficulty(cae5a827379a95b4).(t_d2charinfo_summarycxx . . $ pvpgn/t_d2charinfo_summary# const * charinfo) |
| 818 | { |
| 819 | unsigned int difficulty; |
| 820 | |
| 821 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(charinfo, 0); |
| 822 | if (d2charinfo_get_expansioncxx . . $ pvpgn/d2cs/d2charinfo_get_expansion(cae5a827379a95b4).(charinfo)) { |
| 823 | difficulty = charstatus_get_difficulty_expansioncxx . . $ `src/d2cs/d2charfile.h:69:9`!(bn_int_get(charinfo->charstatus)); |
| 824 | } |
| 825 | else { |
| 826 | difficulty = charstatus_get_difficultycxx . . $ `src/d2cs/d2charfile.h:68:9`!(bn_int_get(charinfo->charstatus)); |
| 827 | } |
| 828 | if (difficulty > 2) difficulty = 2; |
| 829 | return difficulty; |
| 830 | } |
| 831 | |
| 832 | /* those functions should move to util.c */ |
| 833 | extern int file_readcxx . . $ pvpgn/d2cs/file_read(9ad435d3417d65ba).(char const * filename, void * data, unsigned int * size) |
| 834 | { |
| 835 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fp; |
| 836 | unsigned int n; |
| 837 | |
| 838 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(filename, -1); |
| 839 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(data, -1); |
| 840 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(size, -1); |
| 841 | if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(filename, "rb"))) { |
| 842 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not open file \"{}\" for reading (std::fopen: {})", filename, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 843 | return -1; |
| 844 | } |
| 845 | |
| 846 | stdcxx . . $ std/::fseekcxx . . $ std/fseek(543fae30d249f6b1).(fp, 0, SEEK_ENDcxx . . $ `<external>/232824719582829767/stdio.h:112:9`!); /* FIXME: check return value */ |
| 847 | n = stdcxx . . $ std/::ftellcxx . . $ std/ftell(1dcafcd8ef4c6e6c).(fp); |
| 848 | n = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(*size, n); |
| 849 | stdcxx . . $ std/::rewindcxx . . $ std/rewind(8d4262d45fc644ab).(fp); /* FIXME: check return value */ |
| 850 | |
| 851 | if (stdcxx . . $ std/::freadcxx . . $ std/fread(738fc8ac1d711e58).(data, 1, n, fp) != n) { |
| 852 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error reading file \"{}\" (std::fread: {})", filename, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 853 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 854 | return -1; |
| 855 | } |
| 856 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) { |
| 857 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not close file \"{}\" after reading (std::fclose: {})", filename, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 858 | return -1; |
| 859 | } |
| 860 | *size = n; |
| 861 | return 0; |
| 862 | } |
| 863 | |
| 864 | |
| 865 | extern int file_writecxx . . $ pvpgn/d2cs/file_write(a1a540be165300a2).(char const * filename, void * data, unsigned int size) |
| 866 | { |
| 867 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fp; |
| 868 | |
| 869 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(filename, -1); |
| 870 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(data, -1); |
| 871 | ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(size, -1); |
| 872 | if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(filename, "wb"))) { |
| 873 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not open file \"{}\" for writing (std::fopen: {})", filename, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 874 | return -1; |
| 875 | } |
| 876 | if (stdcxx . . $ std/::fwritecxx . . $ std/fwrite(ab0609fa07c47d6e).(data, 1, size, fp) != size) { |
| 877 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "error writing file \"{}\" (std::fwrite: {})", filename, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 878 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 879 | return -1; |
| 880 | } |
| 881 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) { |
| 882 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not close file \"{}\" after writing (std::fclose: {})", filename, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 883 | return -1; |
| 884 | } |
| 885 | return 0; |
| 886 | } |
| 887 | |
| 888 | } |
| 889 | |
| 890 | } |