Problem compiling TTDPatch sources

Get help, info, news and advice about the Transport Tycoon Deluxe patch.

Moderator: TTDPatch Moderators

Post Reply
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Problem compiling TTDPatch sources

Post by Csaboka »

I've downloaded TTDPatch sources and all the needed programs but it has a strange problem: when make runs makelang, makelang causes a GPF, and the newly created ttdpatch(w).exe will cause a GPF when running, too. The problem goes away if I remove references to french.h and danish.h from makelang sources, or rename an other language file to these names.
Please Patchman or eis_os help me. I don't know whether the problem is in me or in the sources. I suppose you'd have noticed if something similar had happened to you :) , but I don't know what is the difference between our systems.
Setall.bat sets the path to be in this order:
c:\ttdsrc\nasm (for the modified nasm to work correctly)
c:\cygwin\bin
c:\ttdsrc\bin
c:\program files\upx
c:\bc\bin (Borland C++ 3.1)
[the original path]

I don't have the other programs mentioned in the docs (Turbo Assembler, Borland C++ 5). Texinfo is included in the Cygwin I use.

Can it be the problem that my Windows uses the Central European codepage?

Thanks for the help in advance.
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

What version of GCC do you have? 2.95 or 3.0? Also what version of the binutils? I had a strange bug once where everything that I compiled with binutils-20021110 (or so) crashed immediately. Maybe you can try the latest version. Also try remaking everything with "make remake".

About the crash when running TTDPatch, that's most likely because of a debug breakpoint at the immediate beginning. This is to make it easier to debug the patching...

To handle that, you can
  • Load a debugger that traps INT3 instructions
  • Compile with DEBUG=0
  • Remove the INT3 on line 173 of loader.ah
This is now in 0compile.txt too, by the way :)
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Problem compiling TTDPatch sources

Post by eis_os »

Csaboka wrote:I've downloaded TTDPatch sources and all the needed programs but it has a strange problem: when make runs makelang, makelang causes a GPF, and the newly created ttdpatch(w).exe will cause a GPF when running, too. The problem goes away if I remove references to french.h and danish.h from makelang sources, or rename an other language file to these names.
Please Patchman or eis_os help me. I don't know whether the problem is in me or in the sources. I suppose you'd have noticed if something similar had happened to you :) , but I don't know what is the difference between our systems.
Setall.bat sets the path to be in this order:
c:\ttdsrc\nasm (for the modified nasm to work correctly)
c:\cygwin\bin
c:\ttdsrc\bin
c:\program files\upx
c:\bc\bin (Borland C++ 3.1)
[the original path]

I don't have the other programs mentioned in the docs (Turbo Assembler, Borland C++ 5). Texinfo is included in the Cygwin I use.

Can it be the problem that my Windows uses the Central European codepage?

Thanks for the help in advance.
Hi, I have the same Problem with makelang :cry:
I think there are some incompatibles with some new Cygwin Releases,
I am using two pc's to create new patches, my second pc compiles all sources fine.

Sometimes you have to restart from ground up. I reinstalled cygwin now 10 or more times ... but It will not work as aspected.

Maybe I can release a patch for this, I have altered a lot files, now all seems working fine...

My Specs:
Some crapy cygwin without a true versions number
newes GCC in cygwin but in makefile gcc-2
pathed nasm.exe is in cygwin or mine doesn't work.
upx is in ttdpatch source path, because else cygwin don't like it :?:
I only build windows versions, because I don't have any dos based maschine. So bcc isn't in my path

Some tips:
If you haven't softice, set debug=0

Bye
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

Thanks both of you for answering!

To Patchman:

I don't know the exact version number of gcc, but I've downloaded the whole cygwin two weeks ago so it must be the latest version.
I've also tried "make remake" and "make clean", but they didn't help.
I've noticed the int3 thing after some tries, but the problem persists even after commenting that line in the sources.

To eis_os:
If I compile with DEBUG=1, everything works fine (after commenting that int3), so I'll leave it on, maybe it can help later. The only debugger I currently have is the Delphi built-in debugger but I'll look for something more usable soon.


I'll leave my TTDPatch source dir as it is now (with overwritten language files). If I'm able to make an usable patch, I'll send the diffs to Patchman anyway, he'll be able to compile the new code with all language data.

Thank you again for your help.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

But I think I have found our problem...

I am a happy Ollydbg user, but it doesn't like "DEBUG" int3.
I think I have found the error while making the language date,
but I have to check this with Josef first.

What patch do you planed?
(or we will write all on the same routines :shock: )
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

eis_os wrote: ...
What patch do you planed?
(or we will write all on the same routines :shock: )
The first thing I want to create is a PlantTrees sign cheat and a news message when a lumber mill runs out of trees. That's an annoying thing in the subtropical climate: you spend a lot of money on funding a lumber mill, but you aren't notified when it stops cutting trees out, and if you notice it anyway, you have to click a thousand times to replant all the trees. I think I know how to solve the first, but I don't know how to solve the second yet. Maybe I won't be able to do it anyway - I haven't programmed much in assembly yet.
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

