LibGrf

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
ChrisCF
Transport Empire Developer
Transport Empire Developer
Posts: 3610
Joined: 26 Dec 2002 16:39
Location: Over there --->

LibGrf

Post by ChrisCF » 23 Oct 2003 14:39

Find attached some source code, which may or may not work, depending on where you are. So far, only support for action 8 pseudo-sprites is implemented (it was only 2-3 hours work - including testing, commenting, and de-fleaing*).

LibGrf is intended to be a set of tools and libraries for those dealing with grf files (most specifically the .nfo files). Its design goal is to provide a means by which people can write tools which take natural definitions (e.g. "Name:" or "Capacity:" etc.) and form the relevant stream of byte values that grfcodec expects in its .nfo format.

If anyone wants to contribute stuff, feel free. Patches against existing source files should be in unified diff format ("diff -ubr > myfile.diff"). If you don't have diff, and you're on Windows, go to http://www.cygwin.com and grab some stuff. Any modifications should also include changes to LibGrf.java in the places specified (namely to constants LIBGRF_VERSION and STATUS - the latter should be "CONTRIB").

Javadoc output is already included, for those that might be looking at developing other things based on LibGrf (not that there's anytyhing there right now).

Notes:

1. LibGrf is GPL'd. No reason why anyone else's code based on it shouldn't be either.

2. Patches should be in the correct format. On a good day, I might hack your incorrectly-submitted patch into a developent copy of code. On a bad day, I might reject it out of hand. You have been warned :)

3. I don't guarantee that this will work. import java.lang.Disclaimer; :)

Have fun.

* flea = a really small, but highly irritating bug
Attachments
LibGrf.zip
The source, binaries, and docs.
(83.78 KiB) Downloaded 1191 times
Last edited by ChrisCF on 23 Oct 2003 15:50, edited 1 time in total.
Bugzilla available for use - PM for details.

User avatar
orudge
Administrator
Administrator
Posts: 24010
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge » 23 Oct 2003 15:00

Java? Bleh... I was hoping it'd be in a decent language like C. I could have made good use of it if it was. Ah well, never mind...

ChrisCF
Transport Empire Developer
Transport Empire Developer
Posts: 3610
Joined: 26 Dec 2002 16:39
Location: Over there --->

Post by ChrisCF » 23 Oct 2003 15:04

And you can't make use of it now because ... ?
Bugzilla available for use - PM for details.

User avatar
orudge
Administrator
Administrator
Posts: 24010
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge » 23 Oct 2003 15:17

Because I can't be bothered to convert it. Even though it's probably mostly compatible. ;)

ChrisCF
Transport Empire Developer
Transport Empire Developer
Posts: 3610
Joined: 26 Dec 2002 16:39
Location: Over there --->

Post by ChrisCF » 23 Oct 2003 15:22

Maybe at some point, (when most of it is done) someone can write necessary command-line interfaces for it. Those that have downloaded it may find that there is already (very) basic support for dumping action 8 on the command line.

That said, if people went and wrote code in whatever language they use (assembler excepted), translated it into an natural-language algorithm that I could implement in Java, I'd still be happy to add them to the contributors list :).

I really could do with some other people to help work on this, some of the actions are still very confusing to me (I can't get my head around 2 or 3).
Last edited by ChrisCF on 23 Oct 2003 15:46, edited 1 time in total.
Bugzilla available for use - PM for details.

User avatar
troopper5
Tycoon
Tycoon
Posts: 1480
Joined: 18 Oct 2002 04:56
Location: Oulu, Finland

Post by troopper5 » 23 Oct 2003 15:45

Sorry, but what is LibGrf?

ChrisCF
Transport Empire Developer
Transport Empire Developer
Posts: 3610
Joined: 26 Dec 2002 16:39
Location: Over there --->

Post by ChrisCF » 23 Oct 2003 15:47

Oops - IE crashed so many times, I just got sick and tired of typing the whole lot out again and again and again and again and ... you get the picture :)

Note to self - put things on CD for use on the Linux machines instead of Zip disks ...

Edited the top post with the information.

Incidentally, any suggestions on which action to tackle next, and who's volunteering to do them? :P
Bugzilla available for use - PM for details.

User avatar
mp3Pro
Tycoon
Tycoon
Posts: 1390
Joined: 21 Jan 2003 14:49
Location: My own home, Sc
Contact:

Post by mp3Pro » 20 Nov 2003 00:00

ummm how do you use this??

User avatar
nwl4891
Engineer
Engineer
Posts: 19
Joined: 24 Apr 2003 14:30
Location: Hong Kong SAR

Great

Post by nwl4891 » 01 Jan 2004 09:08

It is good to use java~~~~~

I want to join~~^_^

ChrisCF
Transport Empire Developer
Transport Empire Developer
Posts: 3610
Joined: 26 Dec 2002 16:39
Location: Over there --->

Post by ChrisCF » 06 Jan 2004 20:46

There is no "join", only "contribute". "Join" sounds too much like commitment :)
Feel free to write some code, preferably using what I've already done as a guide for coding standards, etc. Don't forget to read the Javadoc output handily included.
Ideally, some of the other actions I haven't done would be useful. In fact, I've already forgotten what I had done...

Ideally, if you change existing files I'd rather a patch than a full duplicate file, but I'm feeling generous. Haven't really had the time to work on this for a while.

Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 6 guests