I need some informations about the pak file structure.
If anyone can provide some, or any sources of a tools that read / write pak files, it would be helpfull. Thanks in advance !
Pak files structure
<a href='http://www.technohell.net' target='_blank'><b><span style='color:red'>>>> Helbreath Ressources Website Here <<<</span></b></a><br>C++ Sources, Tools, Server Files, Help on Forum, C++ Snippets, Toplist... Updated often, come visit us !
It's just a bunch of BMPs put into one file with rectangles. Google might help you on this, since PAK files are not only used in HB, but also for forums and more.
<img src='http://i9.tinypic.com/2vs292h.jpg' border='0' alt='user posted image' />
I know some shit about these paks, but maybe anyone here dealed more than me with it.
-Sprite File Header-
Signature 20bytes : <Sprite File Header>
Reserve? 80bytes : 0x00
NumberOfObjects 4bytes
ObjLeft 2bytes
ObjTop 2bytes
ObjWidth 2bytes
ObjHeight 2bytes
DispPosFixX 2bytes
DispPosFixY 2bytes
This is uncomplete and can't really help me... Looking for sources from hbpak and pakbuilder, this would help me alot
-Sprite File Header-
Signature 20bytes : <Sprite File Header>
Reserve? 80bytes : 0x00
NumberOfObjects 4bytes
ObjLeft 2bytes
ObjTop 2bytes
ObjWidth 2bytes
ObjHeight 2bytes
DispPosFixX 2bytes
DispPosFixY 2bytes
This is uncomplete and can't really help me... Looking for sources from hbpak and pakbuilder, this would help me alot

<a href='http://www.technohell.net' target='_blank'><b><span style='color:red'>>>> Helbreath Ressources Website Here <<<</span></b></a><br>C++ Sources, Tools, Server Files, Help on Forum, C++ Snippets, Toplist... Updated often, come visit us !
meh. I'll post the stuff I have for my 3d client setup since I had to take the original paks and convert them.
That's the entire loading function. m_lpDib was the bmp memory. With paks you have to be a bit careful with colors. It's a bit of a bitch.. Reason there were so many options is because it was just that.. most of the paks were different from each other. Perhaps it was to save space, but if they REALLY wanted to save space they should have used compression. I took these sprites and turned them into ALL 24bit bitmaps and compressed them and took less than half the space of the originals that were 1/4/8/24 bit mixed.
else
m_wColorNums = (WORD)(bmpInfoHeader->biClrUsed);
important.. sometimes they used 255 colors also. So watch out for that.
Code: Select all
CTexture::CTexture (char * cFilename, int iPage, int iID, int iType, BOOL bIsSingle)
{
char cFile[500];
HANDLE m_hPakFile;
DWORD nCount;
D3DCOLOR colorkey = 0x0;
int iASDstart = 0;
BITMAPFILEHEADER fh;
m_iTotalFrame = 0;
m_dwBitmapFileStartLoc = 0;
m_dwRefTime = 0;
m_bIsCached = FALSE;
ZeroMemory(m_cFilename, 500);
memset(cFile, 0, 500);
texture = NULL;
m_bIsSingle = bIsSingle;
if (bIsSingle)
StringCbPrintf(cFile, 500, "%s", cFilename);
else
StringCbPrintf(cFile, 500, "SPRITES\\%s.pak", cFilename);
memcpy(m_cFilename, cFile, strlen(cFile));
m_hPakFile = CreateFile(cFile, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL);
if (m_hPakFile == INVALID_HANDLE_VALUE)
return;
SetFilePointer(m_hPakFile, 24 + iPage*8, NULL, FILE_BEGIN);
ReadFile(m_hPakFile, &iASDstart, 4, &nCount, NULL); // i´Â ASDÆÄÀÏÀÇ ½ÃÀÛÀ§Ä¡
SetFilePointer(m_hPakFile, iASDstart+100, NULL, FILE_BEGIN);
ReadFile(m_hPakFile, &m_iTotalFrame, 4, &nCount, NULL);
m_dwBitmapFileStartLoc = iASDstart + (108 + (12*m_iTotalFrame));
//m_stBrush = new stBrush[m_iTotalFrame];
//ReadFile(m_hPakFile, m_stBrush, 12*m_iTotalFrame, &nCount, NULL);
//memcpy(m_cPakFileName, cPakFileName, strlen(cPakFileName));
m_stBrush = new stBrush[m_iTotalFrame];
ReadFile(m_hPakFile, m_stBrush, 12*m_iTotalFrame, &nCount, NULL);
SetFilePointer(m_hPakFile, m_dwBitmapFileStartLoc, NULL, FILE_BEGIN);
ReadFile(m_hPakFile, (char *)&fh, 14, &nCount, NULL);//sizeof(bmpHeader)==14
m_lpDib = (LPSTR)new char[fh.bfSize-14];
ReadFile(m_hPakFile, (char *)m_lpDib, fh.bfSize-14, &nCount, NULL);
CloseHandle(m_hPakFile);
char cTxt[8];
memset(cTxt, 0, 8);
int * ip = (int *)cTxt;
*ip = iPage;
ip += 4;
ip = (int *)(cTxt+4);
*ip = m_iTotalFrame;
ip += 4;
if (iType == 1) StringCbPrintf(cFile, 50, "data\\data\\%d.dat", iID);
else if (iType == 2) StringCbPrintf(cFile, 50, "data\\tiles\\%d.dat", iID);
else if (iType == 3) StringCbPrintf(cFile, 50, "data\\effects\\%d.dat", iID);
FILE * pFile = fopen(cFile, "wb");
if (pFile == NULL) return;
fwrite(cTxt, 1, 8, pFile);
fwrite(m_stBrush, 1, 12*m_iTotalFrame, pFile);
fclose(pFile);
//////////////////////////////////////////////////////////////////////////
//alpha setting
LPBITMAPINFOHEADER bmpInfoHeader = (LPBITMAPINFOHEADER)m_lpDib;
m_bmpInfo = (LPBITMAPINFO)m_lpDib;
m_wWidthX = (WORD)(bmpInfoHeader->biWidth);
m_wWidthY = (WORD)(bmpInfoHeader->biHeight);
if (bmpInfoHeader->biClrUsed == 0)
{
if(bmpInfoHeader->biBitCount == 24) m_wColorNums = 0;
else if(bmpInfoHeader->biBitCount == 8) m_wColorNums = 256;
else if(bmpInfoHeader->biBitCount == 1) m_wColorNums = 2;
else if(bmpInfoHeader->biBitCount == 4) m_wColorNums = 16;
else m_wColorNums = 0;
}
else m_wColorNums = (WORD)(bmpInfoHeader->biClrUsed);
if (m_lpDib)
delete m_lpDib;
m_lpDib = NULL;
return;
}
else
m_wColorNums = (WORD)(bmpInfoHeader->biClrUsed);
important.. sometimes they used 255 colors also. So watch out for that.
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia
</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.

thank you very much Zero, it's gonna help me alot !!
<a href='http://www.technohell.net' target='_blank'><b><span style='color:red'>>>> Helbreath Ressources Website Here <<<</span></b></a><br>C++ Sources, Tools, Server Files, Help on Forum, C++ Snippets, Toplist... Updated often, come visit us !
How's it going? I still have that problem with that Eldiniel-Soldier Sprite. I think I'm going to rip it out, and re-add it with your Client.diuuude wrote: thank you very much Zero, it's gonna help me alot !!
<!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->charlie says:<br>i may own outpost but im not a nerd<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->(locobans @ Mar 12 2007, 10:48 PM) <br>"Remember while peeing, If you shake it more than twice you playing with it..." <br><!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->