Gallery
Software
Music
Programming
Archive
Saturday, Feb 23 Week 8

NOL Nokia Operator Logo


NOL file structure

Element Size Offset
TNokiaNolHeader 20 0 (beginning)
Data uWidth*uHeight 20

type //20-byte header, followed by pixel data in ASCII text format.
pNokiaNolHeader=^TNokiaNolHeader;
TNokiaNolHeader=packed record //probably 72x14 or 78x21 px, other sizes supported
uSig :longWord; //SIG_NOKIA_NOL
uVersion :word; //version
uUnknown1 :word; //unknown #1
uUnknown2 :word; //unknown #2
uWidth :word; //width (72)
uHeight :word; //height (14)
uUnknown3 :word; //unknown #3
uUnknown4 :word; //unknown #4
uUnknown5 :word; //unknown #5
end;

const
NULL = #0;
SIG_NOKIA_NOL = $004C4F4E; //NOL[NULL]

Read file header into memory

//Read header from a file into preallocated buffer of a given size...
//from: http://www.mortenbs.com/delphi-read-file-header/
function readFileHeader(pFileName:pAnsiChar;pBuf:pointer;uSize:longWord):boolean;
const ac=GENERIC_READ;sh=FILE_SHARE_READ;attr=FILE_ATTRIBUTE_READONLY;
var h:THandle;n:longWord;
begin
result:=false;
if (pFileName=nil) or (pBuf=nil) or (uSize=0) then exit;
h:=windows.createFileA(pFileName,ac,sh,nil,OPEN_EXISTING,attr,0); //open read
if h<>INVALID_HANDLE_VALUE then begin
result:=windows.readFile(h,pBuf^,uSize,n,nil) and (n=uSize);
windows.closeHandle(h); //close
end;
end;

Read NOL file info

function nol_fileinfo(filename:ansiString;memo:TMemo):bool;
var sz:longWord;buf:TNokiaNolHeader;
begin
result:=false;
sz:=sizeOf(TNokiaNolHeader);
if not readFileHeader(pAnsiChar(filename),@buf,sz) then exit;
with buf do begin
if uSig<>SIG_NOKIA_NOL then exit; //unknown format
memo.lines.add('filename='+filename);
memo.lines.add('width='+intToStr(uWidth)); //ex.: 72 px
memo.lines.add('height='+intToStr(uHeight)); //ex.: 14 px
memo.lines.add('version='+intToStr(uVersion));
end;
result:=true;
end;

Example

procedure TForm1.FormCreate(Sender: TObject);
var filename:ansiString;
begin
memo1.clear;
filename:='C:\sample.nol';
if not nol_fileinfo(filename,memo1) then memo1.text:='error';
end;

Related pages of NOL Nokia Operator Logo

Programming
Delphi programming
Colors and formats
File formats and fileinfo
Read file header into memory
BMP Bitmap file info
NGG Nokia Group Graphics