Skip to content

Commit 9e7c471

Browse files
authored
Merge pull request #362 from pvpgn/develop
Finalize 1.99.7.2.1 release
2 parents 36f9925 + 2b503e0 commit 9e7c471

19 files changed

+309
-182
lines changed

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PvPGN is a free and open source cross-platform server software that supports Bat
77
[![License (GPL version 2)](https://img.shields.io/badge/license-GNU%20GPL%20version%202-blue.svg?style=flat-square)](http://opensource.org/licenses/GPL-2.0)
88
![Language (C++)](https://img.shields.io/badge/powered_by-C++-brightgreen.svg?style=flat-square)
99
[![Language (Lua)](https://img.shields.io/badge/powered_by-Lua-red.svg?style=flat-square)](https://lua.org)
10-
[![Github Releases (by Release)](https://img.shields.io/github/downloads/pvpgn/pvpgn-server/1.99.7.1-PRO/total.svg?maxAge=2592000)]()
10+
[![Github Releases (by Release)](https://img.shields.io/github/downloads/pvpgn/pvpgn-server/1.99.7.2.1/total.svg?maxAge=2592000)]()
1111

1212
[![Compiler (Microsoft Visual C++)](https://img.shields.io/badge/compiled_with-Microsoft%20Visual%20C++-yellow.svg?style=flat-square)](https://msdn.microsoft.com/en-us/vstudio/hh386302.aspx)
1313
[![Compiler (LLVM/Clang)](https://img.shields.io/badge/compiled_with-LLVM/Clang-lightgrey.svg?style=flat-square)](http://clang.llvm.org/)
@@ -25,8 +25,8 @@ By default, tracking is enabled and is only used for the purpose of sending info
2525
- **WarCraft 2: Battle.net Edition**: 2.02a, 2.02b
2626
- **WarCraft 3: Reign of Chaos**\*: 1.13a, 1.13b, 1.14a, 1.14b, 1.15a, 1.16a, 1.17a, 1.18a, 1.19a, 1.19b, 1.20a, 1.20b, 1.20c, 1.20d, 1.20e, 1.21a, 1.21b, 1.22a, 1.23a, 1.24a, 1.24b, 1.24c, 1.24d, 1.24e, 1.25b, 1.26a, 1.27a, 1.27b, 1.28, 1.28.1, 1.28.2, 1.28.4, 1.28.5
2727
- **WarCraft 3: The Frozen Throne**\*: 1.13a, 1.13b, 1.14a, 1.14b, 1.15a, 1.16a, 1.17a, 1.18a, 1.19a, 1.19b, 1.20a, 1.20b, 1.20c, 1.20d, 1.20e, 1.21a, 1.21b, 1.22a, 1.23a, 1.24a, 1.24b, 1.24c, 1.24d, 1.24e, 1.25b, 1.26a, 1.27a, 1.27b, 1.28, 1.28.1, 1.28.2, 1.28.4, 1.28.5
28-
- **StarCraft**: 1.08, 1.08b, 1.09, 1.09b, 1.10, 1.11, 1.11b, 1.12, 1.12b, 1.13, 1.13b, 1.13c, 1.13d, 1.13e, 1.13f, 1.14, 1.15, 1.15.1, 1.15.2, 1.15.3, 1.16, 1.16.1
29-
- **StarCraft: Brood War**: 1.08, 1.08b, 1.09, 1.09b, 1.10, 1.11, 1.11b, 1.12, 1.12b, 1.13, 1.13b, 1.13c, 1.13d, 1.13e, 1.13f, 1.14, 1.15, 1.15.1, 1.15.2, 1.15.3, 1.16, 1.16.1
28+
- **StarCraft**: 1.08, 1.08b, 1.09, 1.09b, 1.10, 1.11, 1.11b, 1.12, 1.12b, 1.13, 1.13b, 1.13c, 1.13d, 1.13e, 1.13f, 1.14, 1.15, 1.15.1, 1.15.2, 1.15.3, 1.16, 1.16.1, 1.17.0, 1.18.0
29+
- **StarCraft: Brood War**: 1.08, 1.08b, 1.09, 1.09b, 1.10, 1.11, 1.11b, 1.12, 1.12b, 1.13, 1.13b, 1.13c, 1.13d, 1.13e, 1.13f, 1.14, 1.15, 1.15.1, 1.15.2, 1.15.3, 1.16, 1.16.1, 1.17.0, 1.18.0
3030
- **Diablo**: 1.09, 1.09b
3131
- **Diablo 2**: 1.10, 1.11, 1.11b, 1.12a, 1.13c, 1.14a, 1.14b, 1.14c, 1.14d
3232
- **Diablo 2: Lord of Destruction**: 1.10, 1.11, 1.11b, 1.12a, 1.13c, 1.14a, 1.14b, 1.14c, 1.14d
@@ -44,15 +44,17 @@ By default, tracking is enabled and is only used for the purpose of sending info
4444
- **Emperor: Battle for Dune**: 1.09
4545

4646
\* WarCraft 3 clients are unable to connect to PvPGN servers without a client-side modification, through tools such as [W3L](https://github.com/w3lh/w3l), to disable server signature verification.
47+
\* StarCraft clients beginning with patch 1.18 will not be supported by PvPGN-PRO due to protocol changes. A 1.18.0 versioncheck entry is included for compatibility with bot software.
4748

4849
## Support
4950
[Create an issue](https://github.com/pvpgn/pvpgn-server/issues) if you have any questions, suggestions, or anything else to say about PvPGN-PRO. Please note that D2GS is not part of the PvPGN project and is therefore unsupported here.
51+
Set `loglevels = fatal,error,warn,info,debug,trace` in `bnetd.conf` before obtaining logs and posting them.
5052

5153
## Development
5254
Submit pull requests to contribute to this project. Utilize C++11 features and adhere to the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) whenever possible.
5355

5456
## Building
55-
See [docs/ports.md](https://github.com/pvpgn/pvpgn-server/blob/master/docs/ports.md) for operating systems and compilers that have been confirmed to work with PvPGN. Any operating system that supports WinAPI or POSIX, and any C++11 compliant compiler should be able to build PvPGN.
57+
See [docs/ports.md](https://github.com/pvpgn/pvpgn-server/blob/master/docs/ports.md) for operating systems and compilers that have been confirmed to work with PvPGN. Any operating system that supports WinAPI or POSIX, and any C++11 compliant compiler should be able to build PvPGN. The CMake files have been hardcoded to reject compilers older than Visual Studio 2015 and GCC 5.1.
5658

5759
#### Windows
5860
Use [Magic Builder](https://github.com/pvpgn/pvpgn-magic-builder).

conf/bnetd.conf.win32

-26
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,6 @@ star_iconfile = "icons_STAR.bni"
189189
# Example: allowed_clients = war3,w3xp
190190
allowed_clients = all
191191

192-
# If this option is enabled, the verification step is skipped if possible.
193-
# This only works with clients < 109. It is useful because you no longer
194-
# need any of the IX86AUTH?.MPQ and PMACAUTH?.MPQ files. Note that it will
195-
# also skip over all the autoupdate checks effectively disabling it.
196-
#
197-
# If you disable this you must have one or more of the MPQ files. Otherwise
198-
# clients will hang when they first connect because they are attempting to
199-
# download them. The versioncheck can only be skipped for clients older
200-
# than 109. Starting with version 109 the clients will always do version
201-
# checking since they do not function properly if the server does not
202-
# request it.
203-
skip_versioncheck = true
204-
205192
# If you enable the version checks but want to allow clients that don't pass
206193
# the checksum test then enable this.
207194
allow_bad_version = true
@@ -212,19 +199,6 @@ allow_bad_version = true
212199
# is a good idea.
213200
allow_unknown_version = true
214201

215-
# This defines how the exeinfo field in the versioncheck file is being
216-
# checked. You can choose between no match at all [none] (default),
217-
# exact match [exact], exact case-sensitive match [exactcase], dumb wildcard
218-
# match [wildcard], and parsed value comparison [parse].
219-
# NOTE: [parse] needs the mktime() function and might therefore not work on
220-
# every system.
221-
version_exeinfo_match = none
222-
223-
# If you have choosen [parse] above, this is the tolerance with which
224-
# the time can differ. The value must be given in seconds. If it's 0 this
225-
# check is disabled.
226-
version_exeinfo_maxdiff = 0
227-
228202
# #
229203
##############################################################################
230204

conf/versioncheck.json.in

+60-1
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,39 @@
868868
},
869869
"STAR": {
870870
"IX86": {
871+
"0xd6": {
872+
"checkRevisionFile": "ver-IX86-1.mpq",
873+
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
874+
"entries": [
875+
{
876+
"title": "StarCraft 1.18.0",
877+
"version": "1.18.0.65",
878+
"hash": "0x7ab2ce34",
879+
"fileMetadata": "StarCraft.exe 10/20/17 01:12:49 8568296",
880+
"versionTag": "STAR_1180"
881+
}
882+
]
883+
},
884+
"0xd5": {
885+
"checkRevisionFile": "ver-IX86-1.mpq",
886+
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
887+
"entries": [
888+
{
889+
"title": "StarCraft: Brood War 1.17.0 - (StarCraft mode)",
890+
"version": "1.17.0.1",
891+
"hash": "0xcb82b07c",
892+
"fileMetadata": "StarCraft.exe 07/11/16 15:59:46 1243112",
893+
"versionTag": "STAR_1170"
894+
},
895+
{
896+
"title": "StarCraft 1.17.0",
897+
"version": "1.17.0.0",
898+
"hash": "0xa5e7b4cc",
899+
"fileMetadata": "StarCraft.exe 07/11/16 15:59:51 1243112",
900+
"versionTag": "STAR_1170"
901+
}
902+
]
903+
},
871904
"0xd3": {
872905
"checkRevisionFile": "ver-IX86-1.mpq",
873906
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
@@ -1300,6 +1333,32 @@
13001333
},
13011334
"SEXP": {
13021335
"IX86": {
1336+
"0xd6": {
1337+
"checkRevisionFile": "ver-IX86-1.mpq",
1338+
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
1339+
"entries": [
1340+
{
1341+
"title": "StarCraft: Brood War 1.18.0",
1342+
"version": "1.18.0.65",
1343+
"hash": "0x7ab2ce34",
1344+
"fileMetadata": "StarCraft.exe 10/20/17 01:12:49 8568296",
1345+
"versionTag": "SEXP_1180"
1346+
}
1347+
]
1348+
},
1349+
"0xd5": {
1350+
"checkRevisionFile": "ver-IX86-1.mpq",
1351+
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
1352+
"entries": [
1353+
{
1354+
"title": "StarCraft: Brood War 1.17.0 - (Brood War mode)",
1355+
"version": "1.17.0.1",
1356+
"hash": "0xcb82b07c",
1357+
"fileMetadata": "StarCraft.exe 07/11/16 15:59:46 1243112",
1358+
"versionTag": "SEXP_1170"
1359+
}
1360+
]
1361+
},
13031362
"0xd3": {
13041363
"checkRevisionFile": "ver-IX86-1.mpq",
13051364
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
@@ -1852,4 +1911,4 @@
18521911
}
18531912
}
18541913
}
1855-
}
1914+
}

files/CMakeLists.txt

+18-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,21 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/var/status")
1717

1818
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/var/ DESTINATION ${LOCALSTATEDIR})
1919

20-
install(FILES ad000001.png ad000001.smk ad000002.mng newbie.save
21-
bnserver.ini bnserver-D2DV.ini bnserver-D2XP.ini bnserver-WAR3.ini
22-
ver-IX86-1.mpq IX86ver1.mpq PMACver1.mpq XMACver1.mpq IX86ExtraWork.mpq
23-
icons.bni icons-WAR3.bni icons_STAR.bni
24-
DESTINATION ${LOCALSTATEDIR}/files)
20+
install(FILES ad000001.png
21+
ad000001.smk
22+
ad000002.mng
23+
ad000002.smk
24+
bnserver.ini
25+
bnserver-D2DV.ini
26+
bnserver-D2XP.ini
27+
bnserver-WAR3.ini
28+
icons.bni
29+
icons_STAR.bni
30+
icons-WAR3.bni
31+
IX86ExtraWork.mpq
32+
IX86ver1.mpq
33+
newbie.save
34+
PMACver1.mpq
35+
ver-IX86-1.mpq
36+
XMACver1.mpq
37+
DESTINATION ${LOCALSTATEDIR}/files)

src/bnetd/account.cpp

+29-22
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <cstddef>
2525
#include <cassert>
2626
#include <cctype>
27+
#include <chrono>
2728

2829
#include "compat/strdup.h"
2930
#include "compat/strcasecmp.h"
@@ -373,33 +374,39 @@ namespace pvpgn
373374

374375
extern int accountlist_load_all(int flag)
375376
{
376-
unsigned int count;
377-
int starttime = std::time(NULL);
378-
static int loaded = 0; /* all accounts already loaded ? */
379-
int res;
377+
static bool loaded = false; // all accounts already loaded ?
380378

381-
if (loaded) return 0;
379+
if (loaded)
380+
{
381+
return 0;
382+
}
382383

383-
count = 0;
384-
res = 0;
384+
auto t0 = std::chrono::steady_clock::now();
385385

386-
force_account_add = 1; /* disable the protection */
387-
switch (attrgroup_read_accounts(flag, _cb_read_accounts, &count))
386+
unsigned int count = 0;
387+
force_account_add = 1; // disable the protection
388+
int ret = attrgroup_read_accounts(flag, _cb_read_accounts, &count);
389+
force_account_add = 0; // enable the protection
390+
391+
auto t1 = std::chrono::steady_clock::now();
392+
393+
if (ret == 0)
388394
{
389-
case -1:
390-
eventlog(eventlog_level_error, __FUNCTION__, "got error reading users");
391-
res = -1;
392-
break;
393-
case 0:
394-
loaded = 1;
395-
eventlog(eventlog_level_info, __FUNCTION__, "loaded {} user accounts in {} seconds", count, std::time(nullptr) - starttime);
396-
break;
397-
default:
398-
break;
399-
}
400-
force_account_add = 0; /* enable the protection */
395+
loaded = true;
396+
eventlog(eventlog_level_info, __FUNCTION__, "Successfully loaded {} user accounts in {} milliseconds", count, std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0).count());
401397

402-
return res;
398+
return 0;
399+
}
400+
else if (ret == -1)
401+
{
402+
eventlog(eventlog_level_error, __FUNCTION__, "got error reading user accounts");
403+
404+
return -1;
405+
}
406+
else
407+
{
408+
return 0;
409+
}
403410
}
404411

405412
extern int accountlist_create(void)

src/bnetd/command.cpp

+49-18
Original file line numberDiff line numberDiff line change
@@ -2936,33 +2936,64 @@ namespace pvpgn
29362936

29372937
static int _glist_cb(t_game *game, void *data)
29382938
{
2939-
struct glist_cb_struct *cbdata = (struct glist_cb_struct*)data;
2939+
auto cbdata = reinterpret_cast<struct glist_cb_struct*>(data);
29402940

2941-
if ((!cbdata->tag || !prefs_get_hide_pass_games() || game_get_flag(game) != game_flag_private) &&
2942-
(!cbdata->tag || game_get_clienttag(game) == cbdata->tag) &&
2943-
(cbdata->diff == game_difficulty_none || game_get_difficulty(game) == cbdata->diff) &&
2944-
(cbdata->lobby == false || (game_get_status(game) != game_status_started && game_get_status(game) != game_status_done)))
2941+
// when cbdata->tag != 0, user is requesting games of the same client tag
2942+
// return early when the game's client tag does not match the user's client tag
2943+
if (cbdata->tag != 0 && cbdata->tag != game_get_clienttag(game))
29452944
{
2946-
std::snprintf(msgtemp0, sizeof(msgtemp0), " %-16.16s %1.1s %-8.8s %-21.21s %5u ",
2947-
game_get_name(game),
2948-
game_get_flag(game) != game_flag_private ? "n" : "y",
2949-
game_status_get_str(game_get_status(game)),
2950-
game_type_get_str(game_get_type(game)),
2951-
game_get_ref(game));
2945+
return 0;
2946+
}
29522947

2953-
if (!cbdata->tag)
2954-
{
2948+
// when cbdata->lobby == true, only display list of all games in the lobby
2949+
// return early if game has started or is already finished
2950+
if (cbdata->lobby == true && (game_get_status(game) == game_status_started || game_get_status(game) == game_status_done))
2951+
{
2952+
return 0;
2953+
}
29552954

2956-
std::strcat(msgtemp0, clienttag_uint_to_str(game_get_clienttag(game)));
2957-
std::strcat(msgtemp0, " ");
2955+
// when cbdata->diff != game_difficulty_none, user is requesting a specific game difficulty
2956+
// return early if user is requesting a specific game difficulty that does not match the game's difficulty
2957+
if (cbdata->diff != game_difficulty_none && cbdata->diff != game_get_difficulty(game))
2958+
{
2959+
return 0;
2960+
}
2961+
2962+
unsigned int pref = prefs_get_hide_pass_games();
2963+
if (pref && game_get_flag(game) == game_flag_private)
2964+
{
2965+
// return early if hide_pass_games is true and the game is private
2966+
if (cbdata->tag != 0)
2967+
{
2968+
return 0;
2969+
}
2970+
// if user used /games all and is not an admin, return early
2971+
else if (cbdata->tag == 0 && account_get_auth_admin(conn_get_account(cbdata->c), nullptr) != 1)
2972+
{
2973+
return 0;
29582974
}
2975+
}
2976+
2977+
2978+
std::snprintf(msgtemp0, sizeof(msgtemp0), " %-16.16s %1.1s %-8.8s %-21.21s %5u ",
2979+
game_get_name(game),
2980+
game_get_flag(game) != game_flag_private ? "n" : "y",
2981+
game_status_get_str(game_get_status(game)),
2982+
game_type_get_str(game_get_type(game)),
2983+
game_get_ref(game));
29592984

2960-
if ((!prefs_get_hide_addr()) || (account_get_command_groups(conn_get_account(cbdata->c)) & command_get_group("/admin-addr"))) /* default to false */
2961-
std::strcat(msgtemp0, addr_num_to_addr_str(game_get_addr(game), game_get_port(game)));
2985+
if (!cbdata->tag)
2986+
{
29622987

2963-
message_send_text(cbdata->c, message_type_info, cbdata->c, msgtemp0);
2988+
std::strcat(msgtemp0, clienttag_uint_to_str(game_get_clienttag(game)));
2989+
std::strcat(msgtemp0, " ");
29642990
}
29652991

2992+
if ((!prefs_get_hide_addr()) || (account_get_command_groups(conn_get_account(cbdata->c)) & command_get_group("/admin-addr"))) /* default to false */
2993+
std::strcat(msgtemp0, addr_num_to_addr_str(game_get_addr(game), game_get_port(game)));
2994+
2995+
message_send_text(cbdata->c, message_type_info, cbdata->c, msgtemp0);
2996+
29662997
return 0;
29672998
}
29682999

src/bnetd/connection.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ namespace pvpgn
451451

452452
list_prepend_data(conn_head, temp);
453453

454-
eventlog(eventlog_level_info, __FUNCTION__, "[{}][{}] sessionkey=0x{:08} sessionnum=0x{:08}", temp->socket.tcp_sock, temp->socket.udp_sock, temp->protocol.sessionkey, temp->protocol.sessionnum);
454+
eventlog(eventlog_level_debug, __FUNCTION__, "[{}][{}] sessionkey=0x{:08} sessionnum=0x{:08}", temp->socket.tcp_sock, temp->socket.udp_sock, temp->protocol.sessionkey, temp->protocol.sessionnum);
455455

456456
return temp;
457457
}
@@ -1221,8 +1221,6 @@ namespace pvpgn
12211221

12221222
extern void conn_set_archtag(t_connection * c, t_tag archtag)
12231223
{
1224-
char archtag_str[5];
1225-
12261224
if (!c) {
12271225
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection");
12281226
return;
@@ -1232,9 +1230,7 @@ namespace pvpgn
12321230
return;
12331231
}
12341232
if (c->protocol.client.archtag != archtag)
1235-
eventlog(eventlog_level_info, __FUNCTION__, "[{}] setting client arch to \"{}\"", conn_get_socket(c), tag_uint_to_str(archtag_str, archtag));
1236-
1237-
c->protocol.client.archtag = archtag;
1233+
c->protocol.client.archtag = archtag;
12381234
}
12391235

12401236

@@ -1320,8 +1316,8 @@ namespace pvpgn
13201316
eventlog(eventlog_level_error, __FUNCTION__, "got UNKNOWN clienttag \"{}\"", tag_uint_to_str(clienttag_str, clienttag));
13211317
return;
13221318
}
1323-
if (c->protocol.client.clienttag != clienttag) {
1324-
eventlog(eventlog_level_info, __FUNCTION__, "[{}] setting client type to \"{}\"", conn_get_socket(c), tag_uint_to_str(clienttag_str, clienttag));
1319+
if (c->protocol.client.clienttag != clienttag)
1320+
{
13251321
c->protocol.client.clienttag = clienttag;
13261322
if (c->protocol.chat.channel)
13271323
channel_update_userflags(c);

src/bnetd/game.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,12 @@ namespace pvpgn
943943
if (game_get_type(game) != game_type_ladder && prefs_get_report_all_games() != 1)
944944
{
945945
eventlog(eventlog_level_debug, __FUNCTION__, "not reporting normal games");
946+
947+
if (ladder_info)
948+
{
949+
xfree(ladder_info);
950+
}
951+
946952
return 0;
947953
}
948954

0 commit comments

Comments
 (0)