JadingTsunami Posted June 16, 2019 Is there a known fast, reliable method to distinguish IWADs? Filename matching is an option but seems weak. Scanning lumps for specific targets (e.g., E1M1 vs. MAP01) is an option but might be slow. I know that special IWADINFO lumps are an option, but that wouldn't identify vanilla IWADs. 0 Quote Share this post Link to post
fabian Posted June 16, 2019 First 4 bytes are 'I', 'W', 'A' and 'D'. 0 Quote Share this post Link to post
Graf Zahl Posted June 16, 2019 Don't depend on that. The BFG edition IWADs and Chex.wad have a PWAD identifier, for example. So do most third party IWADs. Of the IWADs I have, Chex3.wad, action2.wad, hacx2.wad and harm.wad all use PWAD instead of IWAD. 2 Quote Share this post Link to post
JadingTsunami Posted June 16, 2019 8 hours ago, Graf Zahl said: Don't depend on that. The BFG edition IWADs and Chex.wad have a PWAD identifier, for example. So do most third party IWADs. Of the IWADs I have, Chex3.wad, action2.wad, hacx2.wad and harm.wad all use PWAD instead of IWAD. That's interesting, thanks - I had assumed the first four bytes would be a reliable method. Is there any way to distinguish one IWAD from another, or is filename matching the only way? 0 Quote Share this post Link to post
jval Posted June 16, 2019 6 hours ago, JadingTsunami said: That's interesting, thanks - I had assumed the first four bytes would be a reliable method. Is there any way to distinguish one IWAD from another, or is filename matching the only way? You can use the checksum for known IWADs. See the wiki 1 Quote Share this post Link to post
ketmar Posted June 16, 2019 (edited) there are alot of official versions of almost each official iwad out there. unless you have ALL of them (are you sure you didn't forgot some? ;-), i'd say "use file name, and trust user to not cheat on you with it." Edited June 16, 2019 by ketmar 0 Quote Share this post Link to post
WadArchive Posted June 17, 2019 The PocketPC version of Doom also has PWAD as it's header https://doomwiki.org/wiki/Doom_for_Pocket_PC 1 Quote Share this post Link to post
Graf Zahl Posted June 17, 2019 9 hours ago, ketmar said: there are alot of official versions of almost each official iwad out there. unless you have ALL of them (are you sure you didn't forgot some? ;-), i'd say "use file name, and trust user to not cheat on you with it." That, plus checking for the presence of a few lumps - just what ZDoom has been doing all the time. 1 Quote Share this post Link to post
JadingTsunami Posted June 17, 2019 Fair enough. Thanks all for the responses. 0 Quote Share this post Link to post
kb1 Posted June 18, 2019 There's a few ways to do it, and the one you choose depends on what you're trying to get out of it. Full IWAD checksum is pretty fast these days, but will fail if anything has been changed. Even faster: checksum the WAD directory. This ensures that all lumps are present, properly named, and of the correct size, making it virtually as good as a full checksum, but much faster. This method can survive slight lump changes that do not affect lump name or size. Checking filename only lets the user proclaim "this is my IWAD - use it as if it were Doom2.WAD", which could be good or bad. Filename+size is a tiny bit more reliable. Checking for key lumps is a nice middle ground So use 1 or possibly 2 if you want to make sure it's a proper purchased IWAD. The remaining methods can provide some flexibility. 0 Quote Share this post Link to post
unpleasantmarine Posted June 19, 2019 On 6/18/2019 at 1:47 AM, kb1 said: There's a few ways to do it, and the one you choose depends on what you're trying to get out of it. Full IWAD checksum is pretty fast these days, but will fail if anything has been changed. Even faster: checksum the WAD directory. This ensures that all lumps are present, properly named, and of the correct size, making it virtually as good as a full checksum, but much faster. This method can survive slight lump changes that do not affect lump name or size. Checking filename only lets the user proclaim "this is my IWAD - use it as if it were Doom2.WAD", which could be good or bad. Filename+size is a tiny bit more reliable. Checking for key lumps is a nice middle ground So use 1 or possibly 2 if you want to make sure it's a proper purchased IWAD. The remaining methods can provide some flexibility. well what if you wanted to user to be able to play freedoom. wouldnt rly work if it was checking against a static list of iwads 0 Quote Share this post Link to post
JadingTsunami Posted June 20, 2019 4 hours ago, unpleasantmarine said: well what if you wanted to user to be able to play freedoom. wouldnt rly work if it was checking against a static list of iwads Yes, it's true, although I have found fairly good lists of "common" IWADs out there. The method I use is a static list of names to compare against, which is not great but seems like a "good enough" solution. I could add lump checking, but I can also think of ways that might be deceiving, so I might leave well enough alone. 0 Quote Share this post Link to post
ketmar Posted June 20, 2019 just put that list in some config file, so user can add their own -- and you won't have to worry about missing names or something. ;-) 0 Quote Share this post Link to post
chungy Posted June 20, 2019 (edited) 6 hours ago, unpleasantmarine said: well what if you wanted to user to be able to play freedoom. wouldnt rly work if it was checking against a static list of iwads The official builds of Freedoom have well-known checksums anyway, and you can always detect by file name too. The standard names are freedoom1.wad, freedoom2.wad, and freedm.wad. There's also a FREEDOOM (and FREEDM to detect FreeDM being used) lump in them that contains the version number Edited June 20, 2019 by chungy 0 Quote Share this post Link to post
Graf Zahl Posted June 20, 2019 4 hours ago, JadingTsunami said: The method I use is a static list of names to compare against, which is not great but seems like a "good enough" solution. Unless people rename their IWADs. For example, to allow both to load on my system Ultimate Doom is called 'doom.wad' and regular Doom 1 is called 'doomu.wad'. Why? Because in ZDoom-based ports it doesn't matter but using 'doom.wad' for the more regularly used one has its advantages. Except for one port, that is. Doomsday cannot handle this because it uses sloppy identification only checking the name and not the content. 0 Quote Share this post Link to post
Gez Posted June 20, 2019 The way ZDoom does it is that it uses a list of names to get handles on files, then identify the files based on their content rather than their names. So if you take HERETIC.WAD and rename it DOOM2.WAD, it'll detect it (because DOOM2.WAD is a name on the list) and then correctly identify it as being actually Heretic despite its name. ZDoom also offers a bunch of extra aliases you can use (as seen here). (In addition to that, GZDoom allows custom IWADs with the extension .iwad or .ipk3. These custom extensions are to avoid having to scan through potentially thousands of .wad and .pk3 files at startup if a user just dumps all mod files in the same folder as the IWADs.) 0 Quote Share this post Link to post
cambreaKer Posted June 20, 2019 i thought the title said "reliable iwad destruction method" 0 Quote Share this post Link to post
kb1 Posted June 21, 2019 On 6/19/2019 at 5:11 PM, unpleasantmarine said: well what if you wanted to user to be able to play freedoom. wouldnt rly work if it was checking against a static list of iwads On 6/17/2019 at 8:47 PM, kb1 said: ...depends on what you're trying to get out of it. 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.