Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

webrodex

Editor XFS - WC

Recommended Posts

bom galera não entendo nada de c++ mas sera que tem como copilar esse codigo aki para min eu nao sei como faço para copilar o .exe corretamente vou posta o codigo aki no c++ postem para min o arquivo exe no rapidshare ou outro lugar ou me mande no email ntnetx@hotmail.com obrigado !

 

 

Readme

 

This is a PRIVATE progam of Softnyx and Gunbound Classic.

Xenesis File System v4 for GunboundWC XFS Resources .

 

How to compile this scrip :

 

- Open xfs.cpp in a C++ compiler, and compile the code .

- Create the file : config.cfg

- Open the compiled progam and edit the XFS

 

If you do not understand, search for a C++ Coder

 

 

DO NOT SEND THIS CODE TO OTHER PEOPLES .

 

Tutorial by Softnyx

 

 

Download do codigo de fonte > http://rapidshare.com/files/78175651/wc_xfs.zip.html

 

 

xfs.cpp

 

#include "xfsconf.h"

xfs::xfs(void)
{
}

xfs::~xfs(void)
{
}

int xfs::decompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen){
	ZlibEngine *c_stream = new ZlibEngine;

	uLongf total_Len = *destLen;
	uLongf currentSize = 0;

	while(currentSize < total_Len){
		*destLen = total_Len;
		sourceLen = (*(uLongf *)source) & 0xFFFFFF;
		source += 5;
		int error = c_stream->decompress(dest + currentSize, destLen, source, sourceLen);
		if (error != Z_OK) {
			*destLen = currentSize;
			break;
		}
		source		+= sourceLen;
		currentSize += *destLen;
	}

	return 1;
}
int xfs::unpack(void){
	FileInfoBlock *myFile = (FileInfoBlock*)this->xfsInfo;
	for (int i=0; i < this->xfsInfoLen / FILE_INFO_LEN; i++){
		int size = (int)strlen(this->OutputDir) + strlen(myFile->header);
		char *fileToCreate = (char *)malloc(size+1);
		strcpy(fileToCreate, this->OutputDir);
		strcat(fileToCreate, "\\");
		strcat(fileToCreate, myFile->header);

		Bytef *pCurrFile	= buff + myFile->position;
		uLongf outputSize	= myFile->unpackedSize;
		uLongf inputSize	= myFile->packedSize;
		uLongf initSize		= (*(uLongf *)pCurrFile) & 0xFFFF;
		if (outputSize == initSize) pCurrFile += 3;
		//if(*(pCurrFile+5) == 0x78) pCurrFile += 0x05;
		//else pCurrFile +=0x08;
		Bytef *out = (Bytef *)malloc(outputSize);
		//if(!strcmp(myFile->header,"dragon.img")){
		//	_asm nop;
		//}
		int error = this->decompress(out, &outputSize, pCurrFile, inputSize);
		FILE *fo = fopen(fileToCreate,"wb");
		fwrite(out, outputSize, 1, fo);
		fclose(fo);

		myFile++;
	}
	return 1;
}
int xfs::unpackInfo(){
	return 1;
}
int xfs::init(Bytef *fbuff, char *outputDir){
	this->OutputDir = outputDir;
	int err = CreateDirectoryA(outputDir, NULL);

	this->buff = fbuff;
	this->pPacketTail	= buff + *((long *)fbuff);
	this->signBlockLen	= *this->pPacketTail;

	this->pPacketInfo	= this->pPacketTail + this->signBlockLen + 1;
	this->xfsInfoLen	= (*(long *)pPacketInfo) & 0x00FFFFFF;
	this->pPacketInfo	+= 3;

	
	ZlibEngine *c_stream = new ZlibEngine;
	unsigned long outLength = this->xfsInfoLen * 100;
	this->xfsInfo = (Bytef *)malloc(outLength);
	c_stream->decompress(this->xfsInfo,&outLength,this->pPacketInfo,this->xfsInfoLen);
	this->xfsInfoLen = outLength;
	return INIT_OK;
}

 

xfs_xlib

 

//
// This file contains the implementation the
// the ZlibEngine class, used to simplify
// compression and decompression of files
// using the Zlib engine.
//
// The ZlibEngine is a Tiny Software (tm) project.
// You may use the code in this project without restriction.
// Contact markn@tiny.com for more information.
//

#if defined( _WINDOWS )
#include <windows.h>
#endif

//
// The constructor initializes a couple of members
// of the z_stream class.  See the Zlib documentation
// for details on what those members do
//

ZlibEngine::ZlibEngine()
{
	zalloc = 0;  //z_stream member
	zfree = 0;   //z_stream member
	opaque = 0;  //z_stream member
//
// I initialize these members just for tidiness.
//
	fin = 0;
	fout = 0;
}

