Patching

From NetHackWiki
Revision as of 15:14, 20 September 2006 by Paxed (talk | contribs) (first info. example patching of menucolors.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Here is a short guide on Patching your NetHack sources. Assuming you have already managed to compile your copy.

On Windows

Please see the article on compiling, the following assumes you have installed MinGW and NetHack's sources to the locations shown in that article.

  • Unpack that into the same directory as MinGW, so that the patch.exe will be in the same place as mingw32-make.
  • Find the diff-file you want to patch, and download it on to your computer, preferably in the NetHack sources root directory, c:\nh343.

Note that linux-style line endings will cause problems, you need to convert those into Windows-style ones! You can do this for example copypasting the contents of that file from a browser window into Notepad, and then saving the notepad file. In this example, we'll be using the menucolors-patch available at http://bilious.homelinux.org/~paxed/nethack/nh343-menucolor.diff We'll assume the file is saved in c:\nh343\ as nh343-menucolor.diff

  • Start cmd.exe and do the following:
cd c:\nh343
path=c:\mingw\bin
patch -p1 < nh343-menucolor.diff

The 1 after the -p might need to be changed to 0 or possibly 2 for other patches.

  • Some patches require extra configuration steps before compiling. For menucolors, you need to edit c:\nh343\include\config.h by changing the line
# define MENU_COLOR_REGEX

to

/* # define MENU_COLOR_REGEX */

Menucolors also comes with it's own short README file, which should be c:\nh343\README.menucolor

  • Run install.bat (Assuming you created one when compiling the source)
  • Add the following to your NetHack configuration file, so the menucolors actually does something:
OPTIONS=menucolors
MENUCOLOR="* blessed *"=green
MENUCOLOR="* holy *"=green
MENUCOLOR="* cursed *"=red
MENUCOLOR="* unholy *"=red
  • Start NetHack. Now all blessed and holy items in your inventory should be shown in green, cursed and unholy in red.