- Joined
- Feb 13, 2009
- Messages
- 34
- Reaction score
- 1
This tool can extract all version rose client.
View attachment vfseditor_mini.zip
code use visual studio 2010
USE:
build project, put vfseditor.exe to game dir... the run
View attachment vfseditor_mini.zip
code use visual studio 2010
USE:
build project, put vfseditor.exe to game dir... the run
Code:
#include <Windows.h>
#include <stdio.h>
#include <direct.h>
#include <string>
#ifdef _WIN32
#include <direct.h>
#include <io.h>
#elif _LINUX
#include <stdarg.h>
#include <sys/stat.h>
#endif
#ifdef _WIN32
#define ACCESS _access
#define MKDIR(a) _mkdir((a))
#elif _LINUX
#define ACCESS access
#define MKDIR(a) mkdir((a),0755)
#endif
/// vfs颇老救俊 乐绰 颇老累诀阑 窍扁 困茄 器牢磐
struct VFileHandle
{
FILE * fp; /// vfs颇老狼 颇老勤甸. VFile俊辑 弊措肺 墨乔茄促
char * pData; // Memory Mapped IO data
int iAllocOffset; // pData + iAllocOffset = Read Data Address
std::string sFileName; /// 泅犁 坷锹茄 颇老捞抚. vfs颇老郴狼 颇老捞抚.
long lStartOff; /// 泅犁颇老狼 矫累 Offset
long lEndOff; /// 泅犁颇老狼 付瘤阜 Offset. dwEndOff + 1 捞 End Of File 捞促.
long lCurrentOffset; /// 泅犁 File Indicator Offset. 磊扁狼 Start 坷橇悸 扁霖栏肺
BYTE btFileType; /// 0 = Packed File , 1 = Normal File outside
BYTE btEncrypted; // 0 = normal data , 1 = data encryption used
void* hVFS;
void* hCVFS; // the pointer to CVFS by which this file handle was opened.
} ;
struct TVFSELEMENT
{
};
/// nNum俺狼 nSize农扁狼 巩磊凯阑 府畔茄促
bool __AllocString (char **ppString , int nNum, int nSize)
{
for(int i = 0; i < nNum; i++)
{
ppString[ i ] = NULL;
}
for(int i = 0; i < nNum; i++)
{
if(!(ppString[ i ] = new char[ nSize ])) { return false; }
}
return true;
}
int CreatDir(char *pDir)
{
int i = 0;
int iRet;
int iLen;
char* pszDir;
if(NULL == pDir)
{
return 0;
}
pszDir = strdup(pDir);
iLen = strlen(pszDir);
// 创建中间目录
for (i = 0;i < iLen;i ++)
{
if (pszDir[i] == '\\' || pszDir[i] == '/')
{
pszDir[i] = '\0';
//如果不存在,创建
iRet = ACCESS(pszDir,0);
if (iRet != 0)
{
iRet = MKDIR(pszDir);
if (iRet != 0)
{
return -1;
}
}
//支持linux,将所有\换成/
pszDir[i] = '/';
}
}
iRet = MKDIR(pszDir);
free(pszDir);
return iRet;
}
int main( int argc, char* argv[])
{
//加载DLL
HINSTANCE hDllInst = LoadLibrary("triggervfs.dll");
char *vfsName[5] = {"3DDATA.VFS","BASIC.VFS","DATA.VFS","GROUND.VFS","MAP.VFS"};
if(hDllInst)
{
typedef void * (WINAPI *MYFUNC)(const char * FileName, const char * Mode);
MYFUNC OpenVFS = NULL;
OpenVFS = (MYFUNC)GetProcAddress(hDllInst,"_OpenVFS@8");
typedef int (WINAPI *MYFUNC2)(void *);
MYFUNC2 VGetVfsCount = NULL;
VGetVfsCount = (MYFUNC2)GetProcAddress(hDllInst,"_VGetVfsCount@4");
typedef int (WINAPI *MYFUNC3)(void* hVFS, char **ppFiles, DWORD dwNum, short dwMaxPath);
MYFUNC3 GetVfsNames = NULL;
GetVfsNames = (MYFUNC3)GetProcAddress(hDllInst,"_VGetVfsNames@16");
typedef int (WINAPI *MYFUNC4)(void* hVFS, const char *VfsName);
MYFUNC4 GetFileCount = NULL;
GetFileCount = (MYFUNC4)GetProcAddress(hDllInst,"_VGetFileCount@8");
typedef int (WINAPI *MYFUNC5)(void* hVFS, const char *VfsName, char **FileName, int nNum, int nMax);
MYFUNC5 GetFileNames = NULL;
GetFileNames = (MYFUNC5)GetProcAddress(hDllInst,"_VGetFileNames@20");
typedef VFileHandle* (WINAPI *MYFUNC6)(const char * FileName, void* hVFS);
MYFUNC6 OpenFile = NULL;
OpenFile = (MYFUNC6)GetProcAddress(hDllInst,"_VOpenFile@8");
typedef size_t (WINAPI *MYFUNC7)(void* hVFS, const char *FileName);
MYFUNC7 GetFileLength = NULL;
GetFileLength = (MYFUNC7)GetProcAddress(hDllInst,"_VGetFileLength@8");
typedef size_t (WINAPI *MYFUNC8)(void *buffer, size_t size, size_t count, VFileHandle *pVFH);
MYFUNC8 vfread = NULL;
vfread = (MYFUNC8)GetProcAddress(hDllInst,"_vfread@16");
if(OpenVFS)
{
//GetVfsCount
void *pData_idx = OpenVFS("data.idx", "r");
if (pData_idx)
{
int fileCount = VGetVfsCount(pData_idx);
printf("FileCount %d\n", fileCount);
}
//GetVfsNames
//GetFileCount
for(int i = 0; i < 5; i++)
{
int fileCount = GetFileCount(pData_idx, vfsName[i]);
printf("%svFile Count %d\n", vfsName[i], fileCount);
//GetFileNames
char **ppFile = new char *[fileCount];
if(!__AllocString (ppFile, fileCount, 1024)) { return false; }
GetFileNames(pData_idx, vfsName[i], ppFile, fileCount, 1024);
BYTE * pbtData = NULL;
VFileHandle *pFileHandle = NULL;
std::string path,dir;
FILE *pFile = NULL;
for(int j = 0; j< fileCount; j++)
{
printf("%s\n", ppFile[j]);
long lSize = GetFileLength ( pData_idx, ppFile[j]);
if (lSize > 0)
{
pbtData = new BYTE[ lSize ];
//Open File
pFileHandle = OpenFile(ppFile[j], pData_idx);
size_t stReadCnt = vfread (pbtData, sizeof (BYTE), lSize, pFileHandle);
//printf("file size %d\n", stReadCnt);
//创建目录
path = ppFile[j];
dir = path.substr(0, path.find_last_of("\\"));
CreatDir((char *)dir.c_str());
//保存文件
pFile = fopen(path.c_str(), "wb");
if (pFile)
{
fwrite(pbtData, stReadCnt, 1, pFile);
fclose(pFile);
}
pbtData = NULL;
pFileHandle = NULL;
pFile = NULL;
}
}
}
}
}
return 0;
}
Attachments
You must be registered for see attachments list