Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ ROM ➜ Running the server ➜ Patching in Win32

Patching in Win32

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Akumafire   (8 posts)  Bio
Date Sun 26 Oct 2003 02:58 PM (UTC)
Message
Hey
I read the instructions on patching coding, it says to run patch < "patchfilename". But there's no command such as patch in windows, so how does one patch the coding in win32?
I tried looking inside the patch itself, but I don't really understand the numbers such as 750a751,762, I know they're line numbers by looking at the code and the patch, but I don't know how the code is inserted?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 02 Nov 2003 07:47 PM (UTC)
Message
This was a question that had me stumped years ago.

There are a few answers. One is I found a Windows "patch" program, you can find this at:

ftp://ftp.gammon.com.au/pennmush/patch.zip

However this didn't always work for me. :)

You could try searching download sites for a more up-to-date version.

Another approach is to install Cygwin, the latest GNU patch program can be installed as part of the developer tools. That will be likely to work very well.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Firedale2002   (6 posts)  Bio
Date Reply #2 on Thu 27 Oct 2005 02:15 PM (UTC)
Message
The easiest though most time-consuming way I've found so far is to manually go in and add each patch. The problem with the patches out there are that they rely on you using the base code, so after you install one patch, the rest cannot be automatically used, anyway, as the line numbers no longer match with what the patchcode says to use.

For the patch files, they have one or more parts that look kinda like this: (between the ================ lines)

======================================================
diff -ur Rom24/src/act_info.c rom24_colour_v2.0/src/act_info.c
--- Rom24/src/act_info.c Thu Jul 18 13:43:13 1996
+++ rom24_colour_v2.0/src/act_info.c Sun May 3 18:23:44 1998
@@ -1035,21 +1035,22 @@
if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) )
{
/* 'look' or 'look auto' */
- send_to_char( ch->in_room->name, ch );
+ sprintf( buf, "{s%s", ch->in_room->name );
+ send_to_char( buf, ch );

if (IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act,PLR_HOLYLIGHT)))
{
- sprintf(buf," [Room %d]",ch->in_room->vnum);
+ sprintf(buf," {r[{RRoom %d{r]",ch->in_room->vnum);
send_to_char(buf,ch);
}

- send_to_char( "\n\r", ch );
+ send_to_char( "{x\n\r", ch );

if ( arg1[0] == '\0'
|| ( !IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF) ) )
{
- send_to_char( " ",ch);
- send_to_char( ch->in_room->description, ch );
+ sprintf( buf, "{S %s{x", ch->in_room->description );
+ send_to_char( buf, ch );
}

if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT) )
======================================================

It doesn't have the =========== lines in it, I just used and will use those to show you what it looks like.
You can open the patches in something like notepad, and then view it.

The header of each indivudual part in the file:
========================================
diff -ur Rom24/src/act_info.c rom24_colour_v2.0/src/act_info.c
--- Rom24/src/act_info.c Thu Jul 18 13:43:13 1996
+++ rom24_colour_v2.0/src/act_info.c Sun May 3 18:23:44 1998
========================================
shows you what filename you need to be editing, in this example, it's act_info.c

The parts with the @@ symbols shows where the patch would have originally tried to make changes
========================================
@@ -1035,21 +1035,22 @@
========================================
would have been at line 1035
It's always good to try and use these numbers as a guide to show you where you should be looking, though after a few patches, these numbers may be so far off that they're not useful anymore, and it might be more worthwhile to search for the bits of code that it's asking you to change...

Now, to the changes:

=======================================
@@ -1035,21 +1035,22 @@
if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) )
{
/* 'look' or 'look auto' */
- send_to_char( ch->in_room->name, ch );
+ sprintf( buf, "{s%s", ch->in_room->name );
+ send_to_char( buf, ch );

if (IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act,PLR_HOLYLIGHT)))
{
=======================================
^This is the first set of changes in my example above.

=======================================
@@ -1035,21 +1035,22 @@
if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) )
{
/* 'look' or 'look auto' */
=======================================
This bit of text tells you where you should be looking, you need to find the line that has
if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) )
on it, then follow down until you're AFTER the line with
/* 'look' or 'look auto' */
That's where the first changes will be made.
If there is a -, it means remove that line (it gives the text on the line that needs to be removed, also)
If there is a +, it means add that line (it gives the text on the line that needs to be added, also)
If there is no -/+ beside the line, it isn't added or removed, it's used to show you what you should see on the lines before or after the lines of changes you made.

Let me try to do this as an example

The original code for the change above is:
==========================================================
if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) )
{
/* 'look' or 'look auto' */
send_to_char( ch->in_room->name, ch );

if (IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act,PLR_HOLYLIGHT)))
{
==========================================================

AFTER the changes, it should look like this

==========================================================
if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) )
{
/* 'look' or 'look auto' */
sprintf( buf, "{s%s", ch->in_room->name );
send_to_char( buf, ch );

if (IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act,PLR_HOLYLIGHT)))
{
==========================================================

You continue down the file, making all the changes it shows you to make.

Things from one @@ area to the next should all be in a straight line down the code.

The next @@ means there's a jump in the code that has no changes made to it.

When you hit a new diff area, it means you're done with the current file you were working on, and the new file to have changes made to it are listed in that diff part, as it was in the first.

I used Lope's color code patch for the example above.
I, myself, have manually added Lope's color code patch, and a copyover patch that Erwin Andreasen provided on a website somewhere. Both patches work just fine and dandy.

I know my way of explaining can be confusing, but hopefully what I said will help you anyway. I recommend just reading the patch files in notepad, and perhaps you'll get an idea of how to add them manually. I figured it out without any faqs to do so, heh, didn't have internet at the time, but it's easy to understand once you do a few line changes.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,840 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.