LGR file format

Before starting a new topic read Moposite's Help and earlier topics. Note: this forum is for Elma problems, not Moposite.

Moderator: Moporators

Post Reply
QauNuckShin
Kuski
Posts: 10
Joined: 11 Apr 2004, 09:56
Location: Malmö, Sweden
Contact:

LGR file format

Post by QauNuckShin »

I'm trying to make an application which will keep track of your .lgr files for you and exchange them for you easily, so that you don't have to cut and paste.

The basic application is finished, but I thought it would be nice if you could see a preview of the lgr file. The problem is that I don't know how the LGR file format works, so I can't do it.. Does anyone know how the LGR file works, and would you please explain it to me?

[EDIT]
I just thought of something.. I think I read somewhere on these forums about an application making LGRs into PCXs.. That would be useful, cause that way I could just make PCX, then use it in the application and then delete files again.. Yup, gonna go try that now, but feel free to help me anyways, in any way you can ;)
This is a block of text that can be added to posts you make.
There is a 800 character limit
User avatar
chux
Kuski
Posts: 2636
Joined: 27 Aug 2002, 22:59
Location: Elmaville, UK

Post by chux »

Any chance of making aprogram that extracts the picture files as somethin other than PCX? JPG would be great, GIF or BMP...something a bit more common
I dream of a world where chickens can cross the road without their motives being questioned.
Image
Hi! I'm a signature virus. Copy me into your signature to help me spread.
User avatar
Kopaka
39mins club
Posts: 6611
Joined: 23 May 2002, 13:59
Team: LAME
Location: In a northern danish city beating YOUR record.
Contact:

Post by Kopaka »

well, there already is a prog for changing lgr...
QauNuckShin
Kuski
Posts: 10
Joined: 11 Apr 2004, 09:56
Location: Malmö, Sweden
Contact:

Even better..

Post by QauNuckShin »

Even better would be a program which only extracts a few of the pictures, say the sky, ground, grass, biker, flower and apple. That way you could show the user a picture of how the LGR looks..

I found an application here on the forums by SectorZero which extracted all pictures to pcx. However, it extracted all the pictures, which is not what I want. I messaged him and asked if he could make something for me, or simply help me to understand the LGR file yesterday, but I haven't gotten an answer yet.
This is a block of text that can be added to posts you make.
There is a 800 character limit
teajay
Donator duck
Posts: 10043
Joined: 3 Apr 2003, 17:53

Post by teajay »

where did you mail to?
QauNuckShin
Kuski
Posts: 10
Joined: 11 Apr 2004, 09:56
Location: Malmö, Sweden
Contact:

I

Post by QauNuckShin »

I mailed to the e-mail he put here on the forums, his msn-messenger e-mail..
This is a block of text that can be added to posts you make.
There is a 800 character limit
SectorZero
Kuski
Posts: 31
Joined: 26 Jun 2003, 19:39
Location: Netherlands
Contact:

Re: Even better..

Post by SectorZero »

QauNuckShin wrote:Even better would be a program which only extracts a few of the pictures, say the sky, ground, grass, biker, flower and apple. That way you could show the user a picture of how the LGR looks..

I found an application here on the forums by SectorZero which extracted all pictures to pcx. However, it extracted all the pictures, which is not what I want. I messaged him and asked if he could make something for me, or simply help me to understand the LGR file yesterday, but I haven't gotten an answer yet.
My msn-email is just for the msn protocol, most e-mail i get there is spam, so it's most likely that i deleted your e-mail.
Last edited by SectorZero on 12 Apr 2004, 15:19, edited 1 time in total.
Image
SectorZero
Kuski
Posts: 31
Joined: 26 Jun 2003, 19:39
Location: Netherlands
Contact:

Post by SectorZero »

This is the LGR file format that i concluded...

Code: Select all

LGR Structure:

-----------------------------------------------------
LGR Header:
Offset:		Length:		Description:
-----------------------------------------------------
0		         5		MagicChars (=LGR12)
5		         4		Total Images. (t)
9		         4		[Unknown]
13		         4		Listed Images. (i)

The following values are the attributes for the
listed images. Each value is in the lgr i times.

i*17		        4		Picture Type.
i*21		        4		Picture Distance.
i*25		        4		Picture Clipping.
-----------------------------------------------------

Then the pictures start:

-----------------------------------------------------
Picture Entry (there are t entrys)
Offset:		Length:		Description:
-----------------------------------------------------
0		        12		Filename.
12		        8		[Unknown]
20		        4		File Length.
-----------------------------------------------------

~~~~~~~~~~~~~~~~~~~~~ PCX DATA ~~~~~~~~~~~~~~~~~~~~~~

when you reached a total bytes, equally to the
filelenght, you get another Picture Entry.


Constantes:

Picture Type:
 100: Picture
 101: Text
 102: Mask
 
Clipping Mode:
 0: U
 1: G
 2: S

The Unknown bytes aren't needed in my case, I haven't 
figured out yet what they mean.
Image
QauNuckShin
Kuski
Posts: 10
Joined: 11 Apr 2004, 09:56
Location: Malmö, Sweden
Contact:

Well..

Post by QauNuckShin »

Well.. I thought I did. It said "message sent", but now there is no trace of it, it's not in the sent messages folder.

Hm. Oh well.

Anyways, the mail was about your application. It began with a report of a problem, that the application won't work like it says in the readme. You actually need to give lgrext.exe the relative path to the LGR, i.e. if both files are in C:\Elastomania, then you don't put C:\Elastomania\file.lgr, cause then it won't work. You have to put file.lgr.

