mirror of
https://github.com/izzy2lost/Torch.git
synced 2026-07-06 00:18:35 -07:00
Torch v0.1 (#12)
* Splitted version yamls and implemented wip geo and dlist extraction * Fixed linux compilation * Added PoC WSL 2 detection * Add undefined behaviour * Added gfxdis as submodule * update * Removed gfxdis as a submodule * Code works * Replace ByteSwap with BSWAP * Cleanup vertice factory * readability * readability 2 * Cleanup gfxfactory * last one * Rename name to symbol * More implementation * Implemented first PoC of C file generation * Added output formatting on factories * changes * Moved generated dlists onto their respective folder * Migrated more factories onto the new extractor system * Fully ported all factories and added header generation * Some updates * Added Lights factory * fix * Fixed vtx extraction * Lights work now * delete old startup_logo yaml * Generate all sections in single file * Added support to generate header and code for textures * Added O3 for release builds * Added WIP dlist extraction and moved to use f3dold microcode * Added segment support, autogeneration and fixed C generation * Added symbol names on display list extraction * Removed warnings * Moved back to transform and replace * Removed unnecesary macros * Added extraction order and reversed vtx order * Implemented true backwards sort * [WIP] Implemented runtime gbi, more headers and a few config features * Fix CLI11 on WSL and variety of fixes * Fixes * Update DisplayListFactory.h * Update TextureFactory.cpp * wip lights * fix * Correct callback * Added waypoints * Update ceremony_data.yml * Changes * Update TextureFactory.cpp * Update commandline args * Update comment * Remove printf * Update couple commands * Renamed cubeos to torch * Removed unused stuff and added an example config file --------- Co-authored-by: KiritoDv <kiritodev01@gmail.com> Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
+54
-24
@@ -5,39 +5,69 @@
|
||||
#ifdef STANDALONE
|
||||
Companion* Companion::Instance;
|
||||
|
||||
void BindOTRMode(CLI::App& app){
|
||||
auto otr = app.add_subcommand("otr", "Extracts the rom to a folder");
|
||||
std::string filename;
|
||||
otr->add_option("rom", filename, "sm64 us rom")->required()->check(CLI::ExistingFile);
|
||||
otr->parse_complete_callback([&]() {
|
||||
auto instance = Companion::Instance = new Companion(filename);
|
||||
instance->Init();
|
||||
});
|
||||
}
|
||||
|
||||
void BindPackMode(CLI::App& app){
|
||||
auto pack = app.add_subcommand("pack", "Packs the rom from a folder");
|
||||
std::string folder;
|
||||
pack->add_option("folder", folder, "Folder")->required()->check(CLI::ExistingDirectory);
|
||||
std::string output;
|
||||
pack->add_option("output", output, "MPQ Output")->required();
|
||||
pack->parse_complete_callback([&]() {
|
||||
Companion::Pack(folder, output);
|
||||
});
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
CLI::App app{"CubeOS - Rom extractor"};
|
||||
CLI::App app{"Torch - [T]orch is [O]ur [R]esource [C]onversion [H]elper\n\
|
||||
* It extracts from a baserom and generates code or an otr.\n\
|
||||
* It can also generate an otr from a folder of assets.\n"
|
||||
};
|
||||
std::string mode;
|
||||
std::string filename;
|
||||
std::string target;
|
||||
std::string folder;
|
||||
bool otrMode = false;
|
||||
bool debug = false;
|
||||
bool header = false;
|
||||
|
||||
BindOTRMode(app);
|
||||
BindPackMode(app);
|
||||
app.require_subcommand();
|
||||
|
||||
/* Generate an OTR */
|
||||
auto otr = app.add_subcommand("otr", "OTR - Generates an otr\n");
|
||||
|
||||
otr->add_option("<baserom.z64>", filename, "")->required()->check(CLI::ExistingFile);
|
||||
|
||||
otr->add_flag("-t,--target", target, "OTR output destination");
|
||||
otr->add_flag("-o,--otr", otrMode, "OTR Mode");
|
||||
otr->add_flag("-d,--dir", folder, "Generate OTR from a directory of assets");
|
||||
otr->add_flag("-z,--zeader", header, "Generates a header");
|
||||
otr->add_flag("-v,--verbose", debug, "Verbose Debug Mode");
|
||||
otr->parse_complete_callback([&]() {
|
||||
auto instance = Companion::Instance = new Companion(filename, otrMode, debug);
|
||||
|
||||
if (header) {
|
||||
instance->Init(ExportType::Header);
|
||||
} else {
|
||||
instance->Init(ExportType::Binary);
|
||||
}
|
||||
|
||||
if (!folder.empty()) {
|
||||
Companion::Pack(folder, target);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/* Generate C code */
|
||||
auto code = app.add_subcommand("code", "Code - Generates C code\n");
|
||||
|
||||
code->add_option("<baserom.z64>", filename, "")->required()->check(CLI::ExistingFile);
|
||||
|
||||
code->add_flag("-v,--verbose", debug, "Verbose Debug Mode; adds offsets to C code");
|
||||
code->parse_complete_callback([&]() {
|
||||
auto instance = Companion::Instance = new Companion(filename, otrMode, debug);
|
||||
instance->Init(ExportType::Code);
|
||||
});
|
||||
|
||||
try {
|
||||
app.parse(argc, argv);
|
||||
} catch (const CLI::ParseError &e) {
|
||||
std::cout << app.help() << std::endl;
|
||||
return app.exit(e);
|
||||
}
|
||||
|
||||
// No arguments --> display help.
|
||||
if (argc == 1) {
|
||||
std::cout << app.help() << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user