// Check the command line for -deh argument, and others. void DEH_ParseCommandLine(void) { char *filename; int p; //! // @arg <files> // @category mod // // Load the given dehacked patch(es) // p = M_CheckParm("-deh"); if (p > 0) { ++p; while (p < myargc && myargv[p][0] != '-') { filename = D_TryFindWADByName(myargv[p]); DEH_LoadFile(filename); ++p; } } }
static void LoadChexDeh(void) { char *chex_deh = NULL; char *sep; if (gameversion == exe_chex) { // Look for chex.deh in the same directory as the IWAD file. sep = strrchr(iwadfile, DIR_SEPARATOR); if (sep != NULL) { size_t chex_deh_len = strlen(iwadfile) + 9; chex_deh = malloc(chex_deh_len); M_StringCopy(chex_deh, iwadfile, chex_deh_len); chex_deh[sep - iwadfile + 1] = '\0'; M_StringConcat(chex_deh, "chex.deh", chex_deh_len); } else { chex_deh = strdup("chex.deh"); } // If the dehacked patch isn't found, try searching the WAD // search path instead. We might find it... if (!M_FileExists(chex_deh)) { free(chex_deh); chex_deh = D_FindWADByName("chex.deh"); } // Still not found? if (chex_deh == NULL) { I_Error("Unable to find Chex Quest dehacked file (chex.deh).\n" "The dehacked file is required in order to emulate\n" "chex.exe correctly. It can be found in your nearest\n" "/idgames repository mirror at:\n\n" " utils/exe_edit/patches/chexdeh.zip"); } if (!DEH_LoadFile(chex_deh)) { I_Error("Failed to load chex.deh needed for emulating chex.exe."); } } }
// Load all dehacked patches from the given directory. void DEH_AutoLoadPatches(const char *path) { const char *filename; glob_t *glob; glob = I_StartMultiGlob(path, GLOB_FLAG_NOCASE|GLOB_FLAG_SORTED, "*.deh", "*.hhe", "*.seh", NULL); for (;;) { filename = I_NextGlob(glob); if (filename == NULL) { break; } printf(" [autoload]"); DEH_LoadFile(filename); } I_EndGlob(glob); }
void DEH_Init(void) { char *filename; int p; //! // @category mod // // Ignore cheats in dehacked files. // if (M_CheckParm("-nocheats") > 0) { deh_apply_cheats = false; } //! // @arg <files> // @category mod // // Load the given dehacked patch(es) // p = M_CheckParm("-deh"); if (p > 0) { ++p; while (p < myargc && myargv[p][0] != '-') { filename = D_TryFindWADByName(myargv[p]); DEH_LoadFile(filename); ++p; } } }
// Load dehacked patches needed for certain IWADs. static void LoadIwadDeh(void) { // The Freedoom IWADs have DEHACKED lumps that must be loaded. if (W_CheckNumForName("FREEDOOM") >= 0) { // Old versions of Freedoom (before 2014-09) did not have technically // valid DEHACKED lumps, so ignore errors and just continue if this // is an old IWAD. DEH_LoadLumpByName("DEHACKED", false, true); } // If this is the HACX IWAD, we need to load the DEHACKED lump. if (gameversion == exe_hacx) { if (!DEH_LoadLumpByName("DEHACKED", true, false)) { I_Error("DEHACKED lump not found. Please check that this is the " "Hacx v1.2 IWAD."); } } // Chex Quest needs a separate Dehacked patch which must be downloaded // and installed next to the IWAD. if (gameversion == exe_chex) { char *chex_deh = NULL; char *sep; // Look for chex.deh in the same directory as the IWAD file. sep = strrchr(iwadfile, DIR_SEPARATOR); if (sep != NULL) { size_t chex_deh_len = strlen(iwadfile) + 9; chex_deh = malloc(chex_deh_len); M_StringCopy(chex_deh, iwadfile, chex_deh_len); chex_deh[sep - iwadfile + 1] = '\0'; M_StringConcat(chex_deh, "chex.deh", chex_deh_len); } else { chex_deh = M_StringDuplicate("chex.deh"); } // If the dehacked patch isn't found, try searching the WAD // search path instead. We might find it... if (!M_FileExists(chex_deh)) { free(chex_deh); chex_deh = D_FindWADByName("chex.deh"); } // Still not found? if (chex_deh == NULL) { I_Error("Unable to find Chex Quest dehacked file (chex.deh).\n" "The dehacked file is required in order to emulate\n" "chex.exe correctly. It can be found in your nearest\n" "/idgames repository mirror at:\n\n" " utils/exe_edit/patches/chexdeh.zip"); } if (!DEH_LoadFile(chex_deh)) { I_Error("Failed to load chex.deh needed for emulating chex.exe."); } } }