grfcodec 0.9.7 test version

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
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

grfcodec 0.9.7 test version

Post 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.
Attachments
grfcodec-0.9.7-pre1-lin.zip
Linux version (gcc 3.3.4, glibc 2.3.3)
(28.7 KiB) Downloaded 58 times
grfcodec-0.9.7-pre1.zip
Windows version
(40.69 KiB) Downloaded 72 times
Last edited by Patchman on 26 Aug 2005 18:01, edited 1 time in total.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post 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.
Attachments
grfcodec-0.9.7-pre2.zip
grfcodec 0.9.7 pre2 fix1
(30.58 KiB) Downloaded 62 times
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
Oracle
Tycoon
Tycoon
Posts: 2138
Joined: 22 May 2003 09:59

Post 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?
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post 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 :)
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post 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
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Post 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
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post 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.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: belgi and 21 guests