m4nfo - help needed

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
merni
Engineer
Engineer
Posts: 11
Joined: 22 Mar 2022 15:41

m4nfo - help needed

Post by merni »

I am trying to make new stations with m4nfo. But it does not seem to work properly -- grfcodec gives an error when I try to make the grf.

As far as I know I followed all instructions in the "Basic software", "Download" and "Installation" sections of the m4nfo manual (The "getting started" section does not exist). I have attached my nfx, sprites (just a quick trial one atm), and the generated nfo file. Here is a transcript of my shell session with the grfcodec error (I am using Debian 11):

Code: Select all

user@Dell:~/Desktop/grf/sprites$ m4 -Dunix -R m4nfo_stations.m4 < test1.nfx > test1.nfo
user@Dell:~/Desktop/grf/sprites$ cat count.m4 test1.nfo > test1.tt
cat: count.m4: No such file or directory
user@Dell:~/Desktop/grf/sprites$ mv COUNT.M4 count.m4
user@Dell:~/Desktop/grf/sprites$ cat count.m4 test1.nfo > test1.tt
user@Dell:~/Desktop/grf/sprites$ m4 < test1.tt > test1.nfo
user@Dell:~/Desktop/grf/sprites$ cd ..
user@Dell:~/Desktop/grf$ grfcodec -e test1.grf
Encoding in temporary file test1.new
NFO file missing header lines and version info
(Note: The forum rejects my attempt to upload a file with the .nfx extension, so I renamed it to .nfx.txt)

Edit:
By the way, I do know that there is an experimental feature to add stations in NML (it was pointed out in Discord). But since it doesn't have any documentation yet, I can't really use it since I have no knowledge of NML in the first place.
Attachments
test1.nfo
Generated nfo file
(1.25 KiB) Downloaded 61 times
test1.nfx.txt
m4nfo source file
(814 Bytes) Downloaded 67 times
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: m4nfo - help needed

Post by michael blunck »

"header lines" and "version number" for grfcodec have to be supplied by m4nfo's include file "count.m4" (for 8 bpp) respectively "count32.m4 (for 32 bpp).

Since you're obviously using 8 bpp graphics (grfblitter(BPP8), call of grfcodec), you'd have to use the "standard" real sprites format as well, but not OpenTTD's info version 32 format in m4nfo's function sprite(), i.e. without that parameter "8bpp", and swapped x/y offsets.

[edit]
Also missing:

setfeature(_STATION)
setpath(<dir-path>)

See manual.

Code: Select all

setfeature(_STATION)
setpath(sprites)

grfinit("as00", 
	grfname(ALL, "Merni Test Set")
	grfdescription(ALL, "Test")
	grfpalette(DOS)
	grfversion(1)
	grfminversion(0)
	grfblitter(BPP8)
)

definestation(0, "Chennai Central",
	class(0)
	callbacks(CB_LAYOUT)
)

classnames(0,
	{UK, "India"},
	{US, "India"}
)

stationnames(0,
	{UK, "Chennai Central"},
	{US, "Chennai Central"}
)

spriteblock(
	set(
		sprite(test1_8bpp.png 0 0 64 78 -50 -33)
		sprite(test1_8bpp.png 72 0 64 78 -50 -33)
		sprite(test1_8bpp.png 144 0 64 78 -50 -33)
		sprite(test1_8bpp.png 216 0 64 78 -50 -33)
	)
)

def(1) spriteset(little(0), lots(0))

layout(0,
	tile(
         ground(1012)
	 regular(0, xyz(0,0,0), dxdydz(15,5,7))
	)
	tile(
         ground(1011)
	 regular(1, xyz(0,0,0), dxdydz(5,15,7))
	)
)

makestation(0,
	link(ref(1), PASS)
	default(ref(1))
)

[/edit]

regards
Michael
Image
merni
Engineer
Engineer
Posts: 11
Joined: 22 Mar 2022 15:41

Re: m4nfo - help needed

Post by merni »

michael blunck wrote: 26 May 2022 14:29
Thanks for pointing out the mistakes. But even after fixing them grfcodec gives the same error. I used the source code you provided exactly, and also tried changing the setpath() parameter to the absolute path.
Last edited by merni on 27 May 2022 11:46, edited 1 time in total.
merni
Engineer
Engineer
Posts: 11
Joined: 22 Mar 2022 15:41

Re: m4nfo - help needed

Post by merni »

After quite a bit of troubleshooting with nforenum and the GRF specs, it works now! What I have learned:
  • Somehow, when XArchiver unzips the zip file from the m4nfo website, the COUNT.M4 (as well as COUNT32.M4) file created is blank. It worked when I used command-line "unzip", but with some warnings:
    [+] Spoiler

    Code: Select all

    Archive:  m4nfo_stations.zip
      inflating: ms/m4nfo_stations.txt   
      inflating: ms/m4nfo_stations.m4    
    COUNT.M4:  mismatching "local" filename (count.m4),
             continuing with "central" filename version
      inflating: ms/COUNT.M4             
    COUNT32.M4:  mismatching "local" filename (count32.m4),
             continuing with "central" filename version
      inflating: ms/COUNT32.M4           
    Looks like an issue with Linux having case-sensitive filenames. I guess I should use Windows next time.
    To the credit of XArchiver, it did pop up a generic message that there was an error while extracting, but as the files appeared anyway, I thought it was nothing to worry about :cry:
  • The station class for definestation() ha to be four characters long and enclosed in double quotes.
  • For spriteblock, the compression flag has to be set (I set it to 01). It cannot be omitted.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: m4nfo - help needed

Post by michael blunck »

What kind of error message exactly?
"file missing header lines and version"?

That's because file "count.m4" is not being attached to your .nfx file, so the needed preamble for grfcodec is missing, and in addition sprite numbers are not resolved.

regards
Michael
Last edited by michael blunck on 27 May 2022 15:06, edited 1 time in total.
Image
merni
Engineer
Engineer
Posts: 11
Joined: 22 Mar 2022 15:41

Re: m4nfo - help needed

Post by merni »

michael blunck wrote: 27 May 2022 13:36 What kind of error message exactly?
"file missing header lines and version"?

regards
Michael
Please see my later post, the issue was fixed and the main issue was not related to m4nfo at all.
Now it works well. Thanks for the help.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: m4nfo - help needed

Post by michael blunck »

Good news!

I didn't test your code, just read your post on my cell phone. So the missing compression flag, and the wrong station class label I didn't notice. Sorry about this.

regards
Michael
Image
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

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