Howto apply a patch/diff file

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Howto apply a patch/diff file

Post by DaleStan »

Well then, install upx, or just make grfcodec.

The error I suspect you remember is that it did strange things with your real-sprites? That was an endian-neutral bug, and was fixed even longer ago.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Benbo
Transport Coordinator
Transport Coordinator
Posts: 380
Joined: 09 Jan 2006 18:51
Location: UK

Re: Howto apply a patch/diff file

Post by Benbo »

It's a shame. I'd really like to see a way to make GRFs on my Mac. I know a bit of Pixel Art, so I'm just learning by Purno Tutorials.

In the meantime, I'll download Wine and run GRF Codec off that.
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Re: Howto apply a patch/diff file

Post by Bjarni »

Benbo wrote:It's a shame. I'd really like to see a way to make GRFs on my Mac. I know a bit of Pixel Art, so I'm just learning by Purno Tutorials.

In the meantime, I'll download Wine and run GRF Codec off that.
There is no need for that. Dalestan is right. The grfcodec itself works on mac now (nice of you guys to tell me that :P ). I'm messing with an error where it fails to compile with some sort of date support though but it could be a setup issue at my computer. Haven't really looked much into it yet.
User avatar
Benbo
Transport Coordinator
Transport Coordinator
Posts: 380
Joined: 09 Jan 2006 18:51
Location: UK

Re: Howto apply a patch/diff file

Post by Benbo »

I'll have a go :? but if you get errors, a doubt I'll get past the download :lol:

Edit: Ha-ha I'm not even going to get that far. There's no point in me downloading the files because I don't know how to compile! If anyone comes up with a working file it would be much appreciated.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Howto apply a patch/diff file

Post by DaleStan »

Bjarni wrote:I'm messing with an error where it fails to compile with some sort of date support though but it could be a setup issue at my computer. Haven't really looked much into it yet.
GRFCodec and NFORenum use boost::date_time to support the \w<date> and \d<date> extensions. If the makefiles can't find boost, they'll disable those extensions.

The search paths are
/usr/local/include/boost-$(BOOST_VERSION)/boost
/usr/include/boost-$(BOOST_VERSION)/boost

If boost isn't there, set BOOST_INCLUDE to the location of your boost directory.

BOOST_VERSION is, by default, 1_33_1, since that's the latest Cygwin package. Apparently, boost 1.34.1 is latest; if you have that, set BOOST_VERSION to 1_34_1. I should try to autodetect the boost version, but I haven't found any good way to do that.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: Howto apply a patch/diff file

Post by cirdan »

DaleStan wrote:I should try to autodetect the boost version, but I haven't found any good way to do that.
If you have the standard find(1), sort(1) and tail(1) system tools installed, the following piece of code in your Makefile should give you a good guess:

Code: Select all

BOOST_INCLUDE=$(shell \
find /usr/include /usr/local/include -maxdepth 1 -name 'boost-*' | \
sort -t - -k 2 | tail -n 1 )
with the difference that BOOST_INCLUDE will be null if no boost include directory exists, instead of CANNOT_FIND_BOOST_INCLUDE_DIRECTORY. This is how I do it.
User avatar
JamieLei
Tycoon
Tycoon
Posts: 7432
Joined: 10 Jan 2007 18:42
Location: Stratford, London

Re: Howto apply a patch/diff file

Post by JamieLei »

Heya - I used to use Tortoise SVN and cygwin, which worked fine. I can't be bothered to install them again byt sadly I can't get BuildOTTD to work. Do I need to be using any other program before just loading the diff/patch file into BuildOTTD? It downloads the version but doesn't seem to do anything else. I'm using Vista.
Any opinions expressed are purely mine and not that of any employer, past or present.
kaan
Route Supervisor
Route Supervisor
Posts: 399
Joined: 02 Apr 2007 20:13
Location: Nørup, Denmark

Re: Howto apply a patch/diff file

Post by kaan »

BuildOTTD is having a fair share of problems on vista. Unfortunately most of these problems originate in MinGW and its been years since they made a new stable release.

Code: Select all

if (YouAreHappyAndYouKnowIt) {
    ClapYourHands();
}
User avatar
JamieLei
Tycoon
Tycoon
Posts: 7432
Joined: 10 Jan 2007 18:42
Location: Stratford, London

Re: Howto apply a patch/diff file

Post by JamieLei »

I guess it's back to cygwin and Tortoise then - thanks anyway :)
Any opinions expressed are purely mine and not that of any employer, past or present.
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Re: Howto apply a patch/diff file

Post by CobraA1 »

[STRIP/UPX] grfmrgc.bin
make: upx: Command not found
Well then, install upx, or just make grfcodec.
UPX? Ugh. A few years back executable packers may have been worth it, but not anymore.

a) We've got huge hard drives and lots of memory these days, and we use a lot of media. The largest folders on my system are my music and my movies, not my Program Files. The gains from packing executables are minimal compared to the amount of hard drive space I waste with media storage. I can save more space deleting old podcasts, movies, and music than packing all of my exes with UPX.