It's me again! :D
I'm progressing well in the tree-planting patch but I've found another problem. My new patch needs to find new locations in the code (the original tree-planting routine), so I had to clear all files in the versions dir and have TTDPatch make new ones. The Windows version does it fine but the DOS version won't write .ver files. Actually, it does but these files contain only zeroes. If I'm running it normally, it asks if I want to run TTD even tough it doesn't have the version information, and proceeds well after answering yes. It installs my new patch correctly. But if I run it with -V, it crashes as soon as it'd show the main menu. :( Does this function work for you?
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Crash log please! Or look at it yourself and see where it crashes.

Also it may help to abort TTD right after finding the version data. For that, start it with "ttdpatch -!T+". I always collect my version info using "ttdpatch -!T+ -ayVv-", which has never been a problem for me.

Ah, what could also be wrong is that it just doesn't find the version data because the string you're searching for is different in the DOS version. In fact, that's probably the most likely explanation. [edit] Actually, since you say it works fine without -V that's not it. But -V always turns on -a, so it may be that your new searches are interacting in odd ways with the existing ones, or something like that. Anyway, look at crash*.txt and see where it crashes, that should help you.[/edit]

By the way, I got so annoyed having to always skip the intro screen in the DOS version that I patched it out. Just search the .exe file for the hex bytes "66 59 E8 FF". They should only appear once. A few bytes after that string, you'll see "0F 85". Change that to "90 E9", and the title screen will be skipped, which makes it possible to fully automate the version info gathering using a batch file.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

Unfortunately, I don't have a DOS debugger so I can't figure out where the error occurs. I've attached a crash log with that problem in case you have some time to help amateurs :) BTW, I've uploaded my experimental version so you can check it.

Its new features are:
- plantmanytrees patch: plant trees in a rectangular region and allow planting more than one tree to a tile. To plant in a rectangular region, plant a tree in the first corner normally, then then plant another tree in the other corner while holding Ctrl down. The rectangle defined by the two trees will be filled with small trees. If the types of the two trees are identical, all planted trees will be that type, if they're different, random trees will be planted.
- addition to the morenews patch: warning message when the production of a lumber mill drops to zero.

I've also updated docs/variables.txt with the information how trees are stored in the landscape array.

The sources can be downloaded from
http://www.csucsposta.hu/csaboka/TTDPatch/TTDSrc.zip

I'm sorry but there are no diffs yet.
Attachments
Crash011.txt
Crash log
(1.2 KiB) Downloaded 58 times
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Hi, I could look in your code soon with a windows debuger If you want, do you?

But it isn't easy to get your code synced into mine codebase,
too much test features in it. :wink:
If you have more question you can pm me...

-edit-
Ohh I see, you have already found the bug
(So this post is useless, remove it from your brain :wink: )
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Basically, what you could do is look at the location of the error (000F:00201876) and look for that in the listing file ttdprotd.lst, that might give you a clue about where in the code the problem is. Then looking at the registers might tell you more... but it's still basically a guessing game unless you use a debugger to break at the error location and see for yourself what's going on.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Patchman wrote:Basically, what you could do is look at the location of the error (000F:00201876) and look for that in the listing file ttdprotd.lst, that might give you a clue about where in the code the problem is. Then looking at the registers might tell you more... but it's still basically a guessing game unless you use a debugger to break at the error location and see for yourself what's going on.
Hmm, sometimes it's a guessing game with a debuger too ;)
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

I tried to compile the official alpha 28 from ttdpatch.com and even it didn't write version info. Now I'm almost sure that the problem is in my machine, but didn't investigate it further.

BTW the problem that I told you about in the first post simply disappeared. Now I can compile TTDPatch with the original language files. :?

I've done some work on TTDPatch and uploaded the new version.
It contains two new sign cheats: "cht: planttree" and "cht: landinfo", the second is for debugging only. I think I've also found the function that is executed only for signs, making possible that nothing else than signs can be used for sign cheats. I've also made it possible to put two identical signs without the "Name already in use" error, so people will be able to use two identical sign cheats without the second being broken.

Sources are in the same archive as the first version was.

The next thing I want to do is allowing new currencies - I hope none of you is working on that now.
User avatar
Andrex
Tycoon
Tycoon
Posts: 1308
Joined: 22 Nov 2002 05:08
Location: AR
Contact:

Post by Andrex »

To Patchman:

Hey I sent you an email ages ago can u please read it and reply? thnx
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Csaboka wrote: BTW the problem that I told you about in the first post simply disappeared. Now I can compile TTDPatch with the original language files. :?
That's because Oskar found the reason what's wrong, langerr.h wasn't being written properly. He fixed the awk script, but I decided that I'd rather rewrite in Perl. So I did, and that's why it works...
Andrex wrote:To Patchman:

Hey I sent you an email ages ago can u please read it and reply? thnx
Haha, beat you by an hour! You don't check your email very often, do you ;)

(I know I don't check mine too often, and usually only respond in batches once or twice a week, or maybe every other week. But I always do respond!)
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
Post Reply

Return to “General TTDPatch”

Who is online

Users browsing this forum: No registered users and 14 guests