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:
Tyler Wilding
2022-07-05 20:38:13 -04:00
committed by GitHub
parent ac1e620161
commit 6446389263
70 changed files with 7010 additions and 765 deletions
+4 -7
View File
@@ -1,7 +1,5 @@
#include "TextureDB.h"
#include <filesystem>
#include "common/util/Assert.h"
#include "third-party/fmt/core.h"
@@ -45,12 +43,11 @@ void TextureDB::add_texture(u32 tpage,
}
}
void TextureDB::replace_textures(const std::filesystem::path& path) {
std::filesystem::path base_path(path);
void TextureDB::replace_textures(const fs::path& path) {
fs::path base_path(path);
for (auto& tex : textures) {
std::filesystem::path full_path =
base_path / tpage_names.at(tex.second.page) / (tex.second.name + ".png");
if (std::filesystem::exists(full_path)) {
fs::path full_path = base_path / tpage_names.at(tex.second.page) / (tex.second.name + ".png");
if (fs::exists(full_path)) {
fmt::print("Replacing {}\n", full_path.string().c_str());
int w, h;
auto data = stbi_load(full_path.string().c_str(), &w, &h, 0, 4); // rgba channels