b) Executable packers tend to conflict with DEP, which is starting to get turned on more often than not (I think Vista may even have it on by default). By definition, executable packers change executable code. By definition, DEP prevents changing executable code in memory. Programmers are increasingly being advised not to mess around with memory marked as executable code. People running with DEP turned on are very likely to have headaches with packed code.

c) Since they do change the executable, they are often used to change the signature of viruses to hide from virus scanners. Therefore many virus scanners are looking for the presence of executable packers as an indication of a possible virus. This has lead to a lot of false positives in virus scanners with packed software.

Minimal gains, lots of headaches. IMHO executable packers simply aren't worth it anymore.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Howto apply a patch/diff file

Post by DaleStan »

I'll stop upxing the copy of grfmerge embedded in grfdiff when you convince Patchman to change the makefile appropriately. Or produce something that vaguely resembles evidence, instead just saying "I don't like it".
CobraA1 wrote:Since they do change the executable, they are often used to change the signature of viruses to hide from virus scanners. Therefore many virus scanners are looking for the presence of executable packers as an indication of a possible virus.
Exactly what definition of "many" are you using here? virusscan.jotti.org tells me that, even with the maximum packing I can produce for TTDPatch[0], out of twenty scanners, a grand total of zero of them consider it something to be worried about. Including quite a few that are notorious for false positives.

And anyone for whom UPX and/or DEP causes problems shouldn't be running grfcodec at all, since they won't be able to test their files properly (ie "in TTDPatch"). The procedure for running TTDPatch is something like:
1) UPX unpack the loader.
2) fopen the Patch executable to get overlaid data.
3) Modify another executable.
4) Start said executable.
5) Feed said modified executable several hundred KB of code and data.
6) Run a substantial portion (one third, maybe?) of the just-supplied code to connect the old code to the new code and data, and to properly initialize/relocate 3700+ addresses, both absolute and relative.

Which of those steps is DEP not going to have problems with? Or are you confusing "modifying executable code" with "moving EIP outside the executable range defined in the PE header"? Not that TTDPatch does any less of the later.

[0] Which is, I think, somewhere under a thousand bytes of unpacked executable code in a 524KB binary: ~200 bytes each for two UPX unpackers (one exe, one dll) and ~450 for the TTD code loader. Everything else is either packed (upx or gzip) or not at all executable.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
rabbit67890
Engineer
Engineer
Posts: 72
Joined: 23 Sep 2007 09:57

Re: Howto apply a patch/diff file

Post by rabbit67890 »

i hate buildottd because its not works on vista and i have vista
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Howto apply a patch/diff file

Post by athanasios »

You should hate Vista instead.

Please do not speak this way about other members hard work. Blame yourself for using a 'garbage', incompatible OS. :evil:
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
MT3269
Traffic Manager
Traffic Manager
Posts: 129
Joined: 04 May 2004 05:44
Location: Australia

Re: Howto apply a patch/diff file

Post by MT3269 »

There was a post in this thread that explained what to do with a diff file, but what do you do to get the patch working in the game?
Formerly Trainskier1406
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Howto apply a patch/diff file

Post by Bilbo »

athanasios wrote:You should hate Vista instead.

Please do not speak this way about other members hard work. Blame yourself for using a 'garbage', incompatible OS. :evil:
Vista? Forget current betaversion of Vista, wait for final version (Microsoft calls it Service Pack 2)
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Howto apply a patch/diff file

Post by athanasios »

Wise thoughts! :lol:
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Howto apply a patch/diff file

Post by DaleStan »

Bilbo wrote:Vista? Forget current beta version of Vista, wait for final version (Microsoft calls it Service Pack 2)
Not so. Service Pack 1. "Never install an even-numbered service pack. Including zero." Apparently, this rule first appeared in the days of NT 3.51, with, to date, the only exception being XPSP2.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Howto apply a patch/diff file

Post by Bilbo »

DaleStan wrote:
Bilbo wrote:Vista? Forget current beta version of Vista, wait for final version (Microsoft calls it Service Pack 2)
Not so. Service Pack 1. "Never install an even-numbered service pack. Including zero." Apparently, this rule first appeared in the days of NT 3.51, with, to date, the only exception being XPSP2.
Ok, then wait for SP3 ....
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
Thalass
Traffic Manager
Traffic Manager
Posts: 200
Joined: 02 Jul 2004 13:29
Location: Ontario, Canada

Re: Howto apply a patch/diff file

Post by Thalass »

Hey, uh, stupid noob question here. But when you apply a .diff, does it completely override all the previous changes to the game? That is, if I was to apply two .diffs to my game, will the second one wipe the first, or will they both work?
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Howto apply a patch/diff file

Post by Bilbo »

If you apply second diff to the source after applying first one, the changes from both would simply merge, so if each diff adds some feature, you'll have both of them. But in case when the diffs change the same piece of code, a conflict would arise and you have to somewhat resolve it manually (patch usually produces a "rejects" file for each file where some part of the diff failed, where you see which parts failed and you now have to apply them manually somehow and join the changes from both diffs)

Also, there can be case when the diffs do not create any conflicts when applying, but for some other reasons they won't work together (like one diff changing some global variables and other diff assuming these variables are not changed)
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 29 guests