//
// compress() is the public function used to compress
// a single file.  It has to take care of opening the
// input and output files and setting up the buffers for
// Zlib.  It then calls deflate() repeatedly until all
// input and output processing has been done, and finally
// closes the files and cleans up the Zlib structures.
//
int ZlibEngine::compress( const char *input,
						  const char *output,
						  int level )
{
	err = Z_OK;
	avail_in = 0;
	avail_out = output_length;
	next_out = output_buffer;
	m_AbortFlag = 0;

	fin  = fopen( input, "rb" );
	fout = fopen( output, "wb" );

	deflateInit( this, level );
	for (;; ) {
		if ( m_AbortFlag )
			break;
		if ( !load_input() )
			break;
		err = deflate( this, Z_NO_FLUSH );
		flush_output();
		if ( err != Z_OK )
			break;
		progress( percent() );
	}
	for (;; ) {
		if ( m_AbortFlag )
			break;
		err = deflate( this, Z_FINISH );
		if ( !flush_output() )
			break;
		if ( err != Z_OK )
			break;
	}
	progress( percent() );
	deflateEnd( this );
	if ( m_AbortFlag )
		status( "User Abort" );
	else if ( err != Z_OK && err != Z_STREAM_END )
		status( "Zlib Error" );
	else {
		status( "Success" );
		err = Z_OK;
	}
	fclose( fin );
	fclose( fout );
	fin = 0;
	fout = 0;
	if ( m_AbortFlag )
		return Z_USER_ABORT;
	else
		return err;
}

int ZlibEngine::decompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
{
	z_stream stream;
	int err;

	stream.next_in = (Bytef*)source;
	stream.avail_in = (uInt)sourceLen;
	/* Check for source > 64K on 16-bit machine: */
	if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;

	stream.next_out = dest;
	stream.avail_out = (uInt)*destLen;
	if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;

	stream.zalloc = (alloc_func)0;
	stream.zfree = (free_func)0;

	err = inflateInit(&stream);
	if (err != Z_OK) return err;

	err = inflate(&stream, Z_FINISH);
	*destLen = stream.total_out;
	if (err != Z_STREAM_END) {
		inflateEnd(&stream);
		if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
			return Z_DATA_ERROR;
		return err;
	}

	err = inflateEnd(&stream);
	return err;
}

//
// decompress has to do most of the same chores as compress().
// The only major difference it has is the absence of the level
// parameter.  The level isn't needed when decompressing data
// using the deflate algorithm.
//

int ZlibEngine::decompress( const char *input,
							const char *output )
{
	err = Z_OK;
	avail_in = 0;
	avail_out = output_length;
	next_out = output_buffer;
	m_AbortFlag = 0;

	fin  = fopen( input, "rb" );
	fout = fopen( output, "wb" );
	inflateInit( this );
	for (;; ) {
		if ( m_AbortFlag )
			break;
		if ( !load_input() )
			break;
		err = inflate( this, Z_NO_FLUSH );
		flush_output();
		if ( err != Z_OK )
			break;
		progress( percent() );
	}
	for (;; ) {
		if ( m_AbortFlag )
			break;
		err = inflate( this, Z_FINISH );
		if ( !flush_output() )
			break;
		if ( err != Z_OK )
			break;
	}
	progress( percent() );
	inflateEnd( this );
	if ( m_AbortFlag )
		status( "User Abort" );
	else if ( err != Z_OK && err != Z_STREAM_END )
		status( "Zlib Error" );
	else {
		status( "Success" );
		err = Z_OK;
	}
	if ( fin )
		fclose( fin );
	fin = 0;
	if ( fout )
		fclose( fout );
	fout = 0;
	if ( m_AbortFlag )
		return Z_USER_ABORT;
	else
		return err;
}
//
//  This function is called so as to provide the progress()
//  virtual function with a reasonable figure to indicate
//  how much processing has been done.  Note that the length
//  member is initialized when the input file is opened.
//
int ZlibEngine::percent()
{
	if ( length == 0 )
		return 100;
	else if ( length > 10000000L )
		return ( total_in / ( length / 100 ) );
	else
		return ( total_in * 100 / length );
}

//
//  Every time Zlib consumes all of the data in the
//  input buffer, this function gets called to reload.
//  The avail_in member is part of z_stream, and is
//  used to keep track of how much input is available.
//  I churn the Windows message loop to ensure that
//  the process can be aborted by a button press or
//  other Windows event.
//
int ZlibEngine::load_input()
{
#if defined( _WINDOWS )
	MSG msg;
	while ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) {
		TranslateMessage( &msg );
		DispatchMessage( &msg );
	}
