mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-19 08:01:50 +00:00
allow getting checksum for current map
This commit is contained in:
parent
261881e0d7
commit
758c0dbc7e
1 changed files with 45 additions and 17 deletions
|
@ -141,30 +141,58 @@ CCMD (spray)
|
|||
|
||||
CCMD (mapchecksum)
|
||||
{
|
||||
MapData *map;
|
||||
uint8_t cksum[16];
|
||||
|
||||
if (argv.argc() < 2)
|
||||
if (argv.argc() == 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)
|
||||
MapData *map;
|
||||
uint8_t cksum[16];
|
||||
|
||||
for (int i = 1; i < argv.argc(); ++i)
|
||||
{
|
||||
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)
|
||||
if(argv[i] == "*")
|
||||
{
|
||||
Printf("%02X", cksum[j]);
|
||||
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
|
||||
{
|
||||
map = P_OpenMapData(argv[i], true);
|
||||
if (map == NULL)
|
||||
{
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue