Reading grfId from grf (PHP)

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
User avatar
Dinges
Tycoon
Tycoon
Posts: 2865
Joined: 07 Jan 2003 18:00
Location: Fryslân Boppe!
Contact:

Reading grfId from grf (PHP)

Post by Dinges »

As a new feature for my graphics site I would like to extract grfID's from grf files. Is there an exact location within the GRF file where I could find this ID? It is mainly for building a GRFid database, and to check if the GRF file uploaded is valid. :wink:
Dinges

Who is the other person in me?

my Blog (dutch) - my Last.fm profile

Owner of http://ttdgraphics.cjb.net/ ! Temp addr: http://ttdgraphics.owenrudge.com/
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1791
Joined: 30 Mar 2005 09:43

Post by peter1138 »

The location is not fixed in the file. You will have to parse it for the Action 8 which means understanding bits of http://wiki.ttdpatch.net/tiki-index.php ... phicsSpecs
User avatar
Dinges
Tycoon
Tycoon
Posts: 2865
Joined: 07 Jan 2003 18:00
Location: Fryslân Boppe!
Contact:

Post by Dinges »

I do not mean the NFO file, the encoded GRF file.
Dinges

Who is the other person in me?

my Blog (dutch) - my Last.fm profile

Owner of http://ttdgraphics.cjb.net/ ! Temp addr: http://ttdgraphics.owenrudge.com/
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1791
Joined: 30 Mar 2005 09:43

Post by peter1138 »

What do you think happens to the NFO file?
User avatar
Dinges
Tycoon
Tycoon
Posts: 2865
Joined: 07 Jan 2003 18:00
Location: Fryslân Boppe!
Contact:

Post by Dinges »

dunnow, please tell me...
Dinges

Who is the other person in me?

my Blog (dutch) - my Last.fm profile

Owner of http://ttdgraphics.cjb.net/ ! Temp addr: http://ttdgraphics.owenrudge.com/
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13235
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Post by Hyronymus »

But why don't you force submitters to add the GRFID? Can't you make GRFID a required description field on the submit form?
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1791
Joined: 30 Mar 2005 09:43

Post by peter1138 »

Look at a GRF file with a binary editor. Compare with an NFO file. See how the numbers are the same, albeit with a few extra bytes...?
User avatar
Purno
Tycoon
Tycoon
Posts: 16659
Joined: 30 Mar 2004 12:30
Location: Almere, The Netherlands

Re: Reading grfId from grf (PHP)

Post by Purno »

Hyronymus wrote:Can't you make GRFID a required description field on the submit form?
guess not:
Dinges wrote:and to check if the GRF file uploaded is valid.
Contributor to the The 2cc Set and Dutch Trainset. Inventor of the Metro concept. Retired Graphics Artist.
Image Image
Download TT | Latest TTDPatch | OpenTTD | OpenTTDCoop | BaNaNaS: OpenTTD content system | 2048² OTTD scenario of the Netherlands
GRF Codec | GRF Crawler | GRF Maker | Usefull graphics & tools sites | NML Documentation Wiki | NFO Documentation Wiki
All my graphics are licensed under GPL. "Always remember you're unique, just like everyone else."
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Should be quite easy with fread, fopen. Didn't take long to have it in TTShellExt (c++) ... (The conversation to unicode and OLE String is more work in TTShellExt)
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Google [Bot] and 13 guests