Totally off track here..
Yeah, anyway.. If you've read the above posts you should know what I need.. I need something to extract grass, sky, ground, apples, flower and the biker, and nothing else. Preferrably in BMP-format, but PCX are fine too. I need the application to be able to run from anywhere, as long as you give it the correct path. The extracted images should be put in the same folder as the application, not as the LGR.

Do you feel up for it? I've tried to understand the LGR file format, but I just can't see how it works! I'm not able to do anything useful with it, except using it of course.


And on a side note, does anyone know a good program for making the pictures for an own LGR? All applications I tried save the PCX in a format Elma can't use, it just goes like a TV without connection, you know..
This is a block of text that can be added to posts you make.
There is a 800 character limit
SectorZero
Kuski
Posts: 31
Joined: 26 Jun 2003, 19:39
Location: Netherlands
Contact:

Post by SectorZero »

Well, i explain the entire LGR format in my post, so I really don't know why you don't understand it. When you want to extract only a few images you should read out the picture entries until you've found an entry with a filename of a picture you want to extract, and then write the pcx data of that picture to a file. (The pictures are stored as PCX in the LGR, so you cannot just read them out as BMP, then you should first make a piece of code that converst PCX to BMP).

About my prog and the readme, you might be right about it. I made the prog just for fun because I wanted to code something, and so maybe I typed wrong information in the readme. Don't really feel like fixing it though, guess im lame ;)
Image
QauNuckShin
Kuski
Posts: 10
Joined: 11 Apr 2004, 09:56
Location: Malmö, Sweden
Contact:

Hehe

Post by QauNuckShin »

The reason I wrote I didn't understand was..


(DRUMROLL)


I was writing it before you posted your explanation.
Yeah, it just took a while to write it.. So you posted that while I was writing. =)

[EDIT]
Lamer. ;)
This is a block of text that can be added to posts you make.
There is a 800 character limit
SectorZero
Kuski
Posts: 31
Joined: 26 Jun 2003, 19:39
Location: Netherlands
Contact:

Post by SectorZero »

Ah, ok :D

The funny thing is that were both now, on the same moment refreshing this topic, and replying... So I can understand that you missed a post ;)
Last edited by SectorZero on 12 Apr 2004, 15:52, edited 1 time in total.
Image
QauNuckShin
Kuski
Posts: 10
Joined: 11 Apr 2004, 09:56
Location: Malmö, Sweden
Contact:

Hehe

Post by QauNuckShin »

Hehe, yeah..

Hm. I think I understand kind of how it works now.. I'm pretty new to programming, though, been studying for half a year now.. So we'll just have to see how it turns out. =)
This is a block of text that can be added to posts you make.
There is a 800 character limit
SectorZero
Kuski
Posts: 31
Joined: 26 Jun 2003, 19:39
Location: Netherlands
Contact:

Re: Hehe

Post by SectorZero »

QauNuckShin wrote:Hehe, yeah..

Hm. I think I understand kind of how it works now.. I'm pretty new to programming, though, been studying for half a year now.. So we'll just have to see how it turns out. =)
Well, if you study programming you should know how to make this i guess... (me doesn't take lessons, cuz we don't get them at high school ;))

But, good luck then ;)
Image
QauNuckShin
Kuski
Posts: 10
Joined: 11 Apr 2004, 09:56
Location: Malmö, Sweden
Contact:

Well..

Post by QauNuckShin »

Well, as I said.. We'll see.
So far, we've only used Visual Basic.. And our teacher hasn't really gone into file handling more than outputting text files..

Hm... High school.. that's when you're 16-18 years old, right? In Sweden, that's called "Gymnasiet". I'm in second grade now.

[EDIT]
Hm. I honestly don't know what I'm doing wrong. Damn. Here I was thinking I was a little talented, and then this comes along. =(
Well, at least I still kick my whole school's ass in programming.. not that they're any good.

Hey, would you be very annoyed if I asked to see your code?
This is a block of text that can be added to posts you make.
There is a 800 character limit
User avatar
chux
Kuski
Posts: 2636
Joined: 27 Aug 2002, 22:59
Location: Elmaville, UK

Post by chux »

Okii, so can the pcx->bmp->pcx prog be made? its all i ask, honest!
I dream of a world where chickens can cross the road without their motives being questioned.
Image
Hi! I'm a signature virus. Copy me into your signature to help me spread.
User avatar
milagros
Cheatless
Posts: 4560
Joined: 19 May 2002, 17:05

Post by milagros »

many free progs can do that (bmp->pcx->tga...) so no reason to make it
i think finding out what's what in lgr-file isn't very hard
some average programmer surely had no problem
[carebox]
QauNuckShin
Kuski
Posts: 10
Joined: 11 Apr 2004, 09:56
Location: Malmö, Sweden
Contact:

well..

Post by QauNuckShin »

Hey! You're calling me a below-average programmer? =þ

Just kidding, I'm a true newbie.
This is a block of text that can be added to posts you make.
There is a 800 character limit
teajay
Donator duck
Posts: 10043
Joined: 3 Apr 2003, 17:53

Post by teajay »

i dunnot see a reason for this program, but for learning this newbie coding.

We take seczero's prog
We take an PCX file and convert it
We smile.

Maybe for some lamers who don't have such tools, ok, nvm I shut up already. :oops:
QauNuckShin
Kuski
Posts: 10
Joined: 11 Apr 2004, 09:56
Location: Malmö, Sweden
Contact:

yeah..

Post by QauNuckShin »

yeah, but seczero's prog extracts all files. I don't want all. It's just unneccesary work for the computer (which doesn't matter on a fast one, but maybe on a slower one)..

And yeah, of course the project is about learning.. As I said, I started studying programming less than a year ago, and we've only gone through VB so far.
This is a block of text that can be added to posts you make.
There is a 800 character limit
Post Reply