add calls to wit, dolphin-tool

This commit is contained in:
shrapnelnet 2025-01-21 18:42:42 +00:00
parent 9a702559a0
commit 11d44bfcdb
Signed by: observer
GPG Key ID: 934A62C2C469FFAF

View File

@ -1,8 +1,34 @@
// greetZ dolphin-emu and WIT team! // greetZ dolphin-emu and WIT team!
#include <algorithm>
#include "options.h" #include "options.h"
#include <format>
#include <cstdlib>
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
int main(const int argc, char *argv[]) { int main(const int argc, char *argv[]) {
// get runtime flags/filepath
parseOptions(argc, argv); parseOptions(argc, argv);
char *filepath = argv[argc - 1];
// convert rvz to iso using dolphin engine
auto dolphinCommand = std::format("dolphin-tool convert -i \"{}\" -f iso -o tmp.iso", filepath);
std::system(dolphinCommand.c_str());
// get game ID using wit (required for USB loader GX)
std::system("wit id tmp.iso > id.txt");
auto idstream = std::ifstream("id.txt");
std::stringstream filebuf;
filebuf << idstream.rdbuf();
std::string id = filebuf.str();
std::system("rm id.txt");
id.erase(std::remove_if(id.begin(), id.end(), ::isspace), id.end());
// convert iso to WBFS using wit
auto witCommand = std::format("wit cp tmp.iso [{}].wbfs", id);
std::system(witCommand.c_str());
return 0; return 0;
} }