Skip to content

Commit

Permalink
dat2json_cli: ProtocolConfig is used, so it needs to be configured.
Browse files Browse the repository at this point in the history
This also means `Tibia.{dat,spr,pic}` _need_ to be present in CWD.

This resolves the crash in Make-built `dat2json_cli`.
  • Loading branch information
ivucica committed Sep 15, 2023
1 parent 542ed32 commit 46b3552
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cli/dat2json_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ unsigned int g_frameDiff = 0;
Connection *g_connection = NULL;

int main(int argc, char** argv) {
yatc_fopen_init(argv[0]);
ClientVersion_t proto = CLIENT_VERSION_854;
auto i = Objects::getInstance();
if (argc != 3) {
fprintf(stderr, "usage: %s datfile jsonfile\n", argv[0]);
return 1;
}
std::cout << "Warning: In case of crash after this line check you put Tibia.{dat,spr,pic} in CWD." << std::endl << std::flush;
ProtocolConfig::getInstance().setServerType(SERVER_OTSERV);
ProtocolConfig::getInstance().setVersion(CLIENT_OS_WIN, proto);
ProtocolConfig::getInstance().setVersionOverride(CLIENT_VERSION_AUTO);
i->loadDat(argv[1]);

std::ofstream outFile;
Expand Down

0 comments on commit 46b3552

Please sign in to comment.