#endif
	if ( avail_in == 0 ) {
		next_in = input_buffer;
		avail_in = fread( input_buffer, 1, input_length, fin );
	}
	return avail_in;
}

//
//  Every time Zlib filsl the output buffer with data,
//  this function gets called.  Its job is to write
//  that data out to the output file, then update
//  the z_stream member avail_out to indicate that more
//  space is now available.  I churn the Windows message
//  loop to ensure that the process can be aborted by a
//  button press or other Windows event.
//

int ZlibEngine::flush_output()
{
#if defined( _WINDOWS )
	MSG msg;
	while ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) {
		TranslateMessage( &msg );
		DispatchMessage( &msg );
	}
#endif
	unsigned int count = output_length - avail_out;
	if ( count ) {
		if ( fwrite( output_buffer, 1, count, fout ) != count ) {
			err = Z_ERRNO;
			return 0;
		}
		next_out = output_buffer;
		avail_out = output_length;
	}
	return count;
}

xfsconf.h

 

#define FILE_INFO_LEN (0x80)
#define INIT_OK 1

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara, pelo Amor de Deus, você FEZ O SEGUNDO TÓPICO MAS ESSE...

 

SE ACHA NO GOOGLE E NÃO PODE ACONTECER ISTO,

 

 

EDITE O TÓPICO POR FAVOR...

Compartilhar este post


Link para o post
Compartilhar em outros sites

poste o erro q aparece!

Pois no compilador ele indicará a linha e a razão do erro!

Compartilhar este post


Link para o post
Compartilhar em outros sites

eu falo o erro mas seria mas facil você ocmpilar pra nois =/

Da erro nessa linha : #include "xfsconf.h"

e nessa:ZlibEngine::ZlibEngine()

 

A cara eum pesso imploro, compila aí para nois=/.

Compartilhar este post


Link para o post
Compartilhar em outros sites

cara c você tem a biblioteca tenta assim:

#include <xfsconf.h>
volte com o resultado!

Compartilhar este post


Link para o post
Compartilhar em outros sites

verifique q você tem a biblioteca requerida e se nela possui o comando q você qr usar!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara é a primeira vez que eu mexo com isso, não intendo quase nada do que se ta falando, me ensina a compilar direitinho aí ou compilar para mim =/.

Compartilhar este post


Link para o post
Compartilhar em outros sites

cara c é a primeira vz q você meche com isso tente aprender coisas básicas.

caso persista nesse tópico, eu qnd for na lan eu compilo pra você!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Certo, eu irei dar uma estudada se percitir no erro eu te pesso via MP ou por aqui mesmo.

 

Edit

 

Cara eu li alguns tutoriais e tentei várias vezes e mesmo assim não consegui =/, o jeito vai ser você copilar para mim mesmo =/ , desculpa o imcomodo.

Compartilhar este post


Link para o post
Compartilhar em outros sites

você tentow coisas basicas pra estudar, ou você insistiu em aprender o codigo q postow?

 

pois c você qr coisas basicas, de uma olhada nos outros topicos deste forum, tem varios problemas resolvidos q podem te ajudar a ter uma boa nocao de linguagem C/C++

Compartilhar este post


Link para o post
Compartilhar em outros sites

nao vao conseguir compilar .

voce tem arquivos e um chamado READ-ME.TXT

 

esse read-me.txt fui que fiz e passei para o ntnetx, e ele achou que realmente era de verdade ..

acha que eu iria passar algo sem nd em troka?

 

lol ..

 

CAPITALISMO meu colegas!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Se existirem todas as bibliotecas se compila sim

 

Mas antes de mais nada o cidadão em que saber o que quer como resultado

 

Ai fica mais facil de resolver

 

A linguagem é muito poderosa e pode-se fazer praticamente qualquer coisa com ela

Compartilhar este post


Link para o post
Compartilhar em outros sites

por favor... estou com problemas pra compilar tbm...

nunca programei e nem sei nada de C/C++/C-QUALQUERCOISA

 

eu sou programador PHP e JAVA apenas, deem uma olhada nesse topico plz...

http://forum.imasters.com.br/index.php...st&p=943961

Compartilhar este post


Link para o post
Compartilhar em outros sites

pessoal eh o seguinte, eu tenho esse codigo e consegui compilar ele porém eu gostaria de saber se alguem aqui sabe me dizer o q preciso fazer para compactar, pois ao que eu entendi ele tem a rotina de compactação e descompactação, porem quando vou usar ele me deixa usar somente a de descompactação alguém ai sabe um modo de eu usar a compactação????

 

desde ja agradeço.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.