Skip to content

Commit

Permalink
allow getting checksum for current map
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 committed Oct 17, 2024
1 parent 261881e commit bf80e07
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions src/g_dumpinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,30 +141,44 @@ CCMD (spray)

CCMD (mapchecksum)
{
MapData *map;
uint8_t cksum[16];

if (argv.argc() < 2)
if (argv.argc() == 1 || (argv.argc() == 2 && argv[1] == "*"))
{ //current map
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum));

for (size_t i = 0; i < 16; ++i)
{
Printf("%02X", level.md5[i]);
}

Printf(" // %s %s\n", wadname, level.MapName.GetChars());
}
else if (argv.argc() < 2)
{
Printf("Usage: mapchecksum <map> ...\n");
}
for (int i = 1; i < argv.argc(); ++i)
else
{
map = P_OpenMapData(argv[i], true);
if (map == NULL)
{
Printf("Cannot load %s as a map\n", argv[i]);
}
else
MapData *map;
uint8_t cksum[16];

for (int i = 1; i < argv.argc(); ++i)
{
map->GetChecksum(cksum);
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum));
delete map;
for (size_t j = 0; j < sizeof(cksum); ++j)
map = P_OpenMapData(argv[i], true);
if (map == NULL)
{
Printf("%02X", cksum[j]);
Printf("Cannot load %s as a map\n", argv[i]);
}
else
{
map->GetChecksum(cksum);
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum));
delete map;
for (size_t j = 0; j < sizeof(cksum); ++j)
{
Printf("%02X", cksum[j]);
}
Printf(" // %s %s\n", wadname, argv[i]);
}
Printf(" // %s %s\n", wadname, argv[i]);
}
}
}
Expand Down

0 comments on commit bf80e07

Please sign in to comment.