mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Fixed up menutext
This commit is contained in:
@@ -161,10 +161,10 @@
|
||||
"ASSET_MENU_TEXT_JAPANESE"
|
||||
],
|
||||
"language-order": [
|
||||
"ENGLISH",
|
||||
"FRENCH",
|
||||
"GERMAN",
|
||||
"JAPANESE"
|
||||
"LANGUAGE_ENGLISH",
|
||||
"LANGUAGE_FRENCH",
|
||||
"LANGUAGE_GERMAN",
|
||||
"LANGUAGE_JAPANESE"
|
||||
],
|
||||
"menu-text-build-ids": [
|
||||
"ASSET_MENU_TEXT_STEREO",
|
||||
|
||||
@@ -100,12 +100,12 @@ void BuildGameText::build_textbox(std::vector<uint8_t> &out, std::string &srcPat
|
||||
write_basic_command(out, 3, fontIndex);
|
||||
} else if(cmdType == "SetBorder") {
|
||||
write_basic_command_4_args(out, 4,
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "Left"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "Top"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "Right"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "Bottom")
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "left"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "top"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "right"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "bottom")
|
||||
);
|
||||
} else if(cmdType == "SetColor") {
|
||||
} else if(cmdType == "SetColour") {
|
||||
write_basic_command_4_args(out, 5,
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "red"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "green"),
|
||||
@@ -113,7 +113,7 @@ void BuildGameText::build_textbox(std::vector<uint8_t> &out, std::string &srcPat
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "alpha")
|
||||
);
|
||||
} else if(cmdType == "SetAlignment") {
|
||||
write_basic_command(out, 6, get_string_from_json(srcPath, "pages", page, cmd, "value") == "Center" ? 0 : 4);
|
||||
write_basic_command(out, 6, get_string_from_json(srcPath, "pages", page, cmd, "value") == "center" ? 0 : 4);
|
||||
} else if(cmdType == "Unknown") {
|
||||
write_basic_command(out, 7, get_int_from_json(srcPath, "pages", page, cmd, "value"));
|
||||
} else if(cmdType == "AddVerticalSpacing") {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include "build_menutext.h"
|
||||
|
||||
BuildMenuText::BuildMenuText(std::string srcPath, std::string dstPath) {
|
||||
int numberOfEntries = get_array_length_from_json(srcPath, "order");
|
||||
//int numberOfEntries = get_array_length_from_json(srcPath, "order");
|
||||
|
||||
std::vector<std::string> ids = get_array_from_section("ASSET_MENU_TEXT", "menu-text-build-ids");
|
||||
int numberOfEntries = ids.size();
|
||||
|
||||
std::vector<uint8_t> table(numberOfEntries * 4);
|
||||
std::vector<uint8_t> text;
|
||||
@@ -10,9 +13,10 @@ BuildMenuText::BuildMenuText(std::string srcPath, std::string dstPath) {
|
||||
|
||||
for(int i = 0; i < numberOfEntries; i++) {
|
||||
// Get the build id for this index.
|
||||
std::string buildId = get_string_from_json(srcPath, "order", i);
|
||||
// If the build ID string is empty (or null), then just write -1 to the table.
|
||||
if(buildId == "") {
|
||||
std::string buildId = ids[i];
|
||||
|
||||
// If the build ID is not in the sections, then just write -1 to the table.
|
||||
if(!json_has_key(srcPath, "sections", buildId)) {
|
||||
write_big_endian_word(table, i * 4, -1);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -105,13 +105,13 @@ void ExtractGameText::extract_textbox(json::JSON &out, std::vector<uint8_t> &dat
|
||||
case 4:
|
||||
cmd["command"] = "SetBorder";
|
||||
cmd["value"] = json::Object(); // 0 = Farthest left/top, 0xFF = Farthest right/bottom
|
||||
cmd["value"]["Left"] = data[offset++];
|
||||
cmd["value"]["Top"] = data[offset++];
|
||||
cmd["value"]["Right"] = data[offset++];
|
||||
cmd["value"]["Bottom"] = data[offset++];
|
||||
cmd["value"]["left"] = data[offset++];
|
||||
cmd["value"]["top"] = data[offset++];
|
||||
cmd["value"]["right"] = data[offset++];
|
||||
cmd["value"]["bottom"] = data[offset++];
|
||||
break;
|
||||
case 5:
|
||||
cmd["command"] = "SetColor";
|
||||
cmd["command"] = "SetColour";
|
||||
cmd["value"] = json::Object();
|
||||
cmd["value"]["red"] = data[offset++];
|
||||
cmd["value"]["green"] = data[offset++];
|
||||
@@ -120,7 +120,7 @@ void ExtractGameText::extract_textbox(json::JSON &out, std::vector<uint8_t> &dat
|
||||
break;
|
||||
case 6:
|
||||
cmd["command"] = "SetAlignment";
|
||||
cmd["value"] = (data[offset++] == 0) ? "Center" : "Left";
|
||||
cmd["value"] = (data[offset++] == 0) ? "center" : "left";
|
||||
break;
|
||||
case 7:
|
||||
cmd["command"] = "Unknown"; // Doesn't seem to do anything as far as I can tell.
|
||||
|
||||
@@ -10,14 +10,14 @@ ExtractMenuText::ExtractMenuText(std::string key, std::vector<uint8_t> data, std
|
||||
|
||||
uint32_t tableSize = stoi((*tags)["text-entry-count"]);
|
||||
|
||||
out["order"] = json::Array();
|
||||
//out["order"] = json::Array();
|
||||
out["sections"] = json::Object();
|
||||
|
||||
for(size_t i = 0; i < tableSize; i++) {
|
||||
uint32_t offset = get_big_endian_word(data, i*4);
|
||||
|
||||
if(offset == 0xFFFFFFFF) {
|
||||
out["order"].append(nullptr);
|
||||
//out["order"].append(nullptr);
|
||||
} else {
|
||||
std::string entry_key = (*tags)["text-entry-build-id_" + std::to_string(i)];
|
||||
if(out["sections"].hasKey(entry_key)) {
|
||||
@@ -26,7 +26,7 @@ ExtractMenuText::ExtractMenuText(std::string key, std::vector<uint8_t> data, std
|
||||
std::cout << err.str();
|
||||
throw 1;
|
||||
}
|
||||
out["order"].append(entry_key);
|
||||
//out["order"].append(entry_key);
|
||||
out["sections"][entry_key] = get_ascii(data, offset);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user