Author Topic: FF8 wallpaper .lzs converting?  (Read 4237 times)

FF8 wallpaper .lzs converting?
« on: 2004-12-16 23:22:33 »
hi, does anybody know a program to convert .lzs FF8 wallpaper files into .bmp image files? I know you can use Qhimms 'Eight' program, view the files on there and just do a screenshot and crop it but is there a program that will convert them into bitmaps for you?

thanks

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
FF8 wallpaper .lzs converting?
« Reply #1 on: 2004-12-17 06:49:03 »
I did it once, but i don't remember how .. i'll try to do it on the weekend and then i'll tell you. Well but anyhow why bother when you can do it with Eight ?

bspbsp

  • *
  • Posts: 24
    • View Profile
FF8 wallpaper .lzs converting?
« Reply #2 on: 2004-12-17 08:59:25 »
Try the codes listed below, compile under VC++6.0.
Can't remember when wrote this, many are copyed directly from the code of Eight.  :D


Code: [Select]
#include<fstream.h>
#include<iostream.h>
#include<windows.h>


void main()
{
 ifstream src(argc[1],ios::in|ios::binary);//lzs
 ofstream dst(argc[2],ios::out|ios::binary);//bmp
 if(!src||!dst)
 {
  cout<<"file open error.";
  return;
 }
 // Load the texture
 int iWidth=0, iHeight=0, iColors=0;
 src.read((unsigned char *)&iColors,4);
 if(iColors)src.seekg(0x10,ios::beg);
 src.read((unsigned char *)&iWidth,2);
 src.read((unsigned char *)&iHeight,2);
 
 //strcture for bitmap
 BITMAPINFO* bmi = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER));
 bmi->bmiHeader.biBitCount = 16;
 bmi->bmiHeader.biClrImportant = 0;
 bmi->bmiHeader.biClrUsed = 0;
 bmi->bmiHeader.biCompression = BI_RGB;
 bmi->bmiHeader.biHeight = -iHeight;//must be negative
 bmi->bmiHeader.biPlanes = 1;
 bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
 bmi->bmiHeader.biSizeImage = 0; //iWidth*iHeight*2
 bmi->bmiHeader.biWidth = iWidth;
 bmi->bmiHeader.biXPelsPerMeter = 0;
 bmi->bmiHeader.biYPelsPerMeter = 0;
/*
 src.seekg(0xF0,ios::beg);//palette
 src.read((unsigned char *)bmi->bmiColors,4*iColors);
 for (int i=0;i<iColors;i++)
  bmi->bmiColors[i].rgbReserved = 0;// Make sure rgbReserved is zero
*/
 unsigned char *bits = (unsigned char*)malloc(iWidth*iHeight*2);//data
 src.read(bits,iWidth*iHeight*2);
 
 unsigned int tmpFlip,tmp;
 for (int i=0;i<iWidth*iHeight*2;i+=2) {
  tmp=bits[i]+(bits[i+1]<<8);
  tmpFlip = (tmp & 0x7C00) >> 10;  // Red -> Blue
  tmpFlip |= (tmp & 0x07E0);   // Green -> Green
  tmpFlip |= (tmp & 0x001F) << 10; // Blue -> Red
  tmp = tmpFlip;
  bits[i]=tmp;bits[i+1]=tmp>>8;
 }

 // Build the bitmap file
 BITMAPFILEHEADER bmfh;
 //BITMAPINFOHEADER bmih;
 
 bmfh.bfType = 'MB'; // BM (byteflipped)
 bmfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + iWidth*iHeight*2;
 bmfh.bfReserved1 = 0;
 bmfh.bfReserved2 = 0;
 bmfh.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

 dst.write((unsigned char *)&bmfh, sizeof(bmfh));
 dst.write((unsigned char *)&bmi->bmiHeader, sizeof(BITMAPINFOHEADER));
// dst.write((unsigned char *)bmi->bmiColors, iColors*sizeof(RGBQUAD));

// for (int j=0;j<iHeight;j++)
//  dst.write(bits+(iHeight-j-1)*iWidth*2,iWidth*2); //if iHeight>0
  dst.write(bits,iWidth*iHeight*2);
 free(bmi);
 free(bits);
 src.close();
 dst.close();
 return;
}

Cyberman

  • *
  • Posts: 1572
    • View Profile
FF8 wallpaper .lzs converting?
« Reply #3 on: 2004-12-17 22:34:04 »
Quote from: mirex
I did it once, but i don't remember how .. i'll try to do it on the weekend and then i'll tell you. Well but anyhow why bother when you can do it with Eight ?

As an asside not, none of the intro images are findable in the PSX version. That leads me to believe they were also LZS compressed on the PSX version.  I wonder how I can find this data now.  Hunt sector by sector and decompress the first sector maybe?

Cyb

FF8 wallpaper .lzs converting?
« Reply #4 on: 2004-12-21 11:52:32 »
hey bspbsp was that code meant for me or for mirex? I don't program so I don't have VC++6.0 to compile it with. But thank you very much for doing it.

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
FF8 wallpaper .lzs converting?
« Reply #5 on: 2004-12-21 12:00:49 »
themanwiththemachinegun: try looking at the files with my tool Biturn I think it could view and convert them (but im not sure if they dont have to be unLZS-ed first ), download here: http://mirex.mypage.sk/FILES/bi085.rar

FF8 wallpaper .lzs converting?
« Reply #6 on: 2004-12-21 14:58:12 »
mirex, I have used Biturn before (it's a cool program, good work) but it didn't convert or view ff8 lzs files. But it was handy for converting other ff8 files.

Can someone help me and compile those codes bspbsp gave? I'm not a programmer and I don't have the software to do it. Would really aprecciate it. Thanks.