PDA

View Full Version : How to loading .x in zip file



feelthat
08-02-2013, 06:11 AM
here is sample code
int size;
std::string load_zip;
std::string load_mesh;
FileSystemZip* pFileSystem;
IReadFile* memfile;
byte* buff_extract;
IrrlichtDevice* device;

pFileSystem = new FileSystemZip();
pFileSystem->Init(load_zip.c_str());
buff_extract = pFileSystem->Get(buff_filename, &size);

memfile = device->getFileSystem()->createMemoryReadFile(buff_extract, size, load_mesh.c_str(), true);

mesh = pScene->getMesh( memfile );
node = pScene->addAnimatedMeshSceneNode( mesh );
////////////////////here is media update batch
////////////////////rttex is a zip file already you do not need to zip it~~
cls
set ZIP_EXE=..\..\shared\win\utils\7za.exe
set RTTEX_EXE=..\..\shared\win\utils\RTPack.exe

cd game
for /r %%i in (*.x *.b3d) do ..\%ZIP_EXE% a %%~pni.zip %%i
for /r %%i in (*.bmp *.png *.jpg *.tga) do ..\%RTTEX_EXE% -flipv -stretch -pvrt8888 %%i
for /r %%i in (*.rttex) do %RTTEX_EXE% %%i
cd ..

cd interface
for /r %%i in (*.x *.b3d) do ..\%ZIP_EXE% a %%~pni.zip %%i
for /r %%i in (*.bmp *.png *.jpg *.tga) do ..\%RTTEX_EXE% -flipv -stretch -pvrt8888 %%i
for /r %%i in (*.rttex) do %RTTEX_EXE% %%i
cd ..

rmdir ..\bin\game /S /Q
rmdir ..\bin\interface /S /Q
rmdir ..\bin\audio /S /Q

mkdir ..\bin\game
xcopy game ..\bin\game /E /F /Y /EXCLUDE:xcopy_exclude.txt

mkdir ..\bin\interface
xcopy interface ..\bin\interface /E /F /Y /EXCLUDE:xcopy_exclude.txt

mkdir ..\bin\audio
xcopy audio ..\bin\audio /E /F /Y /EXCLUDE:exclude.txt

cd game
for /r %%i in (*.zip) do del %%i
for /r %%i in (*.rttex) do del %%i
cd ..

cd interface
for /r %%i in (*.zip) do del %%i
for /r %%i in (*.rttex) do del %%i
cd ..

pause
/////////////xcopy_exclude.txt
.x
.b3d
.txt
.bak
.max
.obj
.svn
.psd
.png
.fbx
.tmp
.fnt
.bmp
.jpg
.png
.tga


//////////////////////
attachment have newer 7za can extract by proton, original 7za can not

feelthat
08-03-2013, 07:10 PM
byte* mybuf;
unsigned int filesize = 64434;

byte* pInput;
FILE* myfile = fopen("C:\\VmData\\proton_sdk_source\\RT3DApp\\bin\\game\ \deko.zip","rb");
mybuf = new byte[filesize];
fread(mybuf,1,filesize,myfile);
pFileSystem_stream = new FileSystemZip();
pFileSystem_stream->Init_Memory(mybuf,filesize);
buff_extract = pFileSystem_stream->Get("deko.x", &size);
delete pFileSystem_stream;

//////////
add file ioapi_mem.c and modify unzip.c , FileSystemZip.cpp
10467
10468

feelthat
08-05-2013, 09:28 AM
renew unzip array buffer source code
10571


byte* mybuf;
unsigned int filesize = 64434;

byte* pInput;
FILE* myfile = fopen("C:\\VmData\\proton_sdk_source\\RT3DApp\\bin\\game\ \deko.zip","rb");
mybuf = new byte[filesize];
fread(mybuf,1,filesize,myfile);
pFileSystem_stream = new FileSystemZip();
pFileSystem_stream->Init_Memory(mybuf,filesize);
buff_extract = pFileSystem_stream->Get("deko.x", &size);
delete pFileSystem_stream;

//////////
add file ioapi_mem.c and modify unzip.c , FileSystemZip.cpp
10467
10468