-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paths3d_extract.cpp
More file actions
118 lines (94 loc) · 3.44 KB
/
s3d_extract.cpp
File metadata and controls
118 lines (94 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
* EverQuest S3D Extract
*/
#include <iostream>
#include <string>
#include <vector>
#include <s3d/boost_foreach.hpp>
#include <s3d/file.hpp>
bool bListFilenames = false;
bool bExtractAllFiles = true;
bool bExtractTextureFilesOnly = false;
bool bExtractSpecificFile = false;
std::string sExtractSpecificFile;
int main(int argc, char *argv[])
{
std::cout << "EverQuest S3D Extract" << std::endl;
if (argc < 2)
{
std::cout << "Usage: s3d_extract.exe file.s3d (option)" << std::endl;
std::cout << "Options:" << std::endl;
std::cout << " -d, --dir List Filenames, Do Not Extract" << std::endl;
std::cout << " -a, --all Extract All Files" << std::endl;
std::cout << " -t, --textures Extract Texture Files Only" << std::endl;
std::cout << " -f, --file <filename> Extract Specific File" << std::endl;
std::cout << "Note: If option is omitted, Extract All Files is the default action." << std::endl;
return 0;
}
if (argc > 2)
{
std::string option = argv[2];
if (option == "-d" || option == "--dir" || option == "-l" || option == "--list")
{
std::cout << "Option: List Filenames, Do No Extract" << std::endl;
bListFilenames = true;
bExtractAllFiles = false;
bExtractTextureFilesOnly = false;
bExtractSpecificFile = false;
}
if (option == "-a" || option == "--all" || option == "--extractall")
{
std::cout << "Option: Extract All Files" << std::endl;
bListFilenames = false;
bExtractAllFiles = true;
bExtractTextureFilesOnly = false;
bExtractSpecificFile = false;
}
if (option == "-f" || option == "--file" || option == "--filename")
{
if (argc > 3)
{
std::cout << "Option: Extract Specific File" << std::endl;
bListFilenames = false;
bExtractAllFiles = false;
bExtractTextureFilesOnly = false;
bExtractSpecificFile = true;
sExtractSpecificFile = argv[3];
}
}
if (option == "-t" || option == "--textures" || option == "--texturesonly")
{
std::cout << "Option: Extract Texture Files Only" << std::endl;
bListFilenames = false;
bExtractAllFiles = false;
bExtractTextureFilesOnly = true;
bExtractSpecificFile = false;
}
}
s3d::file file;
file.open(argv[1]);
std::cout << "File: " << argv[1] << std::endl;
std::cout << "Number Of Files: " << file.get_num_files() << std::endl;
foreach (std::string filename, file.get_file_names())
std::cout << "Filename: " << filename << std::endl;
if (!bListFilenames)
{
if (bExtractAllFiles)
{
file.extract();
}
else
{
if (bExtractSpecificFile)
{
file.extract(true, bExtractTextureFilesOnly, sExtractSpecificFile);
}
else
{
file.extract(true, bExtractTextureFilesOnly);
}
}
}
file.close();
return 0;
}