PAL & NTSC-J support + updates (#1490)

* PAL dumps files

* alrighty then

* make PAL warning slightly more specific

* PAL patches for `title-obs`

* Update all-types.gc

* PAL patch `beach-obs`

* `process-taskable` PAL patch

* `ambient` PAL patch

* `yakow` PAL patch

* `village-obs` PAL patch

* `sparticle-launcher` patch

* `swamp-obs` PAL patch

* `sequence-a-village1` PAL patch

* typo

* errors

* `powerups` PAL patch

* `ogreboss` PAL patch

* jak 1 v2 encoding

* `load-boundary` PAL patch

* `flying-lurker` PAL patch

* `mayor` PAL patch

* update game encoding to PAL (v2) encoding

* `cam-debug` and `cam-update` PAL patch

* `fisher` PAL patch

* `target` PAL patch

* `target2` PAL patch and fix text compiling

* `target-death` PAL patch

* `target-racer-h` PAL patch

* `logic-target` PAL patch

* `main` PAL patch

* `snow-flutflut-obs` PAL patch

* `rolling-obs` PAL patch

* `gsound` PAL patch

* update refs

* `progress` and `progress-draw` PAL patches

* clang

* wrong.

* complain

* clang

* fix test

* fix blurry jp text

* fix weird interrupt lag from setting window size

* patch more text lines, special handling for credits

* Update FontUtils.cpp

* Add xdelta3 and file patching interface

* add window lock toggle and update settings ver

* better particle hacks

* add PAL support to extractor

* Fix credits

* also NTSC-J support

* make xdelta3 a separate library

* address feedback

Co-authored-by: water <awaterford111445@gmail.com>
This commit is contained in:
ManDude
2022-06-22 05:16:34 +01:00
committed by GitHub
parent 90a049dcc5
commit 7d5045ab3f
92 changed files with 14446 additions and 9934 deletions
+70 -3
View File
@@ -24,6 +24,10 @@ DecompilerLabel get_label(ObjectFileData& data, const LinkedWord& word) {
return data.linked_data.labels.at(word.label_id());
}
static const std::unordered_map<GameTextVersion, std::pair<int, int>> sTextCreditsIDs = {
{GameTextVersion::JAK1_V1, {0xb00, 0xf00}},
{GameTextVersion::JAK1_V2, {0xb00, 0xf00}}};
} // namespace
/*
@@ -133,7 +137,7 @@ GameTextResult process_game_text(ObjectFileData& data, GameTextVersion version)
}
std::string write_game_text(
const Config& /*cfg*/,
GameTextVersion version,
const std::unordered_map<int, std::unordered_map<int, std::string>>& data) {
// first sort languages:
std::vector<int> languages;
@@ -144,9 +148,30 @@ std::string write_game_text(
// build map
std::map<int, std::vector<std::string>> text_by_id;
std::map<int, std::vector<std::string>> text_by_id_credits;
std::map<int, std::vector<std::string>> text_by_id_post_credits;
int last_credits_id = 0;
int credits_begin = 0;
int credits_end = 0;
if (auto it = sTextCreditsIDs.find(version); it != sTextCreditsIDs.end()) {
credits_begin = it->second.first;
credits_end = it->second.second;
}
for (auto lang : languages) {
for (auto& text : data.at(lang)) {
text_by_id[text.first].push_back(text.second);
for (auto& [id, text] : data.at(lang)) {
if (id < credits_begin) {
// comes before credits
text_by_id[id].push_back(text);
} else if (id < credits_end) {
// comes before credits
text_by_id_credits[id].push_back(text);
if (id > last_credits_id) {
last_credits_id = id;
}
} else {
// comes after credits
text_by_id_post_credits[id].push_back(text);
}
}
}
@@ -165,6 +190,48 @@ std::string write_game_text(
}
result += ")\n\n";
}
if (text_by_id_credits.size() > 0) {
result += fmt::format("(credits :begin #x{:04x}\n ", sTextCreditsIDs.at(version).first);
for (int id = sTextCreditsIDs.at(version).first; id <= last_credits_id; ++id) {
// check if the line exists first
if (text_by_id_credits.count(id) == 0) {
result += fmt::format("\"\"\n ");
continue;
}
// check if all lines are identical first
bool diff_langs = false;
bool is_first = true;
std::string last_lang;
for (auto& y : text_by_id_credits.at(id)) {
if (is_first) {
is_first = false;
} else if (last_lang != y) {
diff_langs = true;
break;
}
last_lang = y;
}
// now write them
if (!diff_langs) {
result += fmt::format("\"{}\"\n ", last_lang);
} else {
result += fmt::format("(");
for (auto& y : text_by_id_credits.at(id)) {
result += fmt::format("\"{}\"\n ", y);
}
result += ")\n ";
}
}
result += ")\n\n";
}
for (auto& x : text_by_id_post_credits) {
result += fmt::format("(#x{:04x}\n ", x.first);
for (auto& y : x.second) {
result += fmt::format("\"{}\"\n ", y);
}
result += ")\n\n";
}
return result;
}