-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
69 lines (57 loc) · 2.26 KB
/
main.cpp
File metadata and controls
69 lines (57 loc) · 2.26 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
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <filesystem>
#include <string>
#include "extractorimpl.h"
namespace fs = std::filesystem;
// TODO: add --metadata mode functionality
// TODO: add RSL support
// TODO: add --compress mode (if possible)
int main(int argc, char* argv[])
{
std::string mode;
fs::path directory;
std::cout << std::endl << std::endl << std::endl << std::endl; // im.. sorry
std::cout << "DDSExtractor" << std::endl;
std::cout << "------------" << std::endl;
std::cout << "Supported file extensions: .bin, .dat, .sti, .jmb" << std::endl;
std::cout << "In order to get access to such files, please use: https://github.com/Timo654/No-More-RSL" << std::endl;
std::cout << std::endl;
if ( argc < 2 )
{
std::cout << "Please specify the mode that the tool should run in (--extract --extracthashed --import --nmhfixandhash or --bintodds): ";
std::getline( std::cin, mode );
}
else
{
mode = argv[1];
}
if ( mode != "--extract" && mode != "--extracthashed" && mode != "--import" && mode != "--nmhfixandhash" && mode != "--btole" && mode != "--extractarchive" && mode != "--gm2" && mode != "--bintodds")
{
std::cerr << "Invalid mode: " << mode << std::endl;
std::cerr << "Mode flag should be either --extract to extract DDS files, or --import to re-import DDS files" << std::endl;
return 1;
}
if ( argc < 3 )
{
std::cout << "Please specify the path you want the tool to work in: ";
std::string input_dir;
std::getline( std::cin, input_dir );
directory = fs::path( input_dir );
}
else
{
directory = argv[2];
}
ExtractorMode extractor_mode_flag = DDSExtractor::GetModeFromString( mode );
if ( extractor_mode_flag == ExtractorMode::NONE )
{
std::cerr << "Invalid mode: " << mode << std::endl;
std::cerr << "Mode flag should be one of --extract, --extracthashed, --import, --nmhfixandhash or --bintodds" << std::endl;
return 1;
}
std::vector<std::string> extensions = { ".bin", ".BIN", ".dat", ".DAT", ".sti", ".STI", ".jmb", ".JMB", ".GM2" };
DDSExtractor::ProcessDirectory( directory, extensions, extractor_mode_flag );
return 0;
}