[OTTD] GRFCodec claims NFO file missing header

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
Cryolaser
Engineer
Engineer
Posts: 23
Joined: 18 Jan 2019 04:48

[OTTD] GRFCodec claims NFO file missing header

Post by Cryolaser »

I'm trying to follow these instructions: https://www.tt-wiki.net/wiki/NFO_Foundations
But at the point where it comes to encoding the file with the command "grfcodec -e mytrain.grf" in step 4, GRFCodec tells me "NFO file missing header and version info", but I've added the // lines so it's not clear how to proceed.

Here's my code so far... I've tried this with the header they show, as well as the following variations from the base graphics NFO in my installation.

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 6)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
 0 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  466 11656    8   21   -3  -11 normal
 1 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  482 11656   20   14  -14   -7 normal
 2 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  514 11656   29   12  -16   -8 normal
 3 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  562 11656   20   14   -6   -7 normal
 4 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  594 11656    8   20   -3  -10 normal
 5 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  610 11656   20   14  -14   -7 normal
 6 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  642 11656   29   12  -16   -8 normal
 7 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  690 11656   20   14   -6   -7 normal
Variations of header tried, producing same error:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 32)
// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 32)
// Escapes: 2+ 2- 2< 2> 2u< 2u> 2/ 2% 2u/ 2u% 2* 2& 2| 2^ 2sto = 2s 2rst = 2r 2psto 2ror = 2rot 2cmp 2ucmp 2<< 2u>> 2>>
// Escapes: 71 70 7= 7! 7< 7> 7G 7g 7gG 7GG 7gg 7c 7C
// Escapes: D= = DR D+ = DF D- = DC Du* = DM D* = DnF Du<< = DnC D<< = DO D& D| Du/ D/ Du% D%
// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: [OTTD] GRFCodec claims NFO file missing header

Post by PikkaBird »

For a NewGRF, you also need a sprite 0 - which just tells it how many sprites there are altogether - and an action 8 before you jump in to writing useful code. Here's something vague I wrote a long time ago.
User avatar
Cryolaser
Engineer
Engineer
Posts: 23
Joined: 18 Jan 2019 04:48

Re: [OTTD] GRFCodec claims NFO file missing header

Post by Cryolaser »

According to your link, NFORenum will add a sprite 0 for me. NFOrenum however says "Does not appear to be an NFO file. Skipping file." when I try to process what I have. I've tried adding an Action8 line using your example, to the same response from the executable.

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 32)
// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags
 0 * 1	 08 07 "JB01" "My first Newgrf" 00 "By Joe Bloggs" 00
 1 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  466 11656    8   21   -3  -11 normal
 2 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  482 11656   20   14  -14   -7 normal
 3 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  514 11656   29   12  -16   -8 normal
 4 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  562 11656   20   14   -6   -7 normal
 5 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  594 11656    8   20   -3  -10 normal
 6 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  610 11656   20   14  -14   -7 normal
 7 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  642 11656   29   12  -16   -8 normal
 8 c:\program files\openttd\sprites/ogfx1_base00.png  8bpp  690 11656   20   14   -6   -7 normal
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: [OTTD] GRFCodec claims NFO file missing header

Post by PikkaBird »

Here's a minimally working nfo file. If you're more familiar with actual programming languages, you could also give NML a try - it's what most people use these days.

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 32)
// Escapes: 2+ 2- 2< 2> 2u< 2u> 2/ 2% 2u/ 2u% 2* 2& 2| 2^ 2sto = 2s 2rst = 2r 2psto 2ror = 2rot 2cmp 2ucmp 2<< 2u>> 2>>
// Escapes: 71 70 7= 7! 7< 7> 7G 7g 7gG 7GG 7gg 7c 7C
// Escapes: D= = DR D+ = DF D- = DC Du* = DM D* = DnF Du<< = DnC D<< = DO D& D| Du/ D/ Du% D%
// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags
    0 * 4	 07 00 00 00

// INFO DATA CHUNKS

    1 * 19	 14 "C" "INFO"
                  "B" "VRSN" \w4 \d0
              00
    00
    2 * 19	 14 "C" "INFO"
                  "B" "MINV" \w4 \d0
              00
    00

    3 * 16	 14 "C" "INFO"
                  "B" "PALS" \w1 "A"
              00
    00

    4 * 16	 14 "C" "INFO"
                  "B" "BLTR" \w1 "3"
              00
    00

    5 * 67	 14 "C" "INFO"
                 "T" "URL_" 7f "https://www.tt-forums.net/viewtopic.php?f=26&t=84786" 00
                 00
             00	

    6 * 17	 14 "C" "INFO"
                "B" "NPAR" \w1 \b0
				00

         00
	00	

    7 * 16	 08 08 "IDID" "Name" 00 "Desc" 00


//Something goes here.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: [OTTD] GRFCodec claims NFO file missing header

Post by wallyweb »

Cryolaser wrote: ...
GRFCodec is distributed with a lintner called nforenum.

Try running nforenum -c / mytrain.nfo
Then view mytrain.nfo in your text editor.
Note: The -c / allows you to insert comments after //
You should see the header as it appears in PikkaBird's sample.

If all looks good then run grfcodec -e mytrain.grf
User avatar
Cryolaser
Engineer
Engineer
Posts: 23
Joined: 18 Jan 2019 04:48

Re: [OTTD] GRFCodec claims NFO file missing header

Post by Cryolaser »

Been a while but I want to thank y'all, it's most gracious of you. I don't have any experience of coding, but I only want to make a few locomotives, so the template is immensely helpful.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [OTTD] GRFCodec claims NFO file missing header

Post by planetmaker »

You might want to have a look at the tutorials over at tt-wiki: https://www.tt-wiki.net/wiki/NMLTutorial
User avatar
kamnet
Moderator
Moderator
Posts: 8586
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: [OTTD] GRFCodec claims NFO file missing header

Post by kamnet »

Cryolaser wrote:Been a while but I want to thank y'all, it's most gracious of you. I don't have any experience of coding, but I only want to make a few locomotives, so the template is immensely helpful.
Congratulations! You're now a coder! We look forward to your contributions.
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: [OTTD] GRFCodec claims NFO file missing header

Post by Eddi »

i'd expect the problem is that your editor adds an invisible "UTF8-BOM" and grfcodec gets confused on that. to a human the file LOOKS correct, but the compiler bails on the unrecognized character.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Bing [Bot] and 38 guests