G
Gromtar
Guest
Hiho,
sorry for my bad english but i try my best and hope you guys understand me
I have a little problem with the LZS compression.
I am currently learning c++ (2 days), then i found the QhimmWiki and it seemed interesting so i put some code together to load the lgp's in the memory and dump files out of it to the HD.
So far it worked good but now i want to unpack the lzs files but it seems i am to stupid :'(
For the start i wanted to walk down all the controllbytes and lenghtbyte of the refference to get the total size of the decodet data but i get the wrong input pos and dont know why.
Code: [Select]
Wen i dump the "ll_obj->curr->memPtr" to hd with this
Code: [Select]
the file has the same content and file size as the file i extracted with highwind. So the input data cant be wrong.
Does some one see the error? I dont get it (like i said it seems i am to stupid
)
sorry for my bad english but i try my best and hope you guys understand me
I have a little problem with the LZS compression.
I am currently learning c++ (2 days), then i found the QhimmWiki and it seemed interesting so i put some code together to load the lgp's in the memory and dump files out of it to the HD.
So far it worked good but now i want to unpack the lzs files but it seems i am to stupid :'(
For the start i wanted to walk down all the controllbytes and lenghtbyte of the refference to get the total size of the decodet data but i get the wrong input pos and dont know why.
Code: [Select]
Code:
int lgp_tools::decodeLZS(int fileID) { ll_obj->SelectElement(fileID); char *data = ll_obj->curr->memPtr; int inputPos = 4; char controlByte; int wSize; while(inputPos <= ll_obj->curr->filesize) { controlByte = data[inputPos]; inputPos = inputPos + 1; for (int i = 0; i <= 7;i++) { if ((controlByte >> i) & 1) { inputPos = inputPos + 1; wSize = wSize + 1; } else { int len = (data[inputPos + 1] & 0xF) + 3; wSize = wSize + len; inputPos = inputPos + 2; } } } cout << wSize <<"\n"; }
Code: [Select]
Code:
void lgp_tools::dumpFile(string path, int fileID) { ll_obj->SelectElement(fileID); ofstream outputFile (path.c_str(), ios::out | ios::binary); outputFile.write((char *) ll_obj->curr->memPtr, ll_obj->curr->filesize); outputFile.close(); }
Does some one see the error? I dont get it (like i said it seems i am to stupid
Last edited: