Page 1 of 1

grfcodec 0.9.7 test version

Posted: 17 Aug 2005 19:22
by Patchman
Since alpha 57 will allow including new sound samples (although they won't be able to be used yet), here is a version of grfcodec to accomplish this.

In order to include sound samples (or any file, really), you need action 11 and the following kind of entries after it:

Code: Select all

   16 ** sounds/horn1.wav
   17 ** sounds/horn2.wav
   18 ** sounds/horn3.wav
The maximum possible size of these files is 65532 minus the length of the filename (without the directory; the name is stored so that after decoding, the extracted file will have the right name).

I'd appreciate if the interested parties could test this for a bit, before I make an official release of 0.9.7. Thanks.

Posted: 22 Aug 2005 13:41
by eis_os
Since it's A LOT easier to understand large pseudo code blocks with comments I added support for comments in pseudo sprite blocks.

Posted: 22 Aug 2005 21:37
by Oracle
Thanks for that comments feature, Oskar - it will be really useful when I next code stations!
Josef, I might get around to trying sound encoding briefly in the next few days. Do you just want me to check that the sounds encode/decode properly and that the patch doesn't mind them in GRF files?

Posted: 22 Aug 2005 22:30
by Patchman
Oracle wrote:Josef, I might get around to trying sound encoding briefly in the next few days. Do you just want me to check that the sounds encode/decode properly and that the patch doesn't mind them in GRF files?
Well, mainly that, and now that action 11 accepts them properly and rejects non-binary files. Also that I didn't accidentally break anything else :)

Posted: 02 Sep 2005 20:09
by Patchman
Just a heads-up, I've released grfcodec 0.9.7 at the usual place.

Changes since Oskar's version:
  • Fixed bug with grfcodec occasionally trying to decode first sprite as binary include
  • fixed incorrect error message while encoding if .nfo file could not be read (now it reports "Cannot read %s" instead of Creating sprites/: File exists")
  • made code -Wall clean
  • remove myalloc stuff

Posted: 07 Jan 2006 23:03
by OzTrans
I'm just going to suggest it here ...

Would it be possible to allow those string codes (e.g. \94) found in ttdpttxt.txt to be placed in plain text strings in action-4 and then have them converted to hex by GRFCodec. That would make it simpler to define those F8xx texts in a .grf. At the same time eliminating the problem with imbedded null-bytes (\00).

allow this ...

Code: Select all

5 * 175     04 48 9F 01 00 F8 
          "\94\80\n\90  Bribe the local authority to increase your rating, at the risk "
          "of a severe penalty if caught.\n  Cost: \7f" 00
instead of having to do it this way ...

Code: Select all

5 * 175     04 48 9F 01 00 F8 
          94 80 0D 90 "  Bribe the local authority to increase your rating, at the risk "
          "of a severe penalty if caught." 0D "  Cost: " 7F 00

Posted: 08 Jan 2006 00:04
by Patchman
This would not solve the problem of null bytes though.

Still, it shouldn't be too hard to copy the mkpttxt code for the backslash handling to grfcodec, but I doubt I'll find the time to work on grfcodec in the near future.