mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 14:28:34 +00:00
DolphinTool: CLI utility interface and disc image tools
This commit is contained in:
parent
1e212d6212
commit
1aa8a4d46f
19 changed files with 968 additions and 26 deletions
45
Source/Core/DolphinTool/ToolMain.cpp
Normal file
45
Source/Core/DolphinTool/ToolMain.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
// 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/VerifyCommand.h"
|
||||
|
||||
static int PrintUsage(int code)
|
||||
{
|
||||
std::cerr << "usage: dolphin-tool COMMAND -h" << std::endl << std::endl;
|
||||
std::cerr << "commands supported: [convert, verify]" << 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
|
||||
return PrintUsage(1);
|
||||
|
||||
return command->Main(args);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue