dolphin/Source/Core/DolphinTool/ToolMain.cpp
Minty-Meeo deba9ce256 Added a way to check Block Size, Compression Method, and Compression Level flags to dolphin-tool
New dolphin-tool command: "header"
-b / --block_size
-c / --compression
-l / --compression_level

Informative RVZ/WIA header2 value "compression_level" is now a s32 instead of a u32, because negative compression is a thing.

Speaking of, it is now possible to use negative compression levels in dolphin-tool's convert command (not the GUI, though).
2022-03-19 17:13:28 -05:00

49 lines
1.2 KiB
C++

// Copyright 2021 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include "Common/Version.h"
#include "DolphinTool/Command.h"
#include "DolphinTool/ConvertCommand.h"
#include "DolphinTool/HeaderCommand.h"
#include "DolphinTool/VerifyCommand.h"
static int PrintUsage(int code)
{
std::cerr << "usage: dolphin-tool COMMAND -h" << std::endl << std::endl;
std::cerr << "commands supported: [convert, verify, header]" << std::endl;
return code;
}
int main(int argc, char* argv[])
{
if (argc < 2)
return PrintUsage(1);
std::vector<std::string> args(argv, argv + argc);
std::string command_str = args.at(1);
// Take off the command selector before passing arguments down
args.erase(args.begin(), args.begin() + 1);
std::unique_ptr<DolphinTool::Command> command;
if (command_str == "convert")
command = std::make_unique<DolphinTool::ConvertCommand>();
else if (command_str == "verify")
command = std::make_unique<DolphinTool::VerifyCommand>();
else if (command_str == "header")
command = std::make_unique<DolphinTool::HeaderCommand>();
else
return PrintUsage(1);
return command->Main(args);
}