├── res ├── ico_up.ico ├── ico_wad.ico ├── bmp_logo.bmp ├── ico_down.ico ├── ico_icon.ico ├── ico_patch.ico └── ico_save.ico ├── README.md ├── zdl.dsp ├── zdl-log.txt ├── zdl.h ├── sub.c ├── zdl.rc ├── dlg.c ├── cfg.c ├── zdl.c └── LICENSE /res/ico_up.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZDBioHazard/ZDL-3/HEAD/res/ico_up.ico -------------------------------------------------------------------------------- /res/ico_wad.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZDBioHazard/ZDL-3/HEAD/res/ico_wad.ico -------------------------------------------------------------------------------- /res/bmp_logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZDBioHazard/ZDL-3/HEAD/res/bmp_logo.bmp -------------------------------------------------------------------------------- /res/ico_down.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZDBioHazard/ZDL-3/HEAD/res/ico_down.ico -------------------------------------------------------------------------------- /res/ico_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZDBioHazard/ZDL-3/HEAD/res/ico_icon.ico -------------------------------------------------------------------------------- /res/ico_patch.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZDBioHazard/ZDL-3/HEAD/res/ico_patch.ico -------------------------------------------------------------------------------- /res/ico_save.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZDBioHazard/ZDL-3/HEAD/res/ico_save.ico -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ZDL-3 2 | ===== 3 | 4 | This project is **dead** now. (well, the master branch is anyway >.> ) 5 | 6 | You can still use it of course, but as I no longer use Windows, I can't continue 7 | to develop it. I have also added the common forks people have created as 8 | branches of this repository. 9 | 10 | * **master:** The original source as released by me back in 2006. 11 | * **risen:** [Risen's ZDL-3.1](http://twicerisen.ath.cx/zdl/) fixes/changes. 12 | * **wildgoose:** [WildGoose's ZDL-3.1a](http://www.csua.berkeley.edu/~chiry/doom/zdl/) fixes/changes. 13 | 14 | Thanks a lot to all the users out there for keeping ZDL alive all this time! :) 15 | 16 | -Ryan "BioHazard" Turner (2011) 17 | 18 | -------------------------------------------------------------------------------- /zdl.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="ZDL" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=ZDL - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "ZDL.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "ZDL.mak" CFG="ZDL - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "ZDL - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE 22 | 23 | # Begin Project 24 | # PROP AllowPerConfigDependencies 0 25 | # PROP Scc_ProjName "" 26 | # PROP Scc_LocalPath "" 27 | CPP=cl.exe 28 | MTL=midl.exe 29 | RSC=rc.exe 30 | # PROP BASE Use_MFC 0 31 | # PROP BASE Use_Debug_Libraries 0 32 | # PROP BASE Output_Dir "Release" 33 | # PROP BASE Intermediate_Dir "Release" 34 | # PROP BASE Target_Dir "" 35 | # PROP Use_MFC 0 36 | # PROP Use_Debug_Libraries 0 37 | # PROP Output_Dir "Release" 38 | # PROP Intermediate_Dir "Release" 39 | # PROP Ignore_Export_Lib 0 40 | # PROP Target_Dir "" 41 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c 42 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c 43 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 44 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 45 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 46 | # ADD RSC /l 0x409 /d "NDEBUG" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LINK32=link.exe 51 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 52 | # ADD LINK32 shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 53 | # SUBTRACT LINK32 /pdb:none 54 | # Begin Target 55 | 56 | # Name "ZDL - Win32 Release" 57 | # Begin Group "Resources" 58 | 59 | # PROP Default_Filter "" 60 | # Begin Source File 61 | 62 | SOURCE=.\res\bmp_logo.bmp 63 | # End Source File 64 | # Begin Source File 65 | 66 | SOURCE=.\res\ico_down.ico 67 | # End Source File 68 | # Begin Source File 69 | 70 | SOURCE=.\res\ico_icon.ico 71 | # End Source File 72 | # Begin Source File 73 | 74 | SOURCE=.\res\ico_patch.ico 75 | # End Source File 76 | # Begin Source File 77 | 78 | SOURCE=.\res\ico_save.ico 79 | # End Source File 80 | # Begin Source File 81 | 82 | SOURCE=.\res\ico_up.ico 83 | # End Source File 84 | # Begin Source File 85 | 86 | SOURCE=.\res\ico_wad.ico 87 | # End Source File 88 | # End Group 89 | # Begin Group "Source" 90 | 91 | # PROP Default_Filter "" 92 | # Begin Source File 93 | 94 | SOURCE=.\cfg.c 95 | # End Source File 96 | # Begin Source File 97 | 98 | SOURCE=.\dlg.c 99 | # End Source File 100 | # Begin Source File 101 | 102 | SOURCE=.\sub.c 103 | # End Source File 104 | # Begin Source File 105 | 106 | SOURCE=.\zdl.c 107 | # End Source File 108 | # End Group 109 | # Begin Source File 110 | 111 | SOURCE=".\zdl-log.txt" 112 | # End Source File 113 | # Begin Source File 114 | 115 | SOURCE=.\zdl.h 116 | # End Source File 117 | # Begin Source File 118 | 119 | SOURCE=.\zdl.rc 120 | # End Source File 121 | # End Target 122 | # End Project 123 | -------------------------------------------------------------------------------- /zdl-log.txt: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * ZDL! 3 | * Copyright (C) 2005 BioHazard / Vectec Software 4 | *********************************************************************** 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 or any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | *********************************************************************** 13 | * zdl-log.txt : Documentation of changes 14 | **********************************************************************/ 15 | 16 | *-- Stuff left to do --* 17 | * DMFlag Calculator 18 | * ZDLNet branch 19 | 20 | *-- Known Bugs --* 21 | * None that I know of but I'm sure there are a few. 22 | 23 | ///////////////////////////////////////////////////////////// 24 | 25 | !-- Version 3.0d --! 26 | *-- Dec 10th 2005 --* 27 | * Fixed : Entering a port of IWAD path without a '\\' would 28 | crash ZDL. 29 | * Fixed : The current directory should be set to the selected 30 | port's dir so the proper files are loaded. 31 | 32 | !-- Version 3.0c --! 33 | *-- Dec 2nd 2005 --* 34 | * Fixed : ReadINI() Didn't close the file and free memory if it 35 | failed for some reason. 36 | * Fixed : If you tried to load a config file with no ports or 37 | IWADs ZDL would crash. 38 | 39 | !-- Version 3.0b --! 40 | *-- Dec 2nd 2005 --* 41 | * Fixed : ZDL is supposed to exit if you have cfg.launch set 42 | and a save file can't be loaded for some reason. 43 | * Fixed : The main dialog always populated the warp list with 44 | the first file's maps even if it's unavailable. 45 | * Fixed : Cfg_ReadSave() Didn't populate the save list when a 46 | new IWAD is set. -- Thanks Belial 47 | 48 | !-- Version 3.0a --! 49 | *-- Dec 2nd 2005 --* 50 | * Fixed : Dlg_Launch() Didn't put spaces around the EXE or IWAD 51 | names, this would make the ZDoom IWAD dialog pop up. 52 | * Fixed : Cfg_GetSel() Always checked for port[i] instead of 53 | item[i] resulting in IWADs after the last port to always 54 | crash ZDL -- Thanks Belial 55 | 56 | !-- Version 3.0 --! 57 | *-- Dec 2nd 2005 --* 58 | * Total Recode: Undocumented 59 | 60 | !-- Version 2.0 --! 61 | *-- Jul 15th 2005 --* 62 | * Total Recode: Undocumented 63 | 64 | !-- Version 1.5 --! 65 | *-- Mar 12th 2005 --* 66 | * Undocumented 67 | 68 | !-- Version 1.4 --! 69 | *-- Date Unknown --* 70 | * File handling code overhaul, it loads things much more 71 | solidly now 72 | * Added a warp box to select the level to start on 73 | * Added a skill box to set the starting skill 74 | * "Instant Action" option removed form dialog, config and 75 | langfile 76 | * "EnjayMode" became the base for the main dialog 77 | * Cmd line flag "/D" removed. added to config 78 | * New config option "PrmtOnLnch": prompts the user much like 79 | "/D" did in previous versions 80 | * New save format, now properly saves IWAD 81 | * "EnjayMode" removed due to the new layout 82 | 83 | !-- Version 1.3b --! 84 | *-- Date Unknown --* 85 | * Removed some debugging code that got out into the release 86 | version! :oops: 87 | * Made the pwads list remove the directory info again 88 | * Added an option to show the directory in the PWADS list 89 | 90 | !-- Version 1.31 --! 91 | *-- Date Unknown --* 92 | * Fixed the clipboard function 93 | 94 | !-- Version 1.3 --! 95 | *-- Date Unknown --* 96 | * Fixed a bug that would make ZDL generate a malformed command 97 | when lots of PWADS are loaded 98 | * Added a button to generate the command line and send it to 99 | the clipboard 100 | 101 | !-- Version 1.2 --! 102 | *-- Date Unknown --* 103 | * Custom Configurations 104 | * Custom IWADS 105 | * new config options: ExtendPanels, EnjayMode, CloseOnExit 106 | 107 | !-- Version 1.1 --! 108 | *-- Date Unknown --* 109 | * Added a multiplayer panel thingy 110 | 111 | !-- Version 1.0 --! 112 | *-- Date Unknown --* 113 | * PWAD/DEH loading 114 | * Config File 115 | 116 | !-- Version 0.2 --! 117 | *-- Date Unknown --* 118 | * Iwad selection 119 | 120 | !-- Version 0.1 --! 121 | *-- Date Unknown --* 122 | * Initial release 123 | -------------------------------------------------------------------------------- /zdl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * ZDL! 3 | * Copyright (C) 2005 BioHazard / Vectec Software 4 | *********************************************************************** 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 or any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | *********************************************************************** 13 | * zdl.h : Prototypes and defines for stuff 14 | **********************************************************************/ 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | ////////////////////////// 21 | // Max values 22 | #define MAX_ITEM 16 23 | #define MAX_PWAD 64 24 | #define MAX_NAME 48 25 | 26 | ////////////////////////// 27 | // Strings 28 | #define STR_MAXPWAD "Too many files loaded! Not all files were added to the list." 29 | #define STR_NOITEMS "You must have at least 1 port and IWAD defined and available\n\nSelect ZDL -> Options to configure ports and IWADS" 30 | #define STR_NEEDPRT "This save specifies the port \"%s\" which is unavailable.\nDo you want to use \"%s\" instead?" 31 | #define STR_NEEDIWD "This save specifies the IWAD \"%s\" which is unavailable.\nDo you want to use \"%s\" instead?" 32 | 33 | ////////////////////////// 34 | // Data structs 35 | typedef struct{ // Options 36 | char dlgmode; 37 | char always[128]; 38 | char launch; 39 | // Internal 40 | char *ini; 41 | char assoc[4]; 42 | }CFG; extern CFG cfg; 43 | typedef struct{ // IWAD defs 44 | char avail; 45 | char name[MAX_NAME]; 46 | char path[MAX_PATH]; 47 | }ITEM; extern ITEM *iwad[MAX_ITEM+1],*port[MAX_ITEM+1]; 48 | extern char *pwad[MAX_PWAD+1]; 49 | extern short arg1,arg2,arg3; // Needed for the config dialogs 50 | 51 | ////////////////////////// 52 | // sub.c 53 | LRESULT CALLBACK AboutProc(HWND dlg,UINT msg,WPARAM wp,LPARAM lp); 54 | LRESULT CALLBACK AssocProc(HWND dlg,UINT msg,WPARAM wp,LPARAM lp); 55 | LRESULT CALLBACK FileProc(HWND dlg,UINT msg,WPARAM wp,LPARAM lp); 56 | 57 | ////////////////////////// 58 | // cfg.c 59 | void RegisterFileType(char *ext,char *type,char *nicetype,char *exe,char* command,int icon); 60 | void Cfg_LoadConfig(); 61 | int Cfg_ReadSave(HWND dlg,char *file); 62 | void Cfg_WriteSave(HWND dlg,FILE *fptr); 63 | int Cfg_GetSel(int sel,ITEM **item); 64 | 65 | ////////////////////////// 66 | // dlg.c 67 | void Dlg_Launch(HWND dlg,char prompt); 68 | int Dlg_AddPWAD(HWND dlg,char *file); 69 | void Dlg_ClearPWAD(HWND dlg); 70 | void Dlg_ClearAll(HWND dlg); 71 | void Dlg_Quit(HWND dlg,char save); 72 | void Dlg_PopulateWarp(HWND dlg,char *file); 73 | 74 | ////////////////////////// 75 | // From DoomDefs.h (by Bio) 76 | typedef struct{ 77 | BYTE type[4]; // Either "IWAD" or "PWAD" 78 | DWORD lumps; // Number of lumps in the dir 79 | DWORD dir; // the offset of the start of the dir 80 | }WADHEAD; 81 | typedef struct{ 82 | DWORD start; // where the lump starts 83 | DWORD length; // how long the lump is 84 | BYTE name[8]; // the lump's name (e.g. "MAP01") 85 | }LUMPHEAD; 86 | 87 | ////////////////////////// 88 | // zdl.rc 89 | #define IDC_STATIC -1 90 | // Icons 91 | #define ICO_ICON 200 92 | #define ICO_SAVE 201 93 | #define ICO_WAD 202 94 | #define ICO_PATCH 203 95 | #define ICO_UP 204 96 | #define ICO_DOWN 205 97 | #define BMP_LOGO 206 98 | // Main Dialog 99 | #define DLG_MAIN 100 100 | // External files 101 | #define LST_PWAD 1000 102 | #define BTN_ADD 1001 103 | #define BTN_REM 1002 104 | #define BTN_UP 1003 105 | #define BTN_DWN 1004 106 | // System 107 | #define LST_PORT 1005 108 | #define LST_IWAD 1006 109 | #define LST_WARP 1007 110 | #define LST_SKILL 1008 111 | #define EDT_EXTRA 1009 112 | // Buttons 113 | #define BTN_EXIT 1010 114 | #define BTN_ZDL 1011 115 | #define BTN_PANEL 1012 116 | #define BTN_LAUNCH 1013 117 | // Multiplay panel 118 | #define LST_GAME 1014 119 | #define EDT_HOST 1015 120 | #define LST_PLAYERS 1016 121 | #define EDT_FRAGS 1017 122 | #define EDT_DMF 1018 123 | #define EDT_DMF2 1019 124 | // Options Dialog 125 | #define DLG_OPTIONS 101 126 | //#define EDT_EXTRA // used in DLG_MAIN 127 | #define CHK_LAUNCH 1020 128 | //#define BTN_ZDL // used in DLG_MAIN 129 | //#define LST_PORT // used in DLG_MAIN 130 | //#define BTN_UP // used in DLG_MAIN 131 | //#define BTN_DWN // used in DLG_MAIN 132 | //#define BTN_ADD // used in DLG_MAIN 133 | //#define BTN_REM // used in DLG_MAIN 134 | //#define LST_IWAD // used in DLG_MAIN 135 | #define BTN_IUP 1021 136 | #define BTN_IDWN 1022 137 | #define BTN_IADD 1023 138 | #define BTN_IREM 1024 139 | #define BTN_OK 1025 140 | // File Dialog 141 | #define DLG_FILE 102 142 | #define EDT_NAME 1026 143 | #define EDT_PATH 1027 144 | #define BTN_BROWSE 1028 145 | //#define BTN_EXIT // used in DLG_MAIN 146 | //#define BTN_OK // used in DLG_OPTIONS 147 | // Association Dialog 148 | #define DLG_ASSOC 103 149 | #define CHK_ZDL 1029 150 | #define CHK_WAD 1030 151 | #define CHK_DEH 1031 152 | //#define BTN_OK // used in DLG_OPTIONS 153 | // About Dialog 154 | #define DLG_ABOUT 104 155 | //#define BTN_OK // used in DLG_OPTIONS 156 | // Menu 157 | #define MNU_MENU 500 158 | // Actions 159 | #define MNU_CMD 2000 160 | #define MNU_PWAD 2001 161 | #define MNU_CLEAR 2002 162 | #define MNU_LOAD 2003 163 | #define MNU_SAVE 2004 164 | #define MNU_OPTIONS 2005 165 | #define MNU_ABOUT 2006 166 | -------------------------------------------------------------------------------- /sub.c: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * ZDL! 3 | * Copyright (C) 2005 BioHazard / Vectec Software 4 | *********************************************************************** 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 or any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | *********************************************************************** 13 | * zdl.c : Window Procedures for minor dialogs 14 | **********************************************************************/ 15 | #include "zdl.h" 16 | 17 | LRESULT CALLBACK AboutProc(HWND Dlg,UINT Msg,WPARAM wp,LPARAM lp){if(Msg==WM_COMMAND&&LOWORD(wp)==BTN_OK){EndDialog(Dlg,0);}return 0;} 18 | 19 | LRESULT CALLBACK AssocProc(HWND dlg,UINT msg,WPARAM wp,LPARAM lp){ 20 | long sz=32; 21 | char tmp[64]={0}; 22 | switch(msg){ 23 | case WM_INITDIALOG: 24 | if(RegQueryValue(HKEY_CLASSES_ROOT,"ZDL.SaveFile",tmp,&sz)==ERROR_SUCCESS&&tmp[0]){SendMessage(GetDlgItem(dlg,CHK_ZDL),BM_SETCHECK,1,0);cfg.assoc[0]=1;}sz=MAX_PATH; 25 | if(RegQueryValue(HKEY_CLASSES_ROOT,"ZDL.WADFile",tmp,&sz)==ERROR_SUCCESS&&tmp[0]){SendMessage(GetDlgItem(dlg,CHK_WAD),BM_SETCHECK,1,0);cfg.assoc[1]=1;}sz=MAX_PATH; 26 | if(RegQueryValue(HKEY_CLASSES_ROOT,"ZDL.PatchFile",tmp,&sz)==ERROR_SUCCESS&&tmp[0]){SendMessage(GetDlgItem(dlg,CHK_DEH),BM_SETCHECK,1,0);cfg.assoc[2]=1;} 27 | break; 28 | case WM_COMMAND:switch(HIWORD(wp)){ 29 | case BN_CLICKED:if(LOWORD(wp)==BTN_OK){ 30 | // Save Files 31 | if(SendMessage(GetDlgItem(dlg,CHK_ZDL),BM_GETCHECK,0,0)){if(!cfg.assoc[0]){ // Set the value 32 | RegisterFileType(".zdl","ZDL.SaveFile","ZDL Saved Configuration File",_pgmptr,"\"%1\"",1); 33 | }}else{if(cfg.assoc[0]){ // Delete keys 34 | RegDeleteKey(HKEY_CLASSES_ROOT,".zdl"); 35 | SHDeleteKey(HKEY_CLASSES_ROOT,"ZDL.SaveFile"); 36 | }} 37 | if(SendMessage(GetDlgItem(dlg,CHK_WAD),BM_GETCHECK,0,0)){if(!cfg.assoc[1]){ // Set the value 38 | RegisterFileType(".wad","ZDL.WADFile","Doom Engine Data File",_pgmptr,"\"%1\"",2); 39 | }}else{if(cfg.assoc[1]){ // Delete keys 40 | RegDeleteKey(HKEY_CLASSES_ROOT,".wad"); 41 | SHDeleteKey(HKEY_CLASSES_ROOT,"ZDL.WADFile"); 42 | }} 43 | if(SendMessage(GetDlgItem(dlg,CHK_DEH),BM_GETCHECK,0,0)){if(!cfg.assoc[2]){ // Set the value 44 | RegisterFileType(".deh","ZDL.PatchFile","DeHackEd Patch",_pgmptr,"\"%1\"",3); 45 | RegisterFileType(".bex","ZDL.PatchFile","DeHackEd Patch",_pgmptr,"\"%1\"",3); 46 | }}else{if(cfg.assoc[2]){ // Delete keys 47 | RegDeleteKey(HKEY_CLASSES_ROOT,".deh"); 48 | RegDeleteKey(HKEY_CLASSES_ROOT,".bex"); 49 | SHDeleteKey(HKEY_CLASSES_ROOT,"ZDL.PatchFile"); 50 | }} 51 | EndDialog(dlg,0); 52 | }break; 53 | }break; 54 | }return 0; 55 | } 56 | 57 | LRESULT CALLBACK FileProc(HWND dlg,UINT msg,WPARAM wp,LPARAM lp){ 58 | FILE *fptr=0; 59 | ITEM **item=0; 60 | OPENFILENAME ofn={sizeof(OPENFILENAME),dlg,GetModuleHandle(NULL),0,0,0,0,0,MAX_PATH,0,0,0,0,OFN_FILEMUSTEXIST|OFN_EXPLORER,0,0,0,0,0,0}; 61 | switch(msg){ 62 | case WM_INITDIALOG: 63 | item=(arg1==LST_PORT)?(port):(iwad); 64 | if(arg2!=-1){ // Only set the text in the editboxes if it's not for a new entry 65 | SendMessage(dlg,WM_SETTEXT,0,(arg1==LST_PORT)?((LPARAM)"Edit Port"):((LPARAM)"Edit IWAD")); 66 | SendMessage(GetDlgItem(dlg,EDT_NAME),WM_SETTEXT,0,(LPARAM)item[arg2]->name); 67 | SendMessage(GetDlgItem(dlg,EDT_PATH),WM_SETTEXT,0,(LPARAM)item[arg2]->path); 68 | }else{SendMessage(dlg,WM_SETTEXT,0,(arg1==LST_PORT)?((LPARAM)"New Port"):((LPARAM)"New IWAD"));} 69 | SendMessage(GetDlgItem(dlg,EDT_NAME),EM_LIMITTEXT,MAX_NAME,0); 70 | SendMessage(GetDlgItem(dlg,EDT_PATH),EM_LIMITTEXT,MAX_PATH,0); 71 | break; 72 | case WM_COMMAND:switch(HIWORD(wp)){ 73 | case BN_CLICKED:switch(LOWORD(wp)){ 74 | case BTN_BROWSE: // Set up the path 75 | // Set up the file dialog 76 | memset((ofn.lpstrFile=malloc(MAX_PATH*sizeof(char))),0,MAX_PATH*sizeof(char)); 77 | ofn.lpstrFilter=(arg1==LST_PORT)?("Executable Files (*.exe)\0*.exe"):("IWAD Files (*.wad)\0*.wad"); 78 | ofn.lpstrDefExt=(arg1==LST_PORT)?("exe"):("wad"); 79 | ofn.lpstrTitle=(arg1==LST_PORT)?("Browse for Port Executable"):("Browse for IWAD"); 80 | // Get the file and set the editbox 81 | if(GetOpenFileName(&ofn)){SendMessage(GetDlgItem(dlg,EDT_PATH),WM_SETTEXT,0,(LPARAM)ofn.lpstrFile);} 82 | free(ofn.lpstrFile); 83 | break; 84 | case BTN_OK: // Save the changes 85 | item=(arg1==LST_PORT)?(port):(iwad); 86 | if(!SendMessage(GetDlgItem(dlg,EDT_NAME),WM_GETTEXTLENGTH,0,0)){MessageBox(dlg,"You must type a name.","Error",MB_OK|MB_ICONINFORMATION);break;} 87 | if(!SendMessage(GetDlgItem(dlg,EDT_PATH),WM_GETTEXTLENGTH,0,0)){MessageBox(dlg,"You must type a path.","Error",MB_OK|MB_ICONINFORMATION);break;} 88 | if(arg2==-1){ // If you are making a new item 89 | item[arg3]=malloc(sizeof(ITEM)); 90 | }else{arg3=arg2;} 91 | SendMessage(GetDlgItem(dlg,EDT_NAME),WM_GETTEXT,MAX_NAME,(LPARAM)item[arg3]->name); 92 | SendMessage(GetDlgItem(dlg,EDT_PATH),WM_GETTEXT,MAX_PATH,(LPARAM)item[arg3]->path); 93 | if((fptr=fopen(item[arg3]->path,"r"))){fclose(fptr); 94 | item[arg3]->avail=1; 95 | }else{item[arg3]->avail=0;} 96 | arg1=arg2=arg3=0; // Reset the temp vars 97 | case BTN_EXIT:EndDialog(dlg,0);break; 98 | }break; 99 | }break; 100 | }return 0; 101 | } 102 | -------------------------------------------------------------------------------- /zdl.rc: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * ZDL! 3 | * Copyright (C) 2005 BioHazard / Vectec Software 4 | *********************************************************************** 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 or any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | *********************************************************************** 13 | * zdl.rc : All the resource stuff 14 | **********************************************************************/ 15 | #include "zdl.h" 16 | 17 | ICO_ICON ICON DISCARDABLE "res\ico_icon.ico" 18 | ICO_SAVE ICON DISCARDABLE "res\ico_save.ico" 19 | ICO_WAD ICON DISCARDABLE "res\ico_wad.ico" 20 | ICO_PATCH ICON DISCARDABLE "res\ico_patch.ico" 21 | ICO_UP ICON DISCARDABLE "res\ico_up.ico" 22 | ICO_DOWN ICON DISCARDABLE "res\ico_down.ico" 23 | BMP_LOGO BITMAP DISCARDABLE "res\bmp_logo.bmp" 24 | 25 | DLG_MAIN DIALOG DISCARDABLE 0,0,180,172 26 | STYLE DS_CENTER|WS_MINIMIZEBOX|WS_POPUP|WS_CAPTION|WS_SYSMENU 27 | CAPTION "ZDL 3.0d" 28 | FONT 8,"MS Sans Serif" 29 | BEGIN 30 | LTEXT "Players",IDC_STATIC,0,152,44,8 31 | COMBOBOX LST_PLAYERS,0,160,44,91,CBS_DROPDOWNLIST|WS_VSCROLL 32 | LTEXT "Frag Limit",IDC_STATIC,44,152,44,8 33 | EDITTEXT EDT_FRAGS,44,160,44,12,ES_AUTOHSCROLL|NOT WS_TABSTOP 34 | LTEXT "DMFLAGS",IDC_STATIC,92,152,44,8 35 | EDITTEXT EDT_DMF,92,160,44,12,ES_AUTOHSCROLL|ES_NUMBER|NOT WS_TABSTOP 36 | LTEXT "DMFLAGS2",IDC_STATIC,136,152,44,8 37 | EDITTEXT EDT_DMF2,136,160,44,12,ES_AUTOHSCROLL|ES_NUMBER|NOT WS_TABSTOP 38 | LTEXT "Game Mode",IDC_STATIC,0,132,88,8 39 | COMBOBOX LST_GAME,0,140,88,40,CBS_DROPDOWNLIST|WS_VSCROLL 40 | LTEXT "Host IP Address",IDC_STATIC,92,132,88,8 41 | EDITTEXT EDT_HOST,92,140,88,12,ES_AUTOHSCROLL|NOT WS_TABSTOP 42 | PUSHBUTTON "Exit",BTN_EXIT,0,116,40,12,NOT WS_TABSTOP 43 | PUSHBUTTON "ZDL",BTN_ZDL,44,116,20,12,NOT WS_TABSTOP 44 | PUSHBUTTON "V",BTN_PANEL,116,116,20,12,BS_ICON|NOT WS_TABSTOP 45 | DEFPUSHBUTTON "Launch",BTN_LAUNCH,140,116,40,12,NOT WS_TABSTOP 46 | LTEXT "Extra Command-line Arguments",IDC_STATIC,0,92,180,8 47 | EDITTEXT EDT_EXTRA,0,100,180,12,ES_AUTOHSCROLL|NOT WS_TABSTOP 48 | LTEXT "Warp",IDC_STATIC,92,72,44,8 49 | COMBOBOX LST_WARP,92,80,44,96,CBS_DROPDOWN|CBS_UPPERCASE|CBS_AUTOHSCROLL|WS_VSCROLL 50 | LTEXT "Skill",IDC_STATIC,136,72,44,8 51 | COMBOBOX LST_SKILL,136,80,44,56,CBS_DROPDOWNLIST|WS_VSCROLL 52 | LTEXT "IWAD",IDC_STATIC,92,20,88,8 53 | LISTBOX LST_IWAD,92,28,88,44,LBS_NOINTEGRALHEIGHT|WS_VSCROLL 54 | LTEXT "Source Port",IDC_STATIC,92,0,88,8 55 | COMBOBOX LST_PORT,92,8,88,88,CBS_DROPDOWNLIST|WS_VSCROLL 56 | PUSHBUTTON "Add",BTN_ADD,0,80,24,12,NOT WS_TABSTOP 57 | PUSHBUTTON "Rem",BTN_REM,24,80,24,12,NOT WS_TABSTOP 58 | PUSHBUTTON "^",BTN_UP,56,80,16,12,BS_ICON|NOT WS_TABSTOP 59 | PUSHBUTTON "v",BTN_DWN,72,80,16,12,BS_ICON|NOT WS_TABSTOP 60 | LTEXT "External Files",IDC_STATIC,0,0,88,8 61 | LISTBOX LST_PWAD,0,8,88,72,LBS_NOINTEGRALHEIGHT|WS_VSCROLL,WS_EX_ACCEPTFILES 62 | END 63 | 64 | DLG_OPTIONS DIALOG DISCARDABLE 0,0,172,130 65 | STYLE WS_POPUP|WS_CAPTION 66 | CAPTION "ZDL Configuration" 67 | FONT 8,"MS Sans Serif" 68 | BEGIN 69 | DEFPUSHBUTTON "OK",BTN_OK,60,116,52,12 70 | LTEXT "IWADs",IDC_STATIC,88,32,84,8 71 | LISTBOX LST_IWAD,88,40,84,60,LBS_NOINTEGRALHEIGHT|WS_VSCROLL 72 | PUSHBUTTON "^",BTN_IUP,88,100,16,12,BS_ICON 73 | PUSHBUTTON "v",BTN_IDWN,104,100,16,12,BS_ICON 74 | PUSHBUTTON "Add",BTN_IADD,124,100,24,12 75 | PUSHBUTTON "Rem",BTN_IREM,148,100,24,12 76 | LTEXT "Source Ports",IDC_STATIC,0,32,84,8 77 | LISTBOX LST_PORT,0,40,84,60,LBS_NOINTEGRALHEIGHT | WS_VSCROLL 78 | PUSHBUTTON "^",BTN_UP,0,100,16,12,BS_ICON 79 | PUSHBUTTON "v",BTN_DWN,16,100,16,12,BS_ICON 80 | PUSHBUTTON "Add",BTN_ADD,36,100,24,12 81 | PUSHBUTTON "Rem",BTN_REM,60,100,24,12 82 | LTEXT "Always add these args",IDC_STATIC,0,0,172,8 83 | EDITTEXT EDT_EXTRA,0,8,172,12,ES_AUTOHSCROLL 84 | CONTROL "Launch *.ZDL files transparently",CHK_LAUNCH,"Button",BS_AUTOCHECKBOX,0,20,120,8 85 | PUSHBUTTON "Associations",BTN_ZDL,124,20,48,12 86 | END 87 | 88 | DLG_FILE DIALOG DISCARDABLE 0,0,164,58 89 | STYLE WS_POPUP|WS_CAPTION 90 | CAPTION "New Item" 91 | FONT 8,"MS Sans Serif" 92 | BEGIN 93 | DEFPUSHBUTTON "OK",BTN_OK,116,44,48,12 94 | PUSHBUTTON "Cancel",BTN_EXIT,0,44,47,12 95 | LTEXT "Path to File",IDC_STATIC,0,20,164,8 96 | EDITTEXT EDT_PATH,0,28,152,12,ES_AUTOHSCROLL 97 | PUSHBUTTON "...",BTN_BROWSE,152,28,12,12 98 | LTEXT "Name",IDC_STATIC,0,0,164,8 99 | EDITTEXT EDT_NAME,0,8,164,12,ES_AUTOHSCROLL 100 | END 101 | 102 | DLG_ASSOC DIALOG DISCARDABLE 0,0,96,41 103 | STYLE WS_POPUP|WS_CAPTION 104 | CAPTION "File Associations" 105 | FONT 8,"MS Sans Serif" 106 | BEGIN 107 | DEFPUSHBUTTON "OK",BTN_OK,24,28,48,12 108 | CONTROL "ZDL Saved configs (*.zdl)",CHK_ZDL,"Button",BS_AUTOCHECKBOX,0,0,96,8 109 | CONTROL "WAD Files (*.wad)",CHK_WAD,"Button",BS_AUTOCHECKBOX,0,8,96,8 110 | CONTROL "Patch Files (*.deh,*.bex)",CHK_DEH,"Button",BS_AUTOCHECKBOX,0,16,96,8 111 | END 112 | 113 | DLG_ABOUT DIALOG 0,0,172,65 114 | STYLE WS_POPUP|WS_CAPTION 115 | CAPTION "About ZDL" 116 | FONT 8,"MS Sans Serif" 117 | BEGIN 118 | DEFPUSHBUTTON "OK",BTN_OK,132,48,36,12 119 | CONTROL BMP_LOGO,IDC_STATIC,"Static",SS_BITMAP,0,0,68,33,WS_EX_DLGMODALFRAME 120 | LTEXT "ZDL V3.0d\nCopyright (c) 2005 BioHazard\nhttp://biohazard.drdteam.org/",IDC_STATIC,72,4,96,24 121 | LTEXT "Greetz to Risen, Enjay, DRDTeam.org, ZDoom.org, #DoomArmory + #DMClub!\nYou guys rock! Enjoy this! --Bio",IDC_STATIC,4,36,124,24 122 | END 123 | 124 | MNU_MENU MENU DISCARDABLE BEGIN 125 | POPUP "Menu" BEGIN 126 | POPUP "Action" BEGIN 127 | MENUITEM "Show Command Line",MNU_CMD 128 | MENUITEM "Clear PWAD list",MNU_PWAD 129 | MENUITEM "Clear All Fields",MNU_CLEAR 130 | END 131 | MENUITEM SEPARATOR 132 | MENUITEM "Load Config",MNU_LOAD 133 | MENUITEM "Save Config",MNU_SAVE 134 | MENUITEM SEPARATOR 135 | MENUITEM "Options",MNU_OPTIONS 136 | MENUITEM "About",MNU_ABOUT 137 | END 138 | END 139 | -------------------------------------------------------------------------------- /dlg.c: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * ZDL! 3 | * Copyright (C) 2005 BioHazard / Vectec Software 4 | *********************************************************************** 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 or any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | *********************************************************************** 13 | * dlg.c : Most of the important functions are here 14 | **********************************************************************/ 15 | #include "zdl.h" 16 | 17 | ///////////////////////////////////////////////// 18 | // Dlg_Launch : The most important function in ZDL 19 | void Dlg_Launch(HWND dlg,char prompt){ 20 | int i=0,q=MAX_PATH*3,pw=0,pt=0; 21 | char *cmd=0,*tmp=0; 22 | // Make sure there is a port selected 23 | if(!SendMessage(GetDlgItem(dlg,LST_PORT),CB_GETCOUNT,0,0)||!SendMessage(GetDlgItem(dlg,LST_IWAD),LB_GETCOUNT,0,0)){MessageBox(dlg,STR_NOITEMS,"Error!",MB_OK|MB_ICONEXCLAMATION);return;} 24 | // Determine how long the cmd string has to be 25 | for(i=0;pwad[i]&&ipath,iwad[Cfg_GetSel(SendMessage(GetDlgItem(dlg,LST_IWAD),LB_GETCURSEL,0,0),iwad)]->path,(strlen(cfg.always))?(" "):(""),cfg.always); 31 | // Warp and Skill 32 | SendMessage(GetDlgItem(dlg,LST_WARP),WM_GETTEXT,MAX_PATH,(LPARAM)tmp); 33 | if(stricmp(tmp,"NONE")){ 34 | strncat(cmd," +map ",q-strlen(cmd)); 35 | strncat(cmd,tmp,q-strlen(cmd)); 36 | _snprintf(&cmd[strlen(cmd)],q-strlen(cmd)," -skill %d",SendMessage(GetDlgItem(dlg,LST_SKILL),CB_GETCURSEL,0,0)+1); 37 | } 38 | // PWADs and DEHs 39 | for(i=0;pwad[i]&&ipath,MAX_PATH); 96 | strrchr(tmp,'\\')[0]='\0'; 97 | chdir(tmp); 98 | } 99 | // GoooOOooooOOOOOoooOOO! 100 | WinExec(cmd,SW_NORMAL); 101 | exit: 102 | free(cmd);free(tmp); 103 | } 104 | 105 | ///////////////////////////////////////////////// 106 | // Dlg_AddPWAD : Adds an item to the PWAD list 107 | int Dlg_AddPWAD(HWND dlg,char *file){ 108 | int i=SendMessage(GetDlgItem(dlg,LST_PWAD),LB_GETCOUNT,0,0); 109 | if(i>=MAX_PWAD||!strrchr(file,'.')||!stricmp(strrchr(file,'.'),".zdl")||!stricmp(strrchr(file,'.'),".ini")){return 0;} 110 | memset((pwad[i]=malloc((MAX_PATH+1)*sizeof(char))),0,MAX_PATH*sizeof(char)); 111 | strncpy(pwad[i],file,MAX_PATH); 112 | SendMessage(GetDlgItem(dlg,LST_PWAD),LB_ADDSTRING,0,(strrchr(file,'\\'))?((LPARAM)strrchr(file,'\\')+1):((LPARAM)file)); 113 | return 1; 114 | } 115 | ///////////////////////////////////////////////// 116 | // Dlg_ClearPWAD : Clears all the data from the PWAD list 117 | void Dlg_ClearPWAD(HWND dlg){ 118 | int i=0; 119 | SendMessage(GetDlgItem(dlg,LST_PWAD),LB_RESETCONTENT,0,0); 120 | for(i=0;pwad[i]&&iname,i,port[i]->path);} 156 | } 157 | if(iwad[0]){ // Write IWADs 158 | fprintf(fptr,"[zdl.iwads]\n"); 159 | for(i=0;iwad[i]&&iname,i,iwad[i]->path);} 160 | } 161 | Cfg_WriteSave(dlg,fptr); 162 | fclose(fptr); 163 | } 164 | // Delete port and IWAD data 165 | for(i=0;port[i]&&i is required (and perhaps ) 34 | int ReadINI(char *section,char *entry,char *out,int limit,char *ini){ 35 | int i=0; 36 | FILE *fptr=0; 37 | char *tmp=0,*sct=0,*key=0; 38 | if(!(fptr=fopen(ini,"r"))){return -1;} 39 | // set up the compare strings 40 | i=(strlen(section)+3)*sizeof(char); 41 | memset((sct=malloc(i)),0,i); 42 | strcpy(sct,"[");strcat(sct,section);strcat(sct,"]"); // make [sct] = "[*section*]" 43 | i=(strlen(entry)+2)*sizeof(char); 44 | memset((key=malloc(i)),0,i); 45 | strcpy(key,entry);strcat(key,"="); // make [key] = "*entry*=" 46 | i=(strlen((strlen(sct)>strlen(key))?(sct):(key))+1)*sizeof(char); 47 | memset((tmp=malloc(i)),0,i); 48 | // Get to the proper section 49 | do{fgets(tmp,strlen(sct)+1,fptr); 50 | if(feof(fptr)){i=-2;goto exit;} // Die if [section] can't be found 51 | }while(strcmp(tmp,sct)); 52 | // Find the right entry 53 | do{fgets(tmp,strlen(key)+1,fptr); 54 | if(feof(fptr)||tmp[0]=='['){i=-3;goto exit;} // Die if [entry] can't be found in [section] 55 | }while(strcmp(tmp,key)); 56 | // Copy the string to the buffer 57 | fgets(out,limit,fptr); // Read the option to the buffer 58 | if(out[strlen(out)-1]=='\n'){out[strlen(out)-1]='\0';} // chop off the \n if there is one 59 | i=strlen(out); 60 | exit: // Free crap and exit 61 | fclose(fptr);free(tmp);free(sct);free(key); 62 | return i; 63 | } 64 | 65 | /////////////////////////////////////////////////////////////////// 66 | // RegisterFileType - Registers a filetype with Windows 67 | // Written by BioHazard on November 30th 2005 -- Version 1.0 68 | //// USAGE ////////////////////////////////////////////////////////// 69 | // ext : The extension to register 70 | // type : The data type to associate with 71 | // nicetype : Description of the data type 72 | // exe : Executable to run the files with 73 | // command : command line to stick after [exe] 74 | // icon : 0-based index of icon in [exe] to be uesd for files 75 | //// REMARKS //////////////////////////////////////////////////////// 76 | // Testen to work in WinXP-Pro and Win2000 77 | void RegisterFileType(char *ext,char *type,char *nicetype,char *exe,char* command,int icon){ 78 | int i=0; 79 | char *tmp=0,*tmp2=0; 80 | i=strlen(command)+strlen(exe)+MAX_PATH; 81 | memset((tmp=malloc(i*sizeof(char))),0,i*sizeof(char)); 82 | memset((tmp2=malloc(i*sizeof(char))),0,i*sizeof(char)); 83 | // Delete the old extensions 84 | _snprintf(tmp,i,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\%s",ext); 85 | SHDeleteKey(HKEY_CURRENT_USER,tmp); 86 | SHDeleteKey(HKEY_CLASSES_ROOT,ext); 87 | SHDeleteKey(HKEY_CLASSES_ROOT,type); 88 | // Add new keys 89 | RegSetValue(HKEY_CLASSES_ROOT,ext,REG_SZ,type,strlen(type)); 90 | RegSetValue(HKEY_CLASSES_ROOT,type,REG_SZ,nicetype,strlen(nicetype)); 91 | _snprintf(tmp,i,"%s\\DefaultIcon",type); 92 | _snprintf(tmp2,i,"%s,%d",_pgmptr,icon); 93 | RegSetValue(HKEY_CLASSES_ROOT,tmp,REG_SZ,tmp2,strlen(tmp2)); 94 | _snprintf(tmp,i,"%s\\shell\\open\\command",type); 95 | _snprintf(tmp2,i,"\"%s\" %s",exe,command); 96 | RegSetValue(HKEY_CLASSES_ROOT,tmp,REG_SZ,tmp2,strlen(tmp2)); 97 | // Free crap 98 | free(tmp);free(tmp2); 99 | } 100 | 101 | ///////////////////////////////////////////////// 102 | // Cfg_LoadConfig : Loads data from the INI file 103 | void Cfg_LoadConfig(){ 104 | int i=0; 105 | FILE *fptr=0; 106 | char tmp[8]={0}; 107 | ReadINI("zdl.general","alwaysadd",cfg.always,sizeof(cfg.always),cfg.ini); 108 | ReadINI("zdl.general","zdllaunch",tmp,sizeof(tmp),cfg.ini); 109 | if(tmp[0]=='1'){cfg.launch=1;}else{cfg.launch=0;} 110 | // Load ports 111 | for(i=0;iname,MAX_NAME,cfg.ini)<0){free(port[i]);port[i]=0;break;} 115 | _snprintf(tmp,sizeof(tmp),"p%df",i); 116 | if(ReadINI("zdl.ports",tmp,port[i]->path,MAX_PATH,cfg.ini)<0){free(port[i]);port[i]=0;break;} 117 | if((fptr=fopen(port[i]->path,"r"))){ 118 | fclose(fptr); 119 | port[i]->avail=1; 120 | } 121 | } 122 | // Load IWADs 123 | for(i=0;iname,MAX_NAME,cfg.ini)<0){free(iwad[i]);iwad[i]=0;break;} 127 | _snprintf(tmp,sizeof(tmp),"i%df",i); 128 | if(ReadINI("zdl.iwads",tmp,iwad[i]->path,MAX_PATH,cfg.ini)<0){free(iwad[i]);iwad[i]=0;break;} 129 | if((fptr=fopen(iwad[i]->path,"r"))){ 130 | fclose(fptr); 131 | iwad[i]->avail=1; 132 | } 133 | } 134 | } 135 | 136 | ///////////////////////////////////////// 137 | // Cfg_GetSel : Gets the Port/IWAD index 138 | int Cfg_GetSel(int sel,ITEM **item){ 139 | int i=0,q=0; 140 | for(i=0;q<=sel;i++){if(!item[i]){return -1;} 141 | if(item[i]->avail){q++;} 142 | } 143 | return i-1; 144 | } 145 | 146 | ///////////////////////////////////////////////// 147 | // Cfg_GetSelStr : Gets a selection index from a name 148 | int Cfg_GetSelStr(char *name,ITEM **item){ 149 | int i=0,q=0,r=0; 150 | for(i=0;;i++){ // Get to the real index 151 | if(!item[i]||i>=MAX_ITEM){return -2;} 152 | if(!stricmp(name,item[i]->name)){break;} 153 | } 154 | if(!item[i]->avail){return -1;} // Make sure the found entry is available 155 | for(q=0;qavail){r++;}} // Figure out what the list index is 156 | return r; 157 | } 158 | 159 | ///////////////////////////////////////////////// 160 | // Cfg_ReadSave : Reads a save file and applies it's settings 161 | int Cfg_ReadSave(HWND dlg,char *file){ 162 | int i=0,q=0; 163 | char *tmp=0,*tmp2=0; 164 | int boxid[2][6]={{LST_WARP,EDT_EXTRA,EDT_HOST,EDT_FRAGS,EDT_DMF,EDT_DMF2},{LST_SKILL,LST_GAME,LST_PLAYERS}}; 165 | char *box[2][6]={{"warp","extra","host","fraglimit","dmflags","dmflags2"},{"skill","gametype","players"}}; 166 | if(Cfg_GetSel(0,port)==-1||Cfg_GetSel(0,iwad)==-1){MessageBox(dlg,STR_NOITEMS,"Error!",MB_OK|MB_ICONEXCLAMATION);return 0;} 167 | memset((tmp=malloc(MAX_PATH*sizeof(char))),0,MAX_PATH*sizeof(char)); 168 | memset((tmp2=malloc(MAX_PATH*sizeof(char))),0,MAX_PATH*sizeof(char)); 169 | // Try to find [zdl.save] to see if this is a save file 170 | if(ReadINI("zdl.save","keyb",tmp,MAX_PATH,file)==-2){ 171 | MessageBox(dlg,"This save file is an invalid format.","Error!",MB_OK|MB_ICONEXCLAMATION); 172 | i=0;goto exit; 173 | } 174 | // Start reading the save data 175 | // Port 176 | if(ReadINI("zdl.save","port",tmp,MAX_PATH,file)>0){ 177 | if(!port[0]||(i=Cfg_GetSelStr(tmp,port))<0){ 178 | _snprintf(tmp2,MAX_PATH,STR_NEEDPRT,tmp,port[Cfg_GetSel(0,port)]->name); 179 | if(MessageBox(dlg,tmp2,"Port not found!",MB_YESNO|MB_ICONQUESTION)==IDNO){i=0;goto exit;} 180 | i=0; 181 | } 182 | } 183 | // Iwad 184 | if(ReadINI("zdl.save","iwad",tmp,MAX_PATH,file)>0){ 185 | if(!iwad[0]||(q=Cfg_GetSelStr(tmp,iwad))<0){ 186 | _snprintf(tmp2,MAX_PATH,STR_NEEDIWD,tmp,iwad[Cfg_GetSel(0,iwad)]->name); 187 | if(MessageBox(dlg,tmp2,"Load Failed!",MB_YESNO|MB_ICONQUESTION)==IDNO){i=0;goto exit;} 188 | q=0; 189 | } 190 | } 191 | Dlg_ClearAll(dlg); 192 | SendMessage(GetDlgItem(dlg,LST_PORT),CB_SETCURSEL,i,0); 193 | SendMessage(GetDlgItem(dlg,LST_IWAD),LB_SETCURSEL,q,0); 194 | Dlg_PopulateWarp(dlg,iwad[Cfg_GetSel(q,iwad)]->path); 195 | // EditBoxes (Warp, Extra, Host, Frags, DMF, DMF2) 196 | for(i=0;i<6;i++){if(ReadINI("zdl.save",box[0][i],tmp,MAX_PATH,file)>0){ 197 | SendMessage(GetDlgItem(dlg,boxid[0][i]),WM_SETTEXT,0,(LPARAM)tmp); 198 | }} 199 | // ComboBoxes (Skill, GameType, Players) 200 | for(i=0;i<3;i++){if(ReadINI("zdl.save",box[1][i],tmp,MAX_PATH,file)>0){ 201 | SendMessage(GetDlgItem(dlg,boxid[1][i]),CB_SETCURSEL,(WPARAM)atoi(tmp),0); 202 | }} 203 | // Dialog Mode 204 | if(ReadINI("zdl.save","dlgmode",tmp,MAX_PATH,file)>0&&!stricmp(tmp,"open")&&cfg.dlgmode){ 205 | SendMessage(dlg,WM_COMMAND,MAKELONG(BTN_PANEL,BN_CLICKED),0); 206 | } 207 | // PWAD list 208 | for(i=0;i0){ 211 | if(!Dlg_AddPWAD(dlg,tmp)){i--;} 212 | }else{break;} 213 | if(i>=MAX_PWAD){MessageBox(dlg,STR_MAXPWAD,"Error!",MB_OK|MB_ICONEXCLAMATION);break;} 214 | q++;}i=1; 215 | exit: // Free crap and exit 216 | free(tmp);free(tmp2); 217 | return i; 218 | } 219 | 220 | ///////////////////////////////////////////////// 221 | // Cfg_WriteSave : Writes dialog data to the file given 222 | void Cfg_WriteSave(HWND dlg,FILE *fptr){ 223 | int i=0; 224 | char *tmp=0; 225 | // Used for the box grabber 226 | int boxid[]={EDT_EXTRA,EDT_HOST,EDT_FRAGS,EDT_DMF,EDT_DMF2}; 227 | char *box[]={"extra=%s\n","host=%s\n","fraglimit=%s\n","dmflags=%s\n","dmflags2=%s\n"}; 228 | memset((tmp=malloc(MAX_PATH*sizeof(char))),0,MAX_PATH*sizeof(char)); 229 | fprintf(fptr,"[zdl.save]\n"); 230 | // Standard stuff 231 | if(SendMessage(GetDlgItem(dlg,LST_PORT),CB_GETCURSEL,0,0)!=LB_ERR){fprintf(fptr,"port=%s\n",port[Cfg_GetSel(SendMessage(GetDlgItem(dlg,LST_PORT),CB_GETCURSEL,0,0),port)]->name);} 232 | if(SendMessage(GetDlgItem(dlg,LST_IWAD),LB_GETCURSEL,0,0)!=LB_ERR){fprintf(fptr,"iwad=%s\n",iwad[Cfg_GetSel(SendMessage(GetDlgItem(dlg,LST_IWAD),LB_GETCURSEL,0,0),iwad)]->name);} 233 | if(!cfg.dlgmode){fputs("dlgmode=open\n",fptr);} 234 | SendMessage(GetDlgItem(dlg,LST_WARP),WM_GETTEXT,MAX_PATH,(LPARAM)tmp); 235 | if(tmp[0]&&stricmp(tmp,"NONE")){fprintf(fptr,"warp=%s\nskill=%d\n",tmp,SendMessage(GetDlgItem(dlg,LST_SKILL),CB_GETCURSEL,0,0));} 236 | if((i=SendMessage(GetDlgItem(dlg,LST_GAME),CB_GETCURSEL,0,0))){fprintf(fptr,"gametype=%d\n",i);} 237 | if((i=SendMessage(GetDlgItem(dlg,LST_PLAYERS),CB_GETCURSEL,0,0))){fprintf(fptr,"players=%d\n",i);} 238 | for(i=0;i<5;i++){ // Grab text from the boxes 239 | if(SendMessage(GetDlgItem(dlg,boxid[i]),WM_GETTEXTLENGTH,0,0)){ 240 | SendMessage(GetDlgItem(dlg,boxid[i]),WM_GETTEXT,MAX_PATH,(LPARAM)tmp); 241 | fprintf(fptr,box[i],tmp); 242 | } 243 | } 244 | // PWADs 245 | for(i=0;pwad[i]&&iname);} 44 | for(i=0;iwad[i]&&iname);} 45 | break; 46 | case WM_COMMAND:switch(HIWORD(wp)){ 47 | case LBN_DBLCLK:switch(LOWORD(wp)){ 48 | case LST_PORT:case LST_IWAD: 49 | arg1=q=LOWORD(wp); 50 | arg2=i=(short)SendMessage(GetDlgItem(dlg,LOWORD(wp)),LB_GETCURSEL,0,0); 51 | item=(LOWORD(wp)==LST_PORT)?(port):(iwad); 52 | DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(DLG_FILE),dlg,FileProc); 53 | // Update the string in the listbox 54 | SendMessage(GetDlgItem(dlg,q),LB_DELETESTRING,i,0); 55 | SendMessage(GetDlgItem(dlg,q),LB_INSERTSTRING,i,(LPARAM)item[i]->name); 56 | SendMessage(GetDlgItem(dlg,q),LB_SETCURSEL,q,0); 57 | // Update the file's availabillity 58 | if((fptr=fopen(item[i]->path,"r"))){fclose(fptr);item[i]->avail=1;}else{item[i]->avail=0;} 59 | arg1=arg2=0; // Reset the temp vars 60 | break; 61 | }break; 62 | case BN_CLICKED:switch(LOWORD(wp)){ 63 | case BTN_ZDL:DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(DLG_ASSOC),dlg,AssocProc);break; 64 | case BTN_ADD:case BTN_IADD: 65 | item=(LOWORD(wp)==BTN_ADD)?(port):(iwad); 66 | arg1=q=(LOWORD(wp)==BTN_ADD)?(LST_PORT):(LST_IWAD); 67 | arg2=-1; // -1 == BTN_ADD pressed 68 | arg3=i=(short)SendMessage(GetDlgItem(dlg,q),LB_GETCOUNT,0,0); 69 | DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(DLG_FILE),dlg,FileProc); 70 | // If a new entry was added, add it to the listbox 71 | if(item[i]){SendMessage(GetDlgItem(dlg,q),LB_ADDSTRING,0,(LPARAM)item[i]->name);} 72 | arg1=arg2=arg3=0; // Reset the temp vars 73 | break; 74 | case BTN_REM:case BTN_IREM: // Delete button 75 | item=(LOWORD(wp)==BTN_REM)?(port):(iwad); 76 | q=(LOWORD(wp)==BTN_REM)?(LST_PORT):(LST_IWAD); 77 | if((i=SendMessage(GetDlgItem(dlg,q),LB_GETCURSEL,0,0))!=LB_ERR){ 78 | free(item[i]); 79 | SendMessage(GetDlgItem(dlg,q),LB_DELETESTRING,i,0); 80 | SendMessage(GetDlgItem(dlg,q),LB_SETCURSEL,i,0); 81 | for(i;item[i]&&iname); 90 | SendMessage(GetDlgItem(dlg,q),LB_DELETESTRING,i+1,0); 91 | SendMessage(GetDlgItem(dlg,q),LB_SETCURSEL,i-1,0); 92 | // Move the item 93 | tmpi=item[i-1];item[i-1]=item[i];item[i]=tmpi; 94 | } 95 | break; 96 | case BTN_DWN:case BTN_IDWN: // Move down 97 | item=(LOWORD(wp)==BTN_DWN)?(port):(iwad); 98 | q=(LOWORD(wp)==BTN_DWN)?(LST_PORT):(LST_IWAD); 99 | i=SendMessage(GetDlgItem(dlg,q),LB_GETCURSEL,0,0); 100 | if((i=SendMessage(GetDlgItem(dlg,q),LB_GETCURSEL,0,0))!=LB_ERR&&i!=SendMessage(GetDlgItem(dlg,q),LB_GETCOUNT,0,0)-1){ 101 | // Move the entry in the window 102 | SendMessage(GetDlgItem(dlg,q),LB_INSERTSTRING,i+2,(LPARAM)item[i]->name); 103 | SendMessage(GetDlgItem(dlg,q),LB_DELETESTRING,i,0); 104 | SendMessage(GetDlgItem(dlg,q),LB_SETCURSEL,i+1,0); 105 | // Move the item 106 | tmpi=item[i+1];item[i+1]=item[i];item[i]=tmpi; 107 | } 108 | break; 109 | case BTN_OK: 110 | SendMessage(GetDlgItem(dlg,EDT_EXTRA),WM_GETTEXT,sizeof(cfg.always),(LPARAM)cfg.always); 111 | cfg.launch=(char)SendMessage(GetDlgItem(dlg,CHK_LAUNCH),BM_GETCHECK,0,0); 112 | EndDialog(dlg,0); 113 | break; 114 | }break; 115 | }break; 116 | }return 0; 117 | } 118 | 119 | LRESULT CALLBACK MainProc(HWND dlg,UINT msg,WPARAM wp,LPARAM lp){ 120 | int i=0,q=0,r=0,m=0; 121 | POINT pt; 122 | RECT rct; 123 | FILE *fptr=0; 124 | char *tmp=0,*tmp2=0,*label[3][9]={{"V. Easy","Easy","Normal","Hard","V. Hard"},{"Single-Player","Multi Co-operative","Multi DeathMatch"},{"Joining","1","2","3","4","5","6","7","8"}}; 125 | OPENFILENAME ofn={sizeof(OPENFILENAME),dlg,GetModuleHandle(NULL),0,0,0,0,0,MAX_PATH,0,0,0,0,0,0,0,0,0,0,0}; 126 | switch(msg){ 127 | case WM_INITDIALOG: 128 | // Set icons 129 | SendMessage(dlg,WM_SETICON,ICON_SMALL,(LPARAM)LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(ICO_ICON))); 130 | SendMessage(dlg,WM_SETICON,ICON_BIG,(LPARAM)LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(ICO_ICON))); 131 | SendMessage(GetDlgItem(dlg,BTN_UP),BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(ICO_UP))); 132 | SendMessage(GetDlgItem(dlg,BTN_DWN),BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(ICO_DOWN))); 133 | // Insert list data 134 | for(i=0;i<5;i++){SendMessage(GetDlgItem(dlg,LST_SKILL),CB_ADDSTRING,0,(LPARAM)label[0][i]);} 135 | SendMessage(GetDlgItem(dlg,LST_SKILL),CB_SETCURSEL,2,0); 136 | for(i=0;i<3;i++){SendMessage(GetDlgItem(dlg,LST_GAME),CB_ADDSTRING,0,(LPARAM)label[1][i]);} 137 | SendMessage(GetDlgItem(dlg,LST_GAME),CB_SETCURSEL,0,0); 138 | for(i=0;i<9;i++){SendMessage(GetDlgItem(dlg,LST_PLAYERS),CB_ADDSTRING,0,(LPARAM)label[2][i]);} 139 | SendMessage(GetDlgItem(dlg,LST_PLAYERS),CB_SETCURSEL,0,0); 140 | // Set text limits 141 | SendMessage(GetDlgItem(dlg,LST_WARP),CB_LIMITTEXT,8,0); 142 | SendMessage(GetDlgItem(dlg,EDT_EXTRA),EM_LIMITTEXT,128,0); 143 | SendMessage(GetDlgItem(dlg,EDT_HOST),EM_LIMITTEXT,21,0); 144 | SendMessage(GetDlgItem(dlg,EDT_FRAGS),EM_LIMITTEXT,3,0); 145 | SendMessage(GetDlgItem(dlg,EDT_DMF),EM_LIMITTEXT,8,0); 146 | SendMessage(GetDlgItem(dlg,EDT_DMF2),EM_LIMITTEXT,8,0); 147 | // Fill the port and IWAD arrays 148 | if((i=Cfg_GetSel(0,port))!=-1){ 149 | for(i;port[i]&&iavail){SendMessage(GetDlgItem(dlg,LST_PORT),CB_ADDSTRING,0,(LPARAM)port[i]->name);}} 150 | SendMessage(GetDlgItem(dlg,LST_PORT),CB_SETCURSEL,0,0); 151 | } 152 | if((i=Cfg_GetSel(0,iwad))!=-1){ 153 | for(i;iwad[i]&&iavail){SendMessage(GetDlgItem(dlg,LST_IWAD),LB_ADDSTRING,0,(LPARAM)iwad[i]->name);}} 154 | SendMessage(GetDlgItem(dlg,LST_IWAD),LB_SETCURSEL,0,0); 155 | if(Cfg_GetSel(0,iwad)!=-1){Dlg_PopulateWarp(dlg,iwad[Cfg_GetSel(0,iwad)]->path);} 156 | } 157 | // Set the window size 158 | SendMessage(dlg,WM_COMMAND,MAKELONG(BTN_PANEL,BN_CLICKED),0); 159 | // Load the last configuration 160 | if(Cfg_GetSel(0,port)==-1||Cfg_GetSel(0,iwad)==-1){MessageBox(dlg,STR_NOITEMS,"Error!",MB_OK|MB_ICONEXCLAMATION);break;} 161 | if(!cmdline[0]){Cfg_ReadSave(dlg,cfg.ini);break;} 162 | // Process the command-line stuff 163 | memset((tmp=malloc(MAX_PATH*sizeof(char))),0,MAX_PATH*sizeof(char)); 164 | for(i=SendMessage(GetDlgItem(dlg,LST_PWAD),LB_GETCOUNT,0,0);cmdline[q];i++){ 165 | if(i>=MAX_PWAD){MessageBox(dlg,STR_MAXPWAD,"Error!",MB_OK|MB_ICONEXCLAMATION);break;} 166 | for(q;cmdline[q];q++){ 167 | if(cmdline[q]=='\"'){m=(m)?(0):(1);continue;} 168 | if(rpath,"File Info",MB_OK|MB_ICONINFORMATION);break; 193 | }break; 194 | // IWAD List 195 | case LBN_SELCHANGE:if(LOWORD(wp)==LST_IWAD){Dlg_PopulateWarp(dlg,iwad[Cfg_GetSel(SendMessage(GetDlgItem(dlg,LST_IWAD),LB_GETCURSEL,0,0),iwad)]->path);}break; 196 | // Buttons 197 | case BN_CLICKED:switch(LOWORD(wp)){ 198 | case BTN_LAUNCH:Dlg_Launch(dlg,0);break; 199 | case MNU_CMD:Dlg_Launch(dlg,1);break; 200 | case BTN_ZDL: 201 | GetCursorPos(&pt); 202 | TrackPopupMenu(GetSubMenu(LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(MNU_MENU)),0),TPM_LEFTALIGN,pt.x,pt.y,0,dlg,0); 203 | break; 204 | // Loading and Saving 205 | case MNU_SAVE:case MNU_LOAD: 206 | memset((ofn.lpstrFile=malloc(MAX_PATH*sizeof(char))),0,MAX_PATH*sizeof(char)); 207 | ofn.lpstrFilter="ZDL Save Files (*.zdl,*.ini)\0*.zdl;*.ini\0All Files (*.*)\0*.*\0"; 208 | ofn.lpstrDefExt="zdl"; 209 | ofn.Flags=(LOWORD(wp)==MNU_SAVE)?(OFN_EXPLORER):(OFN_FILEMUSTEXIST|OFN_EXPLORER); 210 | ofn.lpstrTitle=(LOWORD(wp)==MNU_SAVE)?("Save ZDL Config"):("Load a Saved ZDL Config"); 211 | if(LOWORD(wp)==MNU_SAVE){ 212 | if(GetSaveFileName(&ofn)&&(fptr=fopen(ofn.lpstrFile,"w"))){ 213 | Cfg_WriteSave(dlg,fptr); 214 | fclose(fptr); 215 | } 216 | }else{if(GetOpenFileName(&ofn)){Cfg_ReadSave(dlg,ofn.lpstrFile);}} 217 | free(ofn.lpstrFile); 218 | break; 219 | case MNU_CLEAR:Dlg_ClearAll(dlg);break; 220 | case MNU_PWAD:Dlg_ClearPWAD(dlg);break; 221 | // Open and close the multiplay panel 222 | case BTN_PANEL: 223 | rct.top=0;rct.left=0;rct.right=270;rct.bottom=(cfg.dlgmode)?(282):(210); 224 | cfg.dlgmode=(cfg.dlgmode)?(0):(1); 225 | AdjustWindowRect(&rct,WS_POPUP|WS_CAPTION,0); 226 | SetWindowPos(dlg,0,0,0,rct.right-rct.left,rct.bottom-rct.top,SWP_NOMOVE|SWP_NOZORDER); 227 | SendMessage(GetDlgItem(dlg,BTN_PANEL),BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE((cfg.dlgmode)?(ICO_DOWN):(ICO_UP)))); 228 | break; 229 | case BTN_ADD:if(pwad[MAX_PWAD-1]){MessageBox(dlg,"Too many PWADs loaded!","Error!",MB_OK|MB_ICONEXCLAMATION);break;} 230 | ofn.lpstrFilter="ZDoom Addon Files (*.wad,*.deh,*.bex,*.zip)\0*.wad;*.deh;*.bex;*.zip\0All Files (*.*)\0*.*\0"; 231 | ofn.Flags=OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_ALLOWMULTISELECT; 232 | ofn.lpstrTitle="Load an External File"; 233 | ofn.lpstrDefExt="wad"; 234 | // Get the file and set the editbox 235 | memset((ofn.lpstrFile=malloc(MAX_PATH*sizeof(char))),0,MAX_PATH*sizeof(char)); 236 | if(!GetOpenFileName(&ofn)){break;} 237 | i=SendMessage(GetDlgItem(dlg,LST_PWAD),LB_GETCOUNT,0,0); 238 | if(!ofn.nFileExtension){ // Multiple files 239 | memset((tmp2=malloc(MAX_PATH*sizeof(char))),0,MAX_PATH*sizeof(char)); 240 | tmp=ofn.lpstrFile+ofn.nFileOffset; 241 | for(i;i=MAX_PWAD){MessageBox(dlg,STR_MAXPWAD,"Error!",MB_OK|MB_ICONEXCLAMATION);break;} 246 | } 247 | free(tmp2); 248 | }else{Dlg_AddPWAD(dlg,ofn.lpstrFile);} 249 | free(ofn.lpstrFile); 250 | break; 251 | case BTN_REM: // Delete button 252 | if((i=SendMessage(GetDlgItem(dlg,LST_PWAD),LB_GETCURSEL,0,0))!=LB_ERR){ 253 | free(pwad[i]); 254 | SendMessage(GetDlgItem(dlg,LST_PWAD),LB_DELETESTRING,i,0); 255 | SendMessage(GetDlgItem(dlg,LST_PWAD),LB_SETCURSEL,i,0); 256 | for(i;pwad[i]&&iavail){SendMessage(GetDlgItem(dlg,LST_PORT),CB_ADDSTRING,0,(LPARAM)port[i]->name);}} 286 | SendMessage(GetDlgItem(dlg,LST_PORT),CB_SETCURSEL,0,0); 287 | SendMessage(GetDlgItem(dlg,LST_IWAD),LB_RESETCONTENT,0,0); 288 | for(i=0;iwad[i]&&iavail){SendMessage(GetDlgItem(dlg,LST_IWAD),LB_ADDSTRING,0,(LPARAM)iwad[i]->name);}} 289 | SendMessage(GetDlgItem(dlg,LST_IWAD),LB_SETCURSEL,0,0); 290 | SendMessage(GetDlgItem(dlg,LST_WARP),CB_RESETCONTENT,0,0); 291 | if(SendMessage(GetDlgItem(dlg,LST_IWAD),LB_GETCURSEL,0,0)!=LB_ERR){Dlg_PopulateWarp(dlg,iwad[Cfg_GetSel(0,iwad)]->path);} 292 | break; 293 | case MNU_ABOUT:DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(DLG_ABOUT),dlg,AboutProc);break; 294 | // Ways to exit 295 | case BTN_EXIT:SendMessage(dlg,WM_CLOSE,0,0);break; 296 | }break; 297 | }break; 298 | case WM_DROPFILES: // Add files dropped onto the pwad box 299 | r=DragQueryFile((HDROP)wp,0xFFFFFFFF,0,0); 300 | memset((tmp2=malloc(MAX_PATH*sizeof(char))),0,MAX_PATH*sizeof(char)); 301 | for(i=SendMessage(GetDlgItem(dlg,LST_PWAD),LB_GETCOUNT,0,0);q=MAX_PWAD){MessageBox(dlg,STR_MAXPWAD,"Error!",MB_OK|MB_ICONEXCLAMATION);break;} 303 | DragQueryFile((HDROP)wp,q,tmp2,MAX_PATH); 304 | if(!Dlg_AddPWAD(dlg,tmp2)){i--;} 305 | q++;} 306 | DragFinish((HDROP)wp); 307 | free(tmp2); 308 | break; 309 | case WM_CLOSE:Dlg_Quit(dlg,1);break; 310 | }return 0; 311 | } 312 | 313 | int WINAPI WinMain(HINSTANCE inst,HINSTANCE pinst,LPSTR cline,int cshow){ 314 | // Set up the INI string 315 | memset((cfg.ini=malloc((strlen(_pgmptr)+8)*sizeof(char))),0,(strlen(_pgmptr)+8)*sizeof(char)); 316 | strcpy(cfg.ini,_pgmptr); 317 | strrchr(cfg.ini,'\\')[1]='\0'; 318 | strcat(cfg.ini,"zdl.ini"); 319 | // We need the command line for the INI thingy later 320 | cmdline=cline; 321 | Cfg_LoadConfig(); // Load the configuration file 322 | // GoooOOooooOOOOOoooOOO! 323 | return DialogBox(inst,MAKEINTRESOURCE(DLG_MAIN),HWND_DESKTOP,MainProc); 324 | } 325 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | --------------------------------------------------------------------------------