reading a file .ILB version 1.1
by NEKRALL
nekrall@libero.it
send me an e-mail if you like my work or to tell me trouble you find or if you have any question, note i'm italian ,do you like my english? (it's my first work!)
-----------------------------v1.1 UPDATE--------------------------
yuph! i wrote lib instead of LIB
i've discovered image lenght has to be precise.
i've discovered some other header's feature.
--------------------------------START----------------------- ----
this guide provides informations about decoding a file .ILB so you can make your personal libraries for your AoW MOD.
i'll explain meaning of codes using the file ShieldsM.ilb as example because it's first file i've edited, but other .ilb work as well.
please be careful when editing a file , always make a copy and store it in another directory!
if you make heavy alteration to a .ilb Aocge usually will not open it but don't worry,AoW still run it (if you make the right changes obviously)
oohh!!! read my intro about hex numbers with care
let's go!!!
a file .ilb usually is made up by 2 parts:
headerS part, where info about using images are stored
data part , where images are stored
to edit the file you must open it with an exadecimal/ascii editor (i'use UltraEdit32)
now you can see 3 columns :
1° row address
2° exadecimal code (HEX)
3° ascii code
each ascii simbol is made by a couple of exadecimal numbers
each ascii row contains 16 simbol
each exadecimal row contains 16 couple
there's no difference between normal and capital letter in HEXcode
everytime you change 2° column you change 3° column as well and vice versa
NNNBBB: always change 2° columns because many hexadecimal codes share same ascii code , exception :editing text like " elf.bmp" in 3° column is faster
i'll use this rules in my guide:
i use plain number for decimal number ( es : 12)
i use 'h' after exadecimal number ( es: A1F2h)except when i refer to 2° column where all number are exadecimal
i always refer to positions in ascii columns , ultraedit tells your actual position in ascii column on to the bottom of the window both in exadecimal and in decimal numbers
i mark vital information with '!'
i mark unknown info with'?' don't touch them
NNNNBBBBB: numbers greater than FFh are splitted between more couple in REVERSED order example : 63262=F7IEh become 'IE F7' in 2° column
if you got trouble with exadecimal-decimal conversion open the calculator of WINDOWS (under the start menu , find it) click on 'view' and select 'scientific'
now let's go to see how a lib is made:
1° row : contains the word LIB and same other useless ( i'think) informatins
2° row : codes 1-4 , first image starting point !!!!!!!!!!
codes 5-8 , LIB total lenght ( useless,you can change real lenght without changing this)
these are standard info for all lib , after that in race .ilb you can see a pack of strange rows ( ??) and then the header codes,in shieldM.ilb there're immediately header codes.
so let's see the header codes (vital info), open aow/int/shieldM.ilb and follow my explanation:
each header is made up of 74+ codes ( i 'think), because there are different type of header; there's a header for each image in the .ilb.
now you can see the name of each image in the ascii column,
put your cursor onto the SECOND name'shieldM'(i'll explain why later) , this ISN'T the header start but you can recognize always it, you are on a 'S' if you take a look on 2°column you can see code'53h'
move backward 13 codes exactly after the 'ÿÿÿÿ' : you're on '01h',this's the start of a header and this's the image index (NB 2° image has index 01h),IT'S THE SAME INDEX AOCGE SHOWS YOU on each image.
(NB: if you move backward from 1° 'shieldM' you'll find '00h' because 1°image has index 00h and there aren't the 'ÿÿÿÿ')
move forward 3 codes onto '16h', this's instruction type ,
in this LIB you'll find type 10h,12h,16h.
each is different i'll explain later.
mov fw 4 codes onto '03h' ?????
mov fw 1 code onto '0Ch' this's image name's lenght (includes .bmp) !!!
mov after 'bmp' onto '28' this's image width in pixel !!!
mov fw 3 onto '35' this's image height in pixel !!!
mov fw 12 onto '01' useless
mov fw 4 onto '01' ???
mov fw 1 onto '68' this and the next 3 codes tell how greater image is, example : you can read '68 0d 00 00h' ->'d68h'(you remember how to read number greater than FFh?) -> 3432 that's number of ascii code image takes.!!!!!
next 4 codes '18 0c 00 00': this's image offset,
it's added to the number in 2°row to get image beginning!!!!
next code '28' image width repeated , change always both !!
mov fw 4 onto '35' image height repeated !!!
mov fw 5 onto '01' ??
mov fw 7 onto '10 93 50' this's ending of standard header , you can notice there are other codes because this's a type'16h'header
see it:
mov onto '27' this's real image width!!!!
mov fw 4 onto '2c' this's real image height!!!
mov fw 8 onto '04' this number seems to control starting height in the box (null rows above image) !!!
mov fw 4 onto '0a' ???
mov fw 4 onto 'ff ff ff ff' (=ascii 'ÿÿÿÿ') this's default after each header
next start another header ('02h' , 3°image)
types of header :
'16h' : this's first type you can see, after the 'PV'(ascii) there are info about resizing of images , example :shields are 43x59 pixel but the Human shield is only 40(28h)x53(35h) if you put it directly in the 43x59 box it appears messed up so you must resize.
'12h' : this is 2° type before the ending 'ff ff ff ffh' there's '14 60 46 00' , i can't figure how does this work , i think it's used for transparence because this shields are placed in the event box , it's used for the shields 14-26(0Dh -1Ah)
'10h' : 3°type , used for shield 27-39, header finish after 'PV'(ascii) , used for images that doesn't require resizing
QUESTIONS AND ANSWER:
-why do i start from 2° image?
because 1° image start with '00h' and there isn't ÿÿÿÿ before,now you can find 1° header by yourself.
-can i change one image with one other in same file?
this is simple : open the .ILB with aocge and decide which image swap then edit the lib swapping the index number of the two images
example :if you want AoW using azrac shield for humans and viceversa find the index ( first code of each header) '00h','0Dh','1Bh' and swap with '01h','0Eh','1Ch'
this's a very simple hacking, you can't assign same shield to 2 races but continue to read...
-can i use same image for 2 or more box?
yes, change the offset (starting point) of the image , remember to change also width and height .
example : azrac shield('01h') start at '18 0C 00 00' width '28' height '35' resize widht '27' height '2c' , i'll overwrite them with '00 00 00 00''28''35''24'2b' (change also image lenght!),save and finish.
Now Azracs got human shield too.
-can i swap image also between different header type ?
yes, if you put a image type 10 or 12 onto 16 you got no problem simply remember to resize all if you put image on type 10 remember to use width and heigth of the resizing window ( lesser value ,ok?)
if you put image 10 on type 12 you must delete the last bites until it look like type 16 then change image offset on the 2° row
-why images have different lenght ?
only first 26 shields have variable lenght because they use a lesser number of pixels, images 27-39 are all 43x59 ,
NB each pixel has a code of 2 couples like '00 0a' ( 16bit)
so images 27-39 need 43x59x2=5074 ascii codes
-can i edit images ?
not for now, you can change them pixel x pixel , but are you sure you want it?
aocge doesn't function properly , it opens the .ILB ,converts it to bitmap , but when reconverts use a slightly different codification.
-does this sistem work for all .ILB?
yes, swapping index always work , other sistem require an analisys of the header type ( many types exist with added features)
-can i swap images between different .ILB?
yes, but you must paid great care.
i swap city images from highmen in the halfling ilb so i've got yellow banners on high castles .
note that quite always images will be of different size so you must change offset and lenght.
i will not explain how i made but you can manage it with a bit of practice and using my guidelines above.
-i've changed image but it appears all messed up, why?
when you change one image you must change the header as well
vital info are : width , height, image lenght,address offset
please note that if you insert an image LONGER you must change header info also in other headers, if you put an image SHORTER simply insert null pixel( '00 0Ah') until you reach old lenght
-can i change image name ?
yes, if you don't change name lenght it's all ok
if you write a shorter name insert empty spaces
if you write longer you must change the name lenght in the header and starting offset in 2° row
note however names aren't never used so you haven't to change them to run aow
send your notes and questions to nekrall@libero.it [This message has been edited by Nekrall (edited 07-05-2003 @ 04:26 PM).]
thanks for reading