mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 14:54:53 -04:00
extractor: cleanup, support unicode properly, and add multi-game support (#1609)
* extractor: refactor and cleanup for multi-game support * deps: switch to `ghc::filesystem` as it is utf-8 everywhere by default * extractor: finally working with unicode * unicode: fix unicode cli args on windows in all `main` functions
This commit is contained in:
+15
-5
@@ -10,6 +10,7 @@
|
||||
#include "common/util/diff.h"
|
||||
#include "common/util/os.h"
|
||||
#include "common/versions.h"
|
||||
#include <common/util/unicode_util.h>
|
||||
|
||||
#include "ObjectFile/ObjectFileDB.h"
|
||||
#include "decompiler/data/TextureDB.h"
|
||||
@@ -17,6 +18,15 @@
|
||||
#include "decompiler/level_extractor/extract_level.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
#ifdef _WIN32
|
||||
auto args = get_widechar_cli_args();
|
||||
std::vector<char*> string_ptrs;
|
||||
for (auto& str : args) {
|
||||
string_ptrs.push_back(str.data());
|
||||
}
|
||||
argv = string_ptrs.data();
|
||||
#endif
|
||||
|
||||
Timer decomp_timer;
|
||||
|
||||
fmt::print("[Mem] Top of main: {} MB\n", get_peak_rss() / (1024 * 1024));
|
||||
@@ -87,8 +97,8 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
// std::string in_folder = file_util::combine_path(argv[2], config.game_name);
|
||||
std::filesystem::path in_folder = std::filesystem::path(argv[2]) / config.game_name;
|
||||
std::filesystem::path out_folder = std::filesystem::path(argv[3]) / config.game_name;
|
||||
fs::path in_folder = fs::path(argv[2]) / config.game_name;
|
||||
fs::path out_folder = fs::path(argv[3]) / config.game_name;
|
||||
|
||||
// Verify the in_folder is correct
|
||||
if (!exists(in_folder)) {
|
||||
@@ -105,7 +115,7 @@ int main(int argc, char** argv) {
|
||||
in_folder.string(), config.expected_elf_name);
|
||||
}
|
||||
|
||||
std::vector<std::filesystem::path> dgos, objs, strs;
|
||||
std::vector<fs::path> dgos, objs, strs;
|
||||
for (const auto& dgo_name : config.dgo_names) {
|
||||
dgos.push_back(in_folder / dgo_name);
|
||||
}
|
||||
@@ -129,7 +139,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
// build file database
|
||||
lg::info("Setting up object file DB...");
|
||||
ObjectFileDB db(dgos, std::filesystem::path(config.obj_file_name_map_file), objs, strs, config);
|
||||
ObjectFileDB db(dgos, fs::path(config.obj_file_name_map_file), objs, strs, config);
|
||||
|
||||
fmt::print("[Mem] After DB setup: {} MB\n", get_peak_rss() / (1024 * 1024));
|
||||
|
||||
@@ -220,7 +230,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
fmt::print("[Mem] After textures: {} MB\n", get_peak_rss() / (1024 * 1024));
|
||||
auto replacements_path = file_util::get_jak_project_dir() / "texture_replacements";
|
||||
if (std::filesystem::exists(replacements_path)) {
|
||||
if (fs::exists(replacements_path)) {
|
||||
tex_db.replace_textures(replacements_path);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user