grfdebug.log parsing tool (Updated 2007/04/14 @06:25 GMT)

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

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

grfdebug.log parsing tool (Updated 2007/04/14 @06:25 GMT)

Post by DaleStan »

I've been meaning to do this for a long time, but I finally sat down and actually *did* it.

This tool will read grfdebug.log and the associated NFO file, and produce a grfdebug.txt with lines that look like:

Code: Select all

Retrieving graphics for feature 3, ID db.
Processing sprite 222.
Testing variable c. Value: 0.
Processing sprite 219.
Testing variable 7f, param 0. Value: 0.
Processing sprite 218.
Testing bits 1 of random value 1b.
Processing sprite 217.
Testing variable 47. Value: 1.
Processing sprite 211.
Returning real sprite number 177.
<...>
Calling callback 15 for feature 3, ID db.
Processing sprite 222.
Testing variable c. Value: 15.
Processing sprite 221.
Testing variable 47. Value: 204ff, Masked: ff.
Processing sprite 220.
Testing variable 1a. Value: ffffffff, Adjusted: ffff0370, Masked: 370.
Testing variable 47. Value: 204, Adjusted: 4.
Returning calculated callback result dc.
Returning real sprite number -1.
The listed sprite numbers, where not clearly invalid, are the in-nfo sprite numbers, not the numbers out of the log, and are in decimal. Everything else in hex. If you specify the wrong nfo file, you will get lots of warnings, and not nearly as much UI, but you'll still get the reformatted log.

Run it from the command line. It takes a single argument, which is the name of the nfo file that you want to debug. grfdebug.log must be in the same directory as the binary.
The search order for the nfo file is the same as for NFORenum:
file
file.nfo
sprites/file
sprites/file.nfo

The attachments contain the usual: A win32 binary in the first, and the source, with DOS and Unix linefeeds, in the second and third, respectively.
Attachments
grfdebug-src.tar.gz
(16.75 KiB) Downloaded 680 times
grfdebug-src.zip
(20.05 KiB) Downloaded 677 times
grfdebug.zip
(63.59 KiB) Downloaded 739 times
Last edited by DaleStan on 14 Apr 2007 05:30, edited 1 time in total.
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
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: grfdebug.log parsing tool

Post by XeryusTC »

DaleStan wrote:@Xeryus: I've fixed several bugs that were in the version I gave you.
Thank you, I'll take a look later at it this week as I'm in the middle of a test week and I already spend too much time on other stuff yesterday ;).
For the rest, it was nice that I could make some sense out of the grfdebug.log really easy, it is quite hard to understand the raw grfdebug.log ;).
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Due to me not reading the documentation quite thoroughly enough, it was possible to see the line "Calling callback 1 for ...". I've changed this to "Getting random triggers for ...". The other changes should be relatively obvious, but just in case they're not:
I've changed the "Testing variable 7f00" lines to "Testing variable 7F, param 0", and eliminated the "Adjusted" and "Masked" values if they are the same as the preceding value.

One TTDPatch bug I've discovered here is that the "Value" entry is post-shift, not pre-shift, as the documentation implies. I have a fix for this, and intend to commit in time for Sunday's nightly.[0]

For those who like such things, a diff is attached.

[0] Because I won't be available to merge it Saturday night. If someone else is available and willing (merges should happen between 02:30 and 02:45 GMT) ping me on IRC.
Attachments
grfdebug.patch
(2.63 KiB) Downloaded 722 times
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
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests