From 7d11c6e100e896bfac15f6a5db11d5c54fc01f73 Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Fri, 14 Apr 2023 02:09:12 +0100 Subject: [PATCH] fix jak 2 text encoding/decoding + minor decomp type fixes (#2476) Now all text in all non-Korean languages is built correctly. --- common/util/FontUtils.cpp | 691 +++++++--- common/util/FontUtils.h | 5 +- decompiler/config/jak2/all-types.gc | 6 +- .../config/jak2/ntsc_v1/var_names.jsonc | 20 + game/tools/subtitles/subtitle_editor.cpp | 11 +- goal_src/jak2/characters/ashelin/ash.gc | 2 +- goal_src/jak2/engine/ai/enemy-h.gc | 4 +- goal_src/jak2/engine/ai/enemy.gc | 31 +- goal_src/jak2/engine/ui/bigmap-h.gc | 2 +- goal_src/jak2/engine/ui/bigmap.gc | 4 +- .../jak2/levels/city/common/citizen-enemy.gc | 2 +- goal_src/jak2/levels/common/ai/bot.gc | 12 +- goal_src/jak2/levels/common/elec-gate.gc | 7 + .../enemy/baby_spider/tomb-baby-spider.gc | 4 +- .../common/enemy/metalhead_brown/metalmonk.gc | 71 +- goal_src/jak2/levels/temple/rhino.gc | 71 +- .../jak2/characters/ashelin/ash_REF.gc | 6 +- .../reference/jak2/engine/ai/enemy-h_REF.gc | 8 +- .../reference/jak2/engine/ai/enemy_REF.gc | 32 +- .../reference/jak2/engine/ui/bigmap-h_REF.gc | 6 +- .../reference/jak2/engine/ui/bigmap_REF.gc | 1123 +++++++++++++++++ .../reference/jak2/engine/ui/text_REF.gc | 16 +- .../levels/city/common/citizen-enemy_REF.gc | 6 +- .../jak2/levels/common/ai/bot_REF.gc | 16 +- .../enemy/baby_spider/tomb-baby-spider_REF.gc | 8 +- .../enemy/metalhead_brown/metalmonk_REF.gc | 8 +- .../reference/jak2/levels/temple/rhino_REF.gc | 24 +- test/offline/config/jak2/config.jsonc | 3 +- 28 files changed, 1906 insertions(+), 293 deletions(-) create mode 100644 test/decompiler/reference/jak2/engine/ui/bigmap_REF.gc diff --git a/common/util/FontUtils.cpp b/common/util/FontUtils.cpp index 03d832cf86..92c35bd514 100644 --- a/common/util/FontUtils.cpp +++ b/common/util/FontUtils.cpp @@ -56,7 +56,6 @@ GameTextFontBank::GameTextFontBank(GameTextVersion version, std::sort( m_replace_info->begin(), m_replace_info->end(), [](const ReplaceInfo& a, const ReplaceInfo& b) { return a.from.size() > b.from.size(); }); - (void)m_version; } /*! @@ -105,62 +104,170 @@ const EncodeInfo* GameTextFontBank::find_encode_to_game(const std::string& in, i return best_info; } +/*! + * Finds a remap info that best matches the byte sequence (is the longest match). + */ +const ReplaceInfo* GameTextFontBank::find_replace_to_utf8(const std::string& in, int off) const { + const ReplaceInfo* best_info = nullptr; + for (auto& info : *m_replace_info) { + if (info.from.empty() || in.size() - off < info.from.size()) + continue; + + bool found = true; + for (int i = 0; found && i < (int)info.from.size(); ++i) { + if (in.at(i + off) != info.from.at(i)) { + found = false; + } + } + + if (found && (!best_info || info.to.length() > best_info->to.length())) { + best_info = &info; + } + } + return best_info; +} + +/*! + * Finds a remap info that best matches the character sequence (is the longest match). + */ +const ReplaceInfo* GameTextFontBank::find_replace_to_game(const std::string& in, int off) const { + const ReplaceInfo* best_info = nullptr; + for (auto& info : *m_replace_info) { + if (info.to.length() == 0 || in.size() - off < info.to.size()) + continue; + + bool found = true; + for (int i = 0; found && i < (int)info.to.length(); ++i) { + if (in.at(i + off) != info.to.at(i)) { + found = false; + } + } + + if (found && (!best_info || info.to.length() > best_info->to.length())) { + best_info = &info; + } + } + return best_info; +} + /*! * Try to replace specific substrings with better variants. * These are for hiding confusing text transforms. */ std::string GameTextFontBank::replace_to_utf8(std::string& str) const { - for (auto& info : *m_replace_info) { - auto pos = str.find(info.from); - while (pos != std::string::npos) { - str.replace(pos, info.from.size(), info.to); - pos = str.find(info.from, pos + info.to.size()); + std::string newstr; + + for (int i = 0; i < (int)str.length();) { + auto remap = find_replace_to_utf8(str, i); + if (!remap) { + newstr.push_back(str.at(i)); + i += 1; + } else { + for (auto b : remap->to) { + newstr.push_back(b); + } + i += remap->from.length(); } } + + str = newstr; return str; } + std::string GameTextFontBank::replace_to_game(std::string& str) const { - for (auto& info : *m_replace_info) { - if (info.to.empty()) { - // Skip empty replacements, else it's an infinite loop - continue; - } - auto pos = str.find(info.to); - while (pos != std::string::npos) { - str.replace(pos, info.to.size(), info.from); - pos = str.find(info.to, pos + info.from.size()); + std::string newstr; + + for (int i = 0; i < (int)str.length();) { + auto remap = find_replace_to_game(str, i); + if (!remap) { + newstr.push_back(str.at(i)); + i += 1; + } else { + for (auto b : remap->from) { + newstr.push_back(b); + } + i += remap->to.length(); } } + + str = newstr; return str; } std::string GameTextFontBank::encode_utf8_to_game(std::string& str) const { - std::string new_str; + std::string newstr; for (int i = 0; i < (int)str.length();) { auto remap = find_encode_to_game(str, i); if (!remap) { - new_str.push_back(str.at(i)); + newstr.push_back(str.at(i)); i += 1; } else { for (auto b : remap->bytes) { - new_str.push_back(b); + newstr.push_back(b); } i += remap->chars.length(); } } - str = new_str; + str = newstr; return str; } /*! - * Turn a normal readable string into a string readable in the Jak 1 font encoding. + * Turn a normal readable string into a string readable in the in-game font encoding and converts + * \cXX escape sequences */ -std::string GameTextFontBank::convert_utf8_to_game(std::string str) const { - replace_to_game(str); - encode_utf8_to_game(str); - return str; +std::string GameTextFontBank::convert_utf8_to_game(std::string str, bool escape) const { + std::string newstr; + + if (escape) { + for (size_t i = 0; i < str.size(); ++i) { + auto c = str.at(i); + if (c == '"') { + newstr.push_back('"'); + i += 1; + } else if (c == '\\') { + if (i + 1 >= str.size()) { + throw std::runtime_error("incomplete string escape code"); + } + auto p = str.at(i + 1); + if (p == 'c') { + if (i + 3 >= str.size()) { + throw std::runtime_error("incomplete string escape code"); + } + auto first = str.at(i + 2); + auto second = str.at(i + 3); + if (!hex_char(first) || !hex_char(second)) { + throw std::runtime_error("invalid character escape hex number"); + } + char hex_num[3] = {first, second, '\0'}; + std::size_t end = 0; + auto value = std::stoul(hex_num, &end, 16); + if (end != 2) { + throw std::runtime_error("invalid character escape"); + } + ASSERT(value < 256); + newstr.push_back(char(value)); + i += 3; + } else if (p == '"' || p == '\\') { + newstr.push_back(p); + i += 1; + } else { + throw std::runtime_error( + fmt::format("unknown string escape code '{}' (0x{:x})", p, u32(p))); + } + } else { + newstr.push_back(c); + } + } + } else { + newstr = str; + } + + replace_to_game(newstr); + encode_utf8_to_game(newstr); + return newstr; } bool GameTextFontBank::valid_char_range(const char in) const { @@ -176,83 +283,48 @@ bool GameTextFontBank::valid_char_range(const char in) const { return false; } -/*! - * Turn a normal readable string into a string readable in the in-game font encoding and converts - * \cXX escape sequences - */ -std::string GameTextFontBank::convert_utf8_to_game_with_escape(const std::string& str) const { - std::string newstr; - - for (size_t i = 0; i < str.size(); ++i) { - auto c = str.at(i); - if (c == '"') { - newstr.push_back('"'); - i += 1; - } else if (c == '\\') { - if (i + 1 >= str.size()) { - throw std::runtime_error("incomplete string escape code"); - } - auto p = str.at(i + 1); - if (p == 'c') { - if (i + 3 >= str.size()) { - throw std::runtime_error("incomplete string escape code"); - } - auto first = str.at(i + 2); - auto second = str.at(i + 3); - if (!hex_char(first) || !hex_char(second)) { - throw std::runtime_error("invalid character escape hex number"); - } - char hex_num[3] = {first, second, '\0'}; - std::size_t end = 0; - auto value = std::stoul(hex_num, &end, 16); - if (end != 2) { - throw std::runtime_error("invalid character escape"); - } - ASSERT(value < 256); - newstr.push_back(char(value)); - i += 3; - } else if (p == '"') { - newstr.push_back(p); - i += 1; - } else { - throw std::runtime_error("unknown string escape code"); - } - } else { - newstr.push_back(c); - } - } - - replace_to_game(newstr); - encode_utf8_to_game(newstr); - return newstr; -} - /*! * Convert a string from the game-text font encoding to something normal. * Unprintable characters become escape sequences, including tab and newline. */ std::string GameTextFontBank::convert_game_to_utf8(const char* in) const { + std::string temp; std::string result; + std::string test = in; + if (test.find("America") != std::string::npos) { + printf(""); + } while (*in) { auto remap = find_encode_to_utf8(in); if (remap != nullptr) { - result.append(remap->chars); + temp.append(remap->chars); in += remap->bytes.size() - 1; - } else if (valid_char_range(*in)) { - result.push_back(*in); - } else if (*in == '\n') { - result += "\\n"; - } else if (*in == '\t') { - result += "\\t"; - } else if (*in == '\\') { - result += "\\\\"; - } else if (*in == '"') { - result += "\\\""; + } else if (valid_char_range(*in) || *in == '\n' || *in == '\t' || *in == '\\' || *in == '\"') { + temp.push_back(*in); } else { - result += fmt::format("\\c{:02x}", uint8_t(*in)); + temp += fmt::format("\\c{:02x}", uint8_t(*in)); } in++; } + replace_to_utf8(temp); + for (int i = 0; i < temp.length(); ++i) { + auto c = temp.at(i); + if (c == '\n') { + result += "\\n"; + } else if (c == '\t') { + result += "\\t"; + } else if (c == '\\') { + if (i < temp.length() - 1 && temp.at(i + 1) == 'c') { + result.push_back(c); + } else { + result += "\\\\"; + } + } else if (c == '"') { + result += "\\\""; + } else { + result.push_back(c); + } + } return replace_to_utf8(result); } @@ -848,13 +920,13 @@ GameTextFontBank g_font_bank_jak1_v2(GameTextVersion::JAK1_V2, static std::unordered_set s_passthrus_jak2 = {'~', ' ', ',', '.', '-', '+', '(', ')', '!', ':', '?', '=', '%', '*', '/', '#', - ';', '<', '>', '@', '[', '_'}; + ';', '<', '>', '@', '[', '_', ']'}; static std::vector s_replace_info_jak2 = { // other {"A~Y~-21H~-5Vº~Z", "Å"}, {"N~Y~-6Hº~Z~+10H", "Nº"}, - {"~+4VÇ~-4V", "ç"}, + {"~+4Vç~-4V", ",c"}, // tildes {"N~Y~-22H~-4V~Z", "Ñ"}, @@ -968,9 +1040,6 @@ static std::vector s_replace_info_jak2 = { {",~+8H", "、"}, {"~+8H ", " "}, - // (hack) special case kanji - {"~~", "世"}, - // playstation buttons // - face {"~Y~22L<~Z~Y~27L*~Z~Y~1L>~Z~Y~23L[~Z~+26H", ""}, @@ -978,47 +1047,73 @@ static std::vector s_replace_info_jak2 = { {"~Y~22L<~Z~Y~25L@~Z~Y~1L>~Z~Y~23L[~Z~+26H", ""}, {"~Y~22L<~Z~Y~24L#~Z~Y~1L>~Z~Y~23L[~Z~+26H", ""}, // - dpad - {"~Y~22L~Z~3L~+17H~-13V~Z~22L~+17H~+14V~Z~22L~+32H~Z~+56H", + {"~Y~22L~Z~3L~+17H~-13V~Z~22L~+17H~+14V~Z~" + "22L~+32H~Z~+56H", ""}, - {"~Y~22L~Z~3L~+17H~-13V~Z~3L~+17H~+14V~Z~22L~+32H~Z~+56H", + {"~Y~22L~Z~3L~+17H~-13V~Z~3L~+17H~+14V~Z~" + "22L~+32H~Z~+56H", ""}, - {"~Y~22L~Z~22L~+17H~-13V~Z~22L~+17H~+14V~Z~22L~+32H~Z~+56H", + {"~Y~22L~Z~22L~+17H~-13V~Z~22L~+17H~+14V~Z~" + "22L~+32H~Z~+56H", ""}, // - shoulder - {"~Y~22L~-2H~-12V~Z~22L~-2H~+17V~Z~1L~+4H~+3V~Z~+38H", + {"~Y~22L~-2H~-12V~Z~22L~-2H~+17V~Z~1L~+4H~+3V~Z~+" + "38H", ""}, - {"~Y~22L~-2H~-12V~Z~22L~-2H~+17V~Z~1L~+6H~+3V~Z~+38H", + {"~Y~22L~-2H~-12V~Z~22L~-2H~+17V~Z~1L~+6H~+3V~Z~+" + "38H", ""}, - {"~Y~22L~-2H~-6V~Z~22L~-2H~+16V~Z~1L~+5H~-2V~Z~+38H", + {"~Y~22L~-2H~-6V~Z~22L~-2H~+16V~Z~1L~+5H~-2V~Z~+" + "38H", ""}, - {"~Y~22L~-2H~-6V~Z~22L~-2H~+16V~Z~1L~+5H~-2V~Z~+38H", + {"~Y~22L~-2H~-6V~Z~22L~-2H~+16V~Z~1L~+5H~-2V~Z~+" + "38H", ""}, // - analog - {"~1L~+8H~Y~Z~6L~-16H~Z~+16h~6L~Z~6L~-15V~Z~+13V~6L~Z~-10H~+" - "9V~" - "6L~Z~+10H~+9V~6L~Z~-10H~-11V~6L~Z~+10H~-11V~6L~Z~+32H", + {"~1L~+8H~Y~Z~6L~-16H~Z~+16h~6L~Z~" + "6L~-15V~Z~+13V~6L~Z~-10H~+9V~6L~Z~+10H~+9V~6L~Z~-10H~-11V~6L~Z~+10H~" + "-11V~6L~Z~+32H", ""}, - {"~Y~1L~+8H~Z~6L~-8H~Z~+24H~6L~Z~+40H", ""}, - {"~Y~1L~Z~6L~-15V~Z~+13V~6L~Z~+26H", ""}, + {"~Y~1L~+8H~Z~6L~-8H~Z~+24H~6L~Z~+" + "40H", + ""}, + {"~Y~1L~Z~6L~-15V~Z~+13V~6L~Z~+26H", + ""}, // icons {"~Y~6L<~Z~Y~1L>~Z~Y~23L[~Z~+26H", ""}, {"~Y~3L<~Z~Y~1L>~Z~Y~23L[~Z~+26H", ""}, // flags - {"~Y~6L~Z~+15H~1L~Z~+30H~3L~Z~+45H", ""}, - {"~Y~5L~Z~3L~~-1H~Y~5L~Z~3L~Z~+26H", ""}, - {"~Y~39L~~~Z~3L~Z~5L~~-1H~Y~39L~~~Z~3L~Z~5L~Z~+26H", + {"~Y~6L~Z~+15H~1L~Z~+30H~3L~Z~+45H", + ""}, + {"~Y~5L~Z~3L~]~-1H~Y~5L~Z~3L~Z~+26H", + ""}, + {"~Y~39L~~~Z~3L~Z~5L~]~-1H~Y~39L~~~Z~" + "3L~Z~5L~Z~+26H", ""}, - {"~Y~7L~Z~+15H~1L~Z~+30H~3L~Z~+47H", ""}, - {"~Y~1L~Z~3L~Z~7L~~-1H~Y~1L~Z~3L~Z~7L~Z~+26H", - ""}, - {"~Y~1L~Z~3L~Z~7L~~-1H~Y~1L~Z~3L~Z~+26H", + {"~Y~7L~Z~+15H~1L~Z~+30H~3L~Z~+47H", + ""}, + {"~Y~1L~Z~3L~Z~7L~]~-1H~Y~1L<" + "FLAG_PART_FILL>~Z~3L~Z~7L~Z~+26H", ""}, - {"~Y~1L~Z~39L~~-1H~Y~1L~Z~39L~Z~-11H~7L~Z~-11H~3L<" - "SYM43>~Z~+26H", + {"~Y~1L~Z~3L~Z~7L~]~-" + "1H~Y~1L~Z~3L~Z~+26H", + ""}, + {"~Y~1L~Z~39L~]~-1H~Y~1L~Z~39L<" + "FLAG_PART_KOREA_TRIGRAMS_RIGHT>~Z~-11H~7L~Z~-11H~3L<" + "FLAG_PART_KOREA_CIRCLE_TOP>~Z~+26H", ""}, - {"~Y~1L~~-1H~Y~1L~Z~-11H~3L~Z~+26H", ""}, + {"~Y~1L~]~-1H~Y~1L~Z~-11H~3L~Z~+26H", + ""}, // weird stuff // - descenders @@ -1028,10 +1123,11 @@ static std::vector s_replace_info_jak2 = { {"~+7Vq~-7V", "q"}, {"~+1Vj~-1V", "j"}, - {"\\\\\\\\", "\\n"}, // wtf happened here!? + {"\\\\", + "~%"}, // this is 2 slashes, duplicated because we use an escape sequence when decompiling // - symbols and ligatures - {"~-4H~-3V\\c19~+3V~-4H", + {"~-4H~-3V~+3V~-4H", ""}, // used for the 4<__> place in spanish. the 5th uses the same // character but looks different...? {"~Y~-6Hº~Z~+10H", "°"}, @@ -1041,7 +1137,6 @@ static std::vector s_replace_info_jak2 = { {"~[~32L", ""}}; static std::vector s_encode_info_jak2 = { - {"_", {0x03}}, // large space {"ˇ", {0x10}}, // caron {"`", {0x11}}, // grave accent {"'", {0x12}}, // apostrophe @@ -1051,59 +1146,64 @@ static std::vector s_encode_info_jak2 = { {"º", {0x16}}, // numero/overring {"¡", {0x17}}, // inverted exclamation mark {"¿", {0x18}}, // inverted question mark - {"ç", {0x1d}}, // c-cedilla - {"Ç", {0x1e}}, // c-cedilla - {"ß", {0x1f}}, // eszett + {"", {0x19}}, + {"ç", {0x1d}}, // c-cedilla + {"Ç", {0x1e}}, // c-cedilla + {"ß", {0x1f}}, // eszett {"œ", {0x5e}}, // ligature o+e - // Re-purposed japanese/korean symbols that are used as part of drawing icons/flags/pad buttons - // TODO - japanese and korean encodings - {"", {0x5d}}, - {"", {0x7f}}, - {"", {0x80}}, - {"", {0x81}}, + {"", {0x7f}}, + {"", {0x80}}, + {"", {0x81}}, + {"", {0x82}}, + {"", {0x83}}, + {"", {0x84}}, + {"", {0x85}}, + {"", {0x86}}, + {"", {0x87}}, + {"", {0x88}}, + {"", {0x89}}, + {"", {0x8a}}, + {"", {0x8b}}, + {"", {0x8c}}, + {"", {0x8d}}, + {"", {0x8e}}, + {"", {0x8f}}, + {"", {0x90}}, + {"", {0x91}}, + {"", {0x92}}, + {"", {0x93}}, + {"", {0x94}}, + {"", {0x95}}, + {"", {0x96}}, + {"", {0x97}}, + {"", {0x98}}, + {"", {0x99}}, + {"", {0x9a}}, + {"", {0x9b}}, + {"", {0x9c}}, + {"", {0x9d}}, + {"", {0x9e}}, + {"", {0x9f}}, + {"", {0xa0}}, + {"", {0xa1}}, + {"", {0xa2}}, + {"", {0xa3}}, + {"", {0xa4}}, + {"", {0xa5}}, + {"", {0xa6}}, + {"", {0xa7}}, + {"", {0xa8}}, + {"", {0xa9}}, + {"", {0xaa}}, + {"", {0xab}}, + {"", {0xac}}, - {"", {0x85}}, - {"", {0x86}}, - {"", {0x87}}, - {"", {0x88}}, - {"", {0x89}}, - {"", {0x8a}}, - {"", {0x8b}}, - {"", {0x8c}}, - {"", {0x8d}}, - {"", {0x8e}}, - {"", {0x8f}}, - {"", {0x90}}, - {"", {0x91}}, - - {"", {0x94}}, - {"", {0x95}}, - {"", {0x96}}, - {"", {0x97}}, - {"", {0x98}}, - {"", {0x99}}, - {"", {0x9a}}, - {"", {0x9b}}, - {"", {0x9c}}, - {"", {0x9d}}, - {"", {0x9e}}, - {"", {0x9f}}, - {"", {0xa0}}, - {"", {0xa1}}, - {"", {0xa2}}, - {"", {0xa3}}, - {"", {0xa4}}, - {"", {0xa5}}, - {"", {0xa6}}, - {"", {0xa7}}, - {"", {0xa8}}, - {"", {0xa9}}, - {"", {0xb0}}, - {"", {0xb1}}, - {"", {0xb3}}, - {"", {0xb2}}, + {"", {0xb0}}, + {"", {0xb1}}, + {"", {0xb2}}, + {"", {0xb3}}, // {"入", {1, 0x00}}, // {"年", {1, 0x01}}, // punctuation @@ -1459,7 +1559,7 @@ static std::vector s_encode_info_jak2 = { {"予", {2, 0x83}}, {"用", {2, 0x84}}, {"落", {2, 0x85}}, - // {"録", {2, 0x86}}, + {"緑", {2, 0x86}}, {"封", {2, 0x88}}, {"印", {2, 0x89}}, @@ -1467,6 +1567,263 @@ static std::vector s_encode_info_jak2 = { {"最", {2, 0x8b}}, {"刻", {2, 0x8c}}, {"足", {2, 0x8d}}, + + {"", {3, 0x00}}, + {"", {3, 0x01}}, + {"", {3, 0x02}}, + {"", {3, 0x03}}, + {"", {3, 0x04}}, + {"", {3, 0x05}}, + {"", {3, 0x06}}, + {"", {3, 0x07}}, + {"", {3, 0x08}}, + {"", {3, 0x09}}, + {"", {3, 0x0a}}, + {"", {3, 0x0b}}, + {"", {3, 0x0c}}, + {"", {3, 0x0d}}, + {"", {3, 0x0e}}, + {"", {3, 0x0f}}, + {"", {3, 0x10}}, + {"", {3, 0x11}}, + {"", {3, 0x12}}, + {"", {3, 0x13}}, + {"", {3, 0x14}}, + {"", {3, 0x15}}, + {"", {3, 0x16}}, + {"", {3, 0x17}}, + {"", {3, 0x18}}, + {"", {3, 0x19}}, + {"", {3, 0x1a}}, + {"", {3, 0x1b}}, + {"", {3, 0x1c}}, + {"", {3, 0x1d}}, + {"", {3, 0x1e}}, + {"", {3, 0x1f}}, + {"", {3, 0x20}}, + {"", {3, 0x21}}, + {"", {3, 0x22}}, + {"", {3, 0x23}}, + {"", {3, 0x24}}, + {"", {3, 0x25}}, + {"", {3, 0x26}}, + {"", {3, 0x27}}, + {"", {3, 0x28}}, + {"", {3, 0x29}}, + {"", {3, 0x2a}}, + {"", {3, 0x2b}}, + {"", {3, 0x2c}}, + {"", {3, 0x2d}}, + {"", {3, 0x2e}}, + {"", {3, 0x2f}}, + {"", {3, 0x30}}, + {"", {3, 0x31}}, + {"", {3, 0x32}}, + {"", {3, 0x33}}, + {"", {3, 0x34}}, + {"", {3, 0x35}}, + {"", {3, 0x36}}, + {"", {3, 0x37}}, + {"", {3, 0x38}}, + {"", {3, 0x39}}, + {"", {3, 0x3a}}, + {"", {3, 0x3b}}, + {"", {3, 0x3c}}, + {"", {3, 0x3d}}, + {"", {3, 0x3e}}, + {"", {3, 0x3f}}, + {"", {3, 0x40}}, + {"", {3, 0x41}}, + {"", {3, 0x42}}, + {"", {3, 0x43}}, + {"", {3, 0x44}}, + {"", {3, 0x45}}, + {"", {3, 0x46}}, + {"", {3, 0x47}}, + {"", {3, 0x48}}, + {"", {3, 0x49}}, + {"", {3, 0x4a}}, + {"", {3, 0x4b}}, + {"", {3, 0x4c}}, + {"", {3, 0x4d}}, + {"", {3, 0x4e}}, + {"", {3, 0x4f}}, + {"", {3, 0x50}}, + {"", {3, 0x51}}, + {"", {3, 0x52}}, + {"", {3, 0x53}}, + {"", {3, 0x54}}, + {"", {3, 0x55}}, + {"", {3, 0x56}}, + {"", {3, 0x57}}, + {"", {3, 0x58}}, + {"", {3, 0x59}}, + {"", {3, 0x5a}}, + {"", {3, 0x5b}}, + {"", {3, 0x5c}}, + {"", {3, 0x5d}}, + {"", {3, 0x5e}}, + {"", {3, 0x5f}}, + {"", {3, 0x60}}, + {"", {3, 0x61}}, + {"", {3, 0x62}}, + {"", {3, 0x63}}, + {"", {3, 0x64}}, + {"", {3, 0x65}}, + {"", {3, 0x66}}, + {"", {3, 0x67}}, + {"", {3, 0x68}}, + {"", {3, 0x69}}, + {"", {3, 0x6a}}, + {"", {3, 0x6b}}, + {"", {3, 0x6c}}, + {"", {3, 0x6d}}, + {"", {3, 0x6e}}, + {"", {3, 0x6f}}, + {"", {3, 0x70}}, + {"", {3, 0x71}}, + {"", {3, 0x72}}, + {"", {3, 0x73}}, + {"", {3, 0x74}}, + {"", {3, 0x75}}, + {"", {3, 0x76}}, + {"", {3, 0x77}}, + {"", {3, 0x78}}, + {"", {3, 0x79}}, + {"", {3, 0x7a}}, + {"", {3, 0x7b}}, + {"", {3, 0x7c}}, + {"", {3, 0x7d}}, + {"", {3, 0x7e}}, + {"", {3, 0x7f}}, + {"", {3, 0x80}}, + {"", {3, 0x81}}, + {"", {3, 0x82}}, + {"", {3, 0x83}}, + {"", {3, 0x84}}, + {"", {3, 0x85}}, + {"", {3, 0x86}}, + {"", {3, 0x87}}, + {"", {3, 0x88}}, + {"", {3, 0x89}}, + {"", {3, 0x8a}}, + {"", {3, 0x8b}}, + {"", {3, 0x8c}}, + {"", {3, 0x8d}}, + {"", {3, 0x8e}}, + {"", {3, 0x8f}}, + {"", {3, 0x90}}, + {"", {3, 0x91}}, + {"", {3, 0x92}}, + {"", {3, 0x93}}, + {"", {3, 0x94}}, + {"", {3, 0x95}}, + {"", {3, 0x96}}, + {"", {3, 0x97}}, + {"", {3, 0x98}}, + {"", {3, 0x99}}, + {"", {3, 0x9a}}, + {"", {3, 0x9b}}, + {"", {3, 0x9c}}, + {"", {3, 0x9d}}, + {"", {3, 0x9e}}, + {"", {3, 0x9f}}, + {"", {3, 0xa0}}, + {"", {3, 0xa1}}, + {"", {3, 0xa2}}, + {"", {3, 0xa3}}, + {"", {3, 0xa4}}, + {"", {3, 0xa5}}, + {"", {3, 0xa6}}, + {"", {3, 0xa7}}, + {"", {3, 0xa8}}, + {"", {3, 0xa9}}, + {"", {3, 0xaa}}, + {"", {3, 0xab}}, + {"", {3, 0xac}}, + {"", {3, 0xad}}, + {"", {3, 0xae}}, + {"", {3, 0xaf}}, + {"", {3, 0xb0}}, + {"", {3, 0xb1}}, + {"", {3, 0xb2}}, + {"", {3, 0xb3}}, + {"", {3, 0xb4}}, + {"", {3, 0xb5}}, + {"", {3, 0xb6}}, + {"", {3, 0xb7}}, + {"", {3, 0xb8}}, + {"", {3, 0xb9}}, + {"", {3, 0xba}}, + {"", {3, 0xbb}}, + {"", {3, 0xbc}}, + {"", {3, 0xbd}}, + {"", {3, 0xbe}}, + {"", {3, 0xbf}}, + {"", {3, 0xc0}}, + {"", {3, 0xc1}}, + {"", {3, 0xc2}}, + {"", {3, 0xc3}}, + {"", {3, 0xc4}}, + {"", {3, 0xc5}}, + {"", {3, 0xc6}}, + {"", {3, 0xc7}}, + {"", {3, 0xc8}}, + {"", {3, 0xc9}}, + {"", {3, 0xca}}, + {"", {3, 0xcb}}, + {"", {3, 0xcc}}, + {"", {3, 0xcd}}, + {"", {3, 0xce}}, + {"", {3, 0xcf}}, + {"", {3, 0xd0}}, + {"", {3, 0xd1}}, + {"", {3, 0xd2}}, + {"", {3, 0xd3}}, + {"", {3, 0xd4}}, + {"", {3, 0xd5}}, + {"", {3, 0xd6}}, + {"", {3, 0xd7}}, + {"", {3, 0xd8}}, + {"", {3, 0xd9}}, + {"", {3, 0xda}}, + {"", {3, 0xdb}}, + {"", {3, 0xdc}}, + {"", {3, 0xdd}}, + {"", {3, 0xde}}, + {"", {3, 0xdf}}, + {"", {3, 0xe0}}, + {"", {3, 0xe1}}, + {"", {3, 0xe2}}, + {"", {3, 0xe3}}, + {"", {3, 0xe4}}, + {"", {3, 0xe5}}, + {"", {3, 0xe6}}, + {"", {3, 0xe7}}, + {"", {3, 0xe8}}, + {"", {3, 0xe9}}, + {"", {3, 0xea}}, + {"", {3, 0xeb}}, + {"", {3, 0xec}}, + {"", {3, 0xed}}, + {"", {3, 0xee}}, + {"", {3, 0xef}}, + {"", {3, 0xf0}}, + {"", {3, 0xf1}}, + {"", {3, 0xf2}}, + {"", {3, 0xf3}}, + {"", {3, 0xf4}}, + {"", {3, 0xf5}}, + {"", {3, 0xf6}}, + {"", {3, 0xf7}}, + {"", {3, 0xf8}}, + {"", {3, 0xf9}}, + {"", {3, 0xfa}}, + {"", {3, 0xfb}}, + {"", {3, 0xfc}}, + {"", {3, 0xfd}}, + {"", {3, 0xfe}}, + {"", {3, 0xff}}, }; GameTextFontBank g_font_bank_jak2(GameTextVersion::JAK2, diff --git a/common/util/FontUtils.h b/common/util/FontUtils.h index 3d167fc150..6a4b594d83 100644 --- a/common/util/FontUtils.h +++ b/common/util/FontUtils.h @@ -58,6 +58,8 @@ class GameTextFontBank { const EncodeInfo* find_encode_to_utf8(const char* in) const; const EncodeInfo* find_encode_to_game(const std::string& in, int off = 0) const; + const ReplaceInfo* find_replace_to_utf8(const std::string& in, int off = 0) const; + const ReplaceInfo* find_replace_to_game(const std::string& in, int off = 0) const; std::string replace_to_utf8(std::string& str) const; std::string replace_to_game(std::string& str) const; @@ -79,8 +81,7 @@ class GameTextFontBank { // hacking it for now bool valid_char_range(const char in) const; - std::string convert_utf8_to_game_with_escape(const std::string& str) const; - std::string convert_utf8_to_game(std::string str) const; + std::string convert_utf8_to_game(std::string str, bool escape = false) const; std::string convert_game_to_utf8(const char* in) const; }; diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 392f46d708..23bfcdea1f 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -7612,7 +7612,7 @@ (bigmap-index uint32 :offset-assert 20) (bigmap-image external-art-buffer :offset-assert 24) (tpage external-art-buffer :offset-assert 28) - (progress-minimap symbol :offset-assert 32) + (progress-minimap texture-page :offset-assert 32) (mask-index uint32 :offset-assert 36) (bit-mask bigmap-bit-mask :offset-assert 40) (compressed-next-index uint32 :offset-assert 44) @@ -32921,7 +32921,7 @@ "Handles various events for the enemy @TODO - unsure if there is a pattern for the events and this should have a more specific name" (_type_ process int symbol event-message-block) object 74) - (enemy-method-75 (_type_ process touching-shapes-entry) object 75) + (enemy-method-75 (_type_ process event-message-block) object 75) (enemy-method-76 (_type_ process event-message-block) symbol 76) (enemy-method-77 (_type_ (pointer float)) symbol 77) (enemy-method-78 (_type_ (pointer float)) symbol 78) @@ -32959,7 +32959,7 @@ (enemy-method-101 (_type_) none 101) (enemy-method-102 (_type_) symbol 102) (enemy-method-103 (_type_) collide-spec 103) - (enemy-method-104 (_type_ process uint uint) symbol :behavior process 104) + (enemy-method-104 (_type_ process touching-shapes-entry uint) symbol :behavior process 104) (enemy-method-105 (_type_ process) enemy-flag 105) (enemy-method-106 (_type_ process object int attack-info) none :behavior enemy 106) (get-enemy-target diff --git a/decompiler/config/jak2/ntsc_v1/var_names.jsonc b/decompiler/config/jak2/ntsc_v1/var_names.jsonc index b0c3e05946..feda46b9fe 100644 --- a/decompiler/config/jak2/ntsc_v1/var_names.jsonc +++ b/decompiler/config/jak2/ntsc_v1/var_names.jsonc @@ -4192,5 +4192,25 @@ "v1-123": ["v1-123", "vector4w"], "a0-62": ["a0-62", "vector4w"] } + }, + "(method 75 rhino)": { + "vars": { + "s5-0": ["touch-entry", "touching-shapes-entry"] + } + }, + "(method 75 enemy)": { + "vars": { + "s4-0": ["touch-entry", "touching-shapes-entry"] + } + }, + "(method 76 bot)": { + "vars": { + "s3-0": "touch-entry" + } + }, + "convert-korean-text": { + "vars": { + "gp-0": "charp" + } } } diff --git a/game/tools/subtitles/subtitle_editor.cpp b/game/tools/subtitles/subtitle_editor.cpp index a0a4bc1cae..df955bb90d 100644 --- a/game/tools/subtitles/subtitle_editor.cpp +++ b/game/tools/subtitles/subtitle_editor.cpp @@ -645,8 +645,8 @@ void SubtitleEditor::draw_subtitle_options(GameSubtitleSceneInfo& scene, bool cu } else if (linetext.empty() || subtitleLine.offscreen) { ImGui::PopStyleColor(); } - auto newtext = font->convert_utf8_to_game_with_escape(linetext); - auto newspkr = font->convert_utf8_to_game_with_escape(linespkr); + auto newtext = font->convert_utf8_to_game(linetext, true); + auto newspkr = font->convert_utf8_to_game(linespkr, true); subtitleLine.line = newtext; subtitleLine.speaker = newspkr; } @@ -669,10 +669,9 @@ void SubtitleEditor::draw_new_cutscene_line_form() { if (ImGui::Button("Add Text Entry")) { auto font = get_font_bank( parse_text_only_version(m_subtitle_db.m_banks[m_current_language]->file_path)); - m_current_scene->add_line(m_current_scene_frame, - font->convert_utf8_to_game_with_escape(m_current_scene_text), - font->convert_utf8_to_game_with_escape(m_current_scene_speaker), - m_current_scene_offscreen); + m_current_scene->add_line( + m_current_scene_frame, font->convert_utf8_to_game(m_current_scene_text, true), + font->convert_utf8_to_game(m_current_scene_speaker, true), m_current_scene_offscreen); } } if (m_current_scene_frame < 0) { diff --git a/goal_src/jak2/characters/ashelin/ash.gc b/goal_src/jak2/characters/ashelin/ash.gc index c6c26ff828..5c745266b4 100644 --- a/goal_src/jak2/characters/ashelin/ash.gc +++ b/goal_src/jak2/characters/ashelin/ash.gc @@ -256,7 +256,7 @@ (none) ) -(defmethod enemy-method-104 ashelin ((obj ashelin) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 ashelin ((obj ashelin) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (if (and (= (-> arg0 type) target) (-> obj next-state) (let ((v1-4 (-> obj next-state name))) diff --git a/goal_src/jak2/engine/ai/enemy-h.gc b/goal_src/jak2/engine/ai/enemy-h.gc index 06e9253961..e835a7c00e 100644 --- a/goal_src/jak2/engine/ai/enemy-h.gc +++ b/goal_src/jak2/engine/ai/enemy-h.gc @@ -355,7 +355,7 @@ (react-to-focus (_type_) none 72) (kill-prefer-falling (_type_) object 73) (general-event-handler (_type_ process int symbol event-message-block) object 74) - (enemy-method-75 (_type_ process touching-shapes-entry) object 75) + (enemy-method-75 (_type_ process event-message-block) object 75) (enemy-method-76 (_type_ process event-message-block) symbol 76) (enemy-method-77 (_type_ (pointer float)) symbol 77) (enemy-method-78 (_type_ (pointer float)) symbol 78) @@ -384,7 +384,7 @@ (enemy-method-101 (_type_) none 101) (enemy-method-102 (_type_) symbol 102) (enemy-method-103 (_type_) collide-spec 103) - (enemy-method-104 (_type_ process uint uint) symbol :behavior process 104) + (enemy-method-104 (_type_ process touching-shapes-entry uint) symbol :behavior process 104) (enemy-method-105 (_type_ process) enemy-flag 105) (enemy-method-106 (_type_ process object int attack-info) none :behavior enemy 106) (get-enemy-target (_type_) process-focusable 107) diff --git a/goal_src/jak2/engine/ai/enemy.gc b/goal_src/jak2/engine/ai/enemy.gc index 782f0da92e..e473f008cf 100644 --- a/goal_src/jak2/engine/ai/enemy.gc +++ b/goal_src/jak2/engine/ai/enemy.gc @@ -456,7 +456,7 @@ (a3-1 (+ (-> v1-13 attack-id) 1)) ) (set! (-> v1-13 attack-id) a3-1) - (if (t9-2 a0-5 a1-3 (the-as uint a2-3) a3-1) + (if (t9-2 a0-5 a1-3 a2-3 a3-1) (return 0) ) ) @@ -633,7 +633,7 @@ ) ) -(defmethod enemy-method-104 enemy ((obj enemy) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 enemy ((obj enemy) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (let ((v1-1 (-> obj enemy-info attack-damage))) (if (and (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) (= v1-1 1)) (set! v1-1 2) @@ -642,7 +642,7 @@ (set! (-> a1-2 from) (process->ppointer self)) (set! (-> a1-2 num-params) 2) (set! (-> a1-2 message) 'attack) - (set! (-> a1-2 param 0) arg1) + (set! (-> a1-2 param 0) (the-as uint arg1)) (let ((a0-10 (new 'static 'attack-info :mask (attack-info-mask mode shove-back shove-up id damage knock)))) (set! (-> a0-10 id) arg2) (set! (-> a0-10 shove-back) (-> obj enemy-info attack-shove-back)) @@ -1621,9 +1621,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch none vs object. ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 17] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 28] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 37] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 89] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 105] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 202] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 211] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 274] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 346] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 407] @@ -1658,7 +1660,7 @@ This commonly includes things such as: (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) ) ((= arg2 'touch) - (enemy-method-75 obj arg0 (the-as touching-shapes-entry arg3)) + (enemy-method-75 obj arg0 arg3) ) ((= arg2 'touched) (when (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) @@ -1753,7 +1755,7 @@ This commonly includes things such as: ) (else (set! (-> obj incoming attack-id) (-> (the-as attack-info s2-0) id)) - (enemy-method-75 obj arg0 (the-as touching-shapes-entry arg3)) + (enemy-method-75 obj arg0 arg3) ) ) ) @@ -2050,28 +2052,27 @@ This commonly includes things such as: (find-offending-process-focusable arg0 arg1) ) -;; WARN: Return type mismatch object vs none. -(defmethod enemy-method-75 enemy ((obj enemy) (arg0 process) (arg1 touching-shapes-entry)) - (let* ((s4-0 (-> arg1 handle1)) +(defmethod enemy-method-75 enemy ((obj enemy) (arg0 process) (arg1 event-message-block)) + (let* ((touch-entry (the-as touching-shapes-entry (-> arg1 param 0))) (s2-0 arg0) (s3-0 (if (type? s2-0 process-focusable) (the-as process-focusable s2-0) ) ) ) - (when (and s4-0 s3-0) + (when (and (the-as uint touch-entry) s3-0) (cond ((and (focus-test? obj dangerous) (and s3-0 (not (logtest? (-> s3-0 focus-status) (focus-status disable dead ignore grabbed)))) ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s4-0) + touch-entry (-> obj root-override2) (collide-action deadly) (collide-action) ) ) (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s4-0) + touch-entry (-> obj root-override2) (collide-action persistent-attack) (collide-action) @@ -2081,18 +2082,18 @@ This commonly includes things such as: ) ) ) - (enemy-method-104 obj arg0 (the-as uint s4-0) a3-2) + (enemy-method-104 obj arg0 touch-entry a3-2) ) ) ((and ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s4-0) + touch-entry (-> obj root-override2) (collide-action no-standon) (collide-action) ) (not (logtest? (-> obj root-override2 penetrated-by) (-> s3-0 root-override penetrate-using))) ) - (if (send-shoves (-> obj root-override2) arg0 (the-as touching-shapes-entry s4-0) 0.7 6144.0 16384.0) + (if (send-shoves (-> obj root-override2) arg0 touch-entry 0.7 6144.0 16384.0) (send-event obj 'bouncing-off arg0) ) ) @@ -2128,7 +2129,7 @@ This commonly includes things such as: ) ) ) - (enemy-method-104 obj arg0 s4-0 a3-2) + (enemy-method-104 obj arg0 (the-as touching-shapes-entry s4-0) a3-2) ) ) ) diff --git a/goal_src/jak2/engine/ui/bigmap-h.gc b/goal_src/jak2/engine/ui/bigmap-h.gc index cc503edd9e..2a28450ac5 100644 --- a/goal_src/jak2/engine/ui/bigmap-h.gc +++ b/goal_src/jak2/engine/ui/bigmap-h.gc @@ -99,7 +99,7 @@ (bigmap-index uint32 :offset-assert 20) (bigmap-image external-art-buffer :offset-assert 24) (tpage external-art-buffer :offset-assert 28) - (progress-minimap symbol :offset-assert 32) + (progress-minimap texture-page :offset-assert 32) (mask-index uint32 :offset-assert 36) (bit-mask bigmap-bit-mask :offset-assert 40) (compressed-next-index uint32 :offset-assert 44) diff --git a/goal_src/jak2/engine/ui/bigmap.gc b/goal_src/jak2/engine/ui/bigmap.gc index ec28ee4f95..dd9fc23bcc 100644 --- a/goal_src/jak2/engine/ui/bigmap.gc +++ b/goal_src/jak2/engine/ui/bigmap.gc @@ -677,7 +677,7 @@ (set! (-> *texture-relocate-later* memcpy) #f) (set! (-> obj progress-minimap) (the-as - symbol + texture-page (link (-> obj tpage buf) (-> obj tpage load-file data) (-> obj tpage len) (-> obj tpage heap) 4) ) ) @@ -1026,7 +1026,7 @@ ) ) (when (-> obj progress-minimap) - (unload-page *texture-pool* (the-as texture-page (-> obj progress-minimap))) + (unload-page *texture-pool* (-> obj progress-minimap)) (set! (-> *level* default-level texture-page 3) (the-as texture-page 0)) (set! (-> obj progress-minimap) #f) ) diff --git a/goal_src/jak2/levels/city/common/citizen-enemy.gc b/goal_src/jak2/levels/city/common/citizen-enemy.gc index 515b368c10..021af582b4 100644 --- a/goal_src/jak2/levels/city/common/citizen-enemy.gc +++ b/goal_src/jak2/levels/city/common/citizen-enemy.gc @@ -93,7 +93,7 @@ ) ) ) - (enemy-method-104 obj arg0 s3-0 a3-2) + (enemy-method-104 obj arg0 (the-as touching-shapes-entry s3-0) a3-2) ) ) (else diff --git a/goal_src/jak2/levels/common/ai/bot.gc b/goal_src/jak2/levels/common/ai/bot.gc index 0e6f42b28e..031bfefb34 100644 --- a/goal_src/jak2/levels/common/ai/bot.gc +++ b/goal_src/jak2/levels/common/ai/bot.gc @@ -944,7 +944,7 @@ ) ) -(defmethod enemy-method-104 bot ((obj bot) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 bot ((obj bot) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (cond ((and (= (-> arg0 type) target) (not (logtest? (-> obj bot-flags) (bot-flags attacked)))) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) @@ -975,7 +975,7 @@ (set! (-> a1-2 from) (process->ppointer self)) (set! (-> a1-2 num-params) 2) (set! (-> a1-2 message) 'attack) - (set! (-> a1-2 param 0) arg1) + (set! (-> a1-2 param 0) (the-as uint arg1)) (let ((v1-14 (new 'static 'attack-info :mask (attack-info-mask mode shove-back shove-up id)))) (set! (-> v1-14 id) arg2) (set! (-> v1-14 shove-back) (-> obj enemy-info-override attack-shove-back)) @@ -1005,7 +1005,7 @@ ) (else (when (!= (-> arg0 type) target) - (let* ((s3-0 (-> arg1 param 0)) + (let* ((touch-entry (-> arg1 param 0)) (s2-0 arg0) (v1-6 (if (type? s2-0 process-focusable) s2-0 @@ -1019,14 +1019,14 @@ (not (logtest? (-> (the-as process-focusable v1-6) focus-status) (focus-status disable dead ignore grabbed))) ) ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s3-0) + (the-as touching-shapes-entry touch-entry) (-> obj root-override2) (collide-action deadly) (collide-action) ) ) (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s3-0) + (the-as touching-shapes-entry touch-entry) (-> obj root-override2) (collide-action persistent-attack) (collide-action) @@ -1036,7 +1036,7 @@ ) ) ) - (enemy-method-104 obj arg0 s3-0 a3-2) + (enemy-method-104 obj arg0 (the-as touching-shapes-entry touch-entry) a3-2) ) ) (else diff --git a/goal_src/jak2/levels/common/elec-gate.gc b/goal_src/jak2/levels/common/elec-gate.gc index 03de865dbd..86998db490 100644 --- a/goal_src/jak2/levels/common/elec-gate.gc +++ b/goal_src/jak2/levels/common/elec-gate.gc @@ -968,6 +968,13 @@ This commonly includes things such as: (none) ) + +(defmethod set-elec-scale! caspad-elec-gate ((obj caspad-elec-gate) (arg0 float)) + "Added, original game did not define this and would crash on call." + 0 + (none) + ) + (define *caspad-elec-gate-params* (new 'static 'elec-gate-params :bolt-spec (new 'static 'lightning-spec :name #f diff --git a/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc b/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc index 79bbef8447..c2f6edc869 100644 --- a/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc +++ b/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc @@ -658,7 +658,7 @@ ) ) -(defmethod enemy-method-104 tomb-baby-spider ((obj tomb-baby-spider) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 tomb-baby-spider ((obj tomb-baby-spider) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (let* ((s1-0 arg0) (s2-0 (if (type? s1-0 process-focusable) s1-0 @@ -678,7 +678,7 @@ (set! (-> a1-5 from) (process->ppointer self)) (set! (-> a1-5 num-params) 2) (set! (-> a1-5 message) 'attack) - (set! (-> a1-5 param 0) arg1) + (set! (-> a1-5 param 0) (the-as uint arg1)) (let ((v1-9 (new 'static 'attack-info :mask (attack-info-mask mode shove-back shove-up id damage knock)))) (set! (-> v1-9 id) arg2) (set! (-> v1-9 shove-back) (* f0-0 (-> obj enemy-info-override attack-shove-back))) diff --git a/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc b/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc index 6803a1a367..1fd3217553 100644 --- a/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc +++ b/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc @@ -114,7 +114,72 @@ :default-hit-points 4 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -380,7 +445,7 @@ ) ) -(defmethod enemy-method-104 metalmonk ((obj metalmonk) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 metalmonk ((obj metalmonk) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (let* ((s3-0 arg0) (a0-2 (if (type? s3-0 process-focusable) s3-0 @@ -414,7 +479,7 @@ (set! (-> a1-10 from) (process->ppointer self)) (set! (-> a1-10 num-params) 2) (set! (-> a1-10 message) 'attack) - (set! (-> a1-10 param 0) arg1) + (set! (-> a1-10 param 0) (the-as uint arg1)) (let ((v1-17 (new 'static 'attack-info :mask (attack-info-mask vector mode angle id)))) (set! (-> v1-17 id) arg2) (set! (-> v1-17 angle) 'front) diff --git a/goal_src/jak2/levels/temple/rhino.gc b/goal_src/jak2/levels/temple/rhino.gc index 19d4b1648a..20e708b9b6 100644 --- a/goal_src/jak2/levels/temple/rhino.gc +++ b/goal_src/jak2/levels/temple/rhino.gc @@ -780,52 +780,55 @@ ) ) -;; WARN: Return type mismatch symbol vs none. -(defmethod enemy-method-75 rhino ((obj rhino) (arg0 process) (arg1 touching-shapes-entry)) - (let* ((s5-0 (-> arg1 handle1)) +;; WARN: Return type mismatch symbol vs object. +(defmethod enemy-method-75 rhino ((obj rhino) (arg0 process) (arg1 event-message-block)) + (let* ((touch-entry (the-as touching-shapes-entry (-> arg1 param 0))) (s3-0 arg0) (v1-0 (if (type? s3-0 process-focusable) s3-0 ) ) ) - (when (and s5-0 v1-0) - (cond - ((and (focus-test? obj dangerous) ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s5-0) - (-> obj root-override2) - (collide-action deadly) - (collide-action) - ) - ) - (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s5-0) - (-> obj root-override2) - (collide-action persistent-attack) - (collide-action) - ) - (-> obj persistent-attack-id) - (-> obj attack-id) - ) - ) - ) - (enemy-method-104 obj arg0 (the-as uint s5-0) a3-2) + (the-as + object + (when (and (the-as uint touch-entry) v1-0) + (cond + ((and (focus-test? obj dangerous) ((method-of-type touching-shapes-entry prims-touching-action?) + touch-entry + (-> obj root-override2) + (collide-action deadly) + (collide-action) + ) + ) + (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) + touch-entry + (-> obj root-override2) + (collide-action persistent-attack) + (collide-action) + ) + (-> obj persistent-attack-id) + (-> obj attack-id) + ) + ) + ) + (enemy-method-104 obj arg0 touch-entry a3-2) + ) + ) + (((method-of-type touching-shapes-entry prims-touching-action?) + touch-entry + (-> obj root-override2) + (collide-action no-standon) + (collide-action) + ) + (send-shoves (-> obj root-override2) arg0 touch-entry 0.7 6144.0 16384.0) ) - ) - (((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s5-0) - (-> obj root-override2) - (collide-action no-standon) - (collide-action) ) - (send-shoves (-> obj root-override2) arg0 (the-as touching-shapes-entry s5-0) 0.7 6144.0 16384.0) - ) ) ) ) ) -(defmethod enemy-method-104 rhino ((obj rhino) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 rhino ((obj rhino) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (if (and (-> obj next-state) (= (-> obj next-state name) 'victory)) 'attack-or-shove 'attack @@ -851,7 +854,7 @@ (set! (-> a1-6 from) (process->ppointer self)) (set! (-> a1-6 num-params) 2) (set! (-> a1-6 message) 'attack) - (set! (-> a1-6 param 0) arg1) + (set! (-> a1-6 param 0) (the-as uint arg1)) (let ((v1-16 (new 'static 'attack-info :mask (attack-info-mask vector mode angle id)))) (set! (-> v1-16 id) arg2) (set! (-> v1-16 angle) 'front) diff --git a/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc b/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc index 86c8913747..7b56f1a545 100644 --- a/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc +++ b/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc @@ -285,7 +285,7 @@ ) ;; definition for method 104 of type ashelin -(defmethod enemy-method-104 ashelin ((obj ashelin) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 ashelin ((obj ashelin) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (if (and (= (-> arg0 type) target) (-> obj next-state) (let ((v1-4 (-> obj next-state name))) @@ -1505,3 +1505,7 @@ 0 (none) ) + + + + diff --git a/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc b/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc index 84926057ca..40db53dbeb 100644 --- a/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc @@ -455,7 +455,7 @@ (react-to-focus (_type_) none 72) (kill-prefer-falling (_type_) object 73) (general-event-handler (_type_ process int symbol event-message-block) object 74) - (enemy-method-75 (_type_ process touching-shapes-entry) object 75) + (enemy-method-75 (_type_ process event-message-block) object 75) (enemy-method-76 (_type_ process event-message-block) symbol 76) (enemy-method-77 (_type_ (pointer float)) symbol 77) (enemy-method-78 (_type_ (pointer float)) symbol 78) @@ -484,7 +484,7 @@ (enemy-method-101 (_type_) none 101) (enemy-method-102 (_type_) symbol 102) (enemy-method-103 (_type_) collide-spec 103) - (enemy-method-104 (_type_ process uint uint) symbol :behavior process 104) + (enemy-method-104 (_type_ process touching-shapes-entry uint) symbol :behavior process 104) (enemy-method-105 (_type_ process) enemy-flag 105) (enemy-method-106 (_type_ process object int attack-info) none :behavior enemy 106) (get-enemy-target (_type_) process-focusable 107) @@ -746,3 +746,7 @@ (logclear! (-> obj flags) (enemy-flag lock-focus)) (none) ) + + + + diff --git a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc index 4967545d6a..1571fa31cd 100644 --- a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc +++ b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc @@ -479,7 +479,7 @@ (a3-1 (+ (-> v1-13 attack-id) 1)) ) (set! (-> v1-13 attack-id) a3-1) - (if (t9-2 a0-5 a1-3 (the-as uint a2-3) a3-1) + (if (t9-2 a0-5 a1-3 a2-3 a3-1) (return 0) ) ) @@ -674,7 +674,7 @@ ) ;; definition for method 104 of type enemy -(defmethod enemy-method-104 enemy ((obj enemy) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 enemy ((obj enemy) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (let ((v1-1 (-> obj enemy-info attack-damage))) (if (and (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) (= v1-1 1)) (set! v1-1 2) @@ -683,7 +683,7 @@ (set! (-> a1-2 from) (process->ppointer self)) (set! (-> a1-2 num-params) 2) (set! (-> a1-2 message) 'attack) - (set! (-> a1-2 param 0) arg1) + (set! (-> a1-2 param 0) (the-as uint arg1)) (let ((a0-10 (new 'static 'attack-info :mask (attack-info-mask mode shove-back shove-up id damage knock)))) (set! (-> a0-10 id) arg2) (set! (-> a0-10 shove-back) (-> obj enemy-info attack-shove-back)) @@ -1746,7 +1746,7 @@ This commonly includes things such as: (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) ) ((= arg2 'touch) - (enemy-method-75 obj arg0 (the-as touching-shapes-entry arg3)) + (enemy-method-75 obj arg0 arg3) ) ((= arg2 'touched) (when (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) @@ -1841,7 +1841,7 @@ This commonly includes things such as: ) (else (set! (-> obj incoming attack-id) (-> (the-as attack-info s2-0) id)) - (enemy-method-75 obj arg0 (the-as touching-shapes-entry arg3)) + (enemy-method-75 obj arg0 arg3) ) ) ) @@ -2143,27 +2143,27 @@ This commonly includes things such as: ) ;; definition for method 75 of type enemy -(defmethod enemy-method-75 enemy ((obj enemy) (arg0 process) (arg1 touching-shapes-entry)) - (let* ((s4-0 (-> arg1 handle1)) +(defmethod enemy-method-75 enemy ((obj enemy) (arg0 process) (arg1 event-message-block)) + (let* ((touch-entry (the-as touching-shapes-entry (-> arg1 param 0))) (s2-0 arg0) (s3-0 (if (type? s2-0 process-focusable) (the-as process-focusable s2-0) ) ) ) - (when (and s4-0 s3-0) + (when (and (the-as uint touch-entry) s3-0) (cond ((and (focus-test? obj dangerous) (and s3-0 (not (logtest? (-> s3-0 focus-status) (focus-status disable dead ignore grabbed)))) ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s4-0) + touch-entry (-> obj root-override2) (collide-action deadly) (collide-action) ) ) (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s4-0) + touch-entry (-> obj root-override2) (collide-action persistent-attack) (collide-action) @@ -2173,18 +2173,18 @@ This commonly includes things such as: ) ) ) - (enemy-method-104 obj arg0 (the-as uint s4-0) a3-2) + (enemy-method-104 obj arg0 touch-entry a3-2) ) ) ((and ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s4-0) + touch-entry (-> obj root-override2) (collide-action no-standon) (collide-action) ) (not (logtest? (-> obj root-override2 penetrated-by) (-> s3-0 root-override penetrate-using))) ) - (if (send-shoves (-> obj root-override2) arg0 (the-as touching-shapes-entry s4-0) 0.7 6144.0 16384.0) + (if (send-shoves (-> obj root-override2) arg0 touch-entry 0.7 6144.0 16384.0) (send-event obj 'bouncing-off arg0) ) ) @@ -2221,7 +2221,7 @@ This commonly includes things such as: ) ) ) - (enemy-method-104 obj arg0 s4-0 a3-2) + (enemy-method-104 obj arg0 (the-as touching-shapes-entry s4-0) a3-2) ) ) ) @@ -3901,3 +3901,7 @@ This commonly includes things such as: (defbehavior ja-group-index? enemy ((arg0 int)) (ja-group? (-> self draw art-group data arg0)) ) + + + + diff --git a/test/decompiler/reference/jak2/engine/ui/bigmap-h_REF.gc b/test/decompiler/reference/jak2/engine/ui/bigmap-h_REF.gc index 826b01b74f..0266f6c0c8 100644 --- a/test/decompiler/reference/jak2/engine/ui/bigmap-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/bigmap-h_REF.gc @@ -191,7 +191,7 @@ (bigmap-index uint32 :offset-assert 20) (bigmap-image external-art-buffer :offset-assert 24) (tpage external-art-buffer :offset-assert 28) - (progress-minimap symbol :offset-assert 32) + (progress-minimap texture-page :offset-assert 32) (mask-index uint32 :offset-assert 36) (bit-mask bigmap-bit-mask :offset-assert 40) (compressed-next-index uint32 :offset-assert 44) @@ -406,3 +406,7 @@ ) ) ) + + + + diff --git a/test/decompiler/reference/jak2/engine/ui/bigmap_REF.gc b/test/decompiler/reference/jak2/engine/ui/bigmap_REF.gc new file mode 100644 index 0000000000..06cd0400f3 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/ui/bigmap_REF.gc @@ -0,0 +1,1123 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 17 of type bigmap +(defmethod bigmap-method-17 bigmap ((obj bigmap) (arg0 vector)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (.lvf vf1 (&-> arg0 quad)) + (.lvf vf2 (&-> obj offset quad)) + (.add.z.vf vf1 vf0 vf1 :mask #b10) + (.sub.vf vf1 vf1 vf2) + (.mul.w.vf vf1 vf1 vf2) + (.ftoi.vf vf1 vf1) + (.svf (&-> obj pos quad) vf1) + 0 + ) + ) + +;; definition for method 18 of type bigmap +;; INFO: Used lq/sq +(defmethod bigmap-method-18 bigmap ((obj bigmap)) + (let ((s5-0 (-> obj compressed-masks (-> obj mask-index)))) + (set! (-> obj compressed-masks (-> obj mask-index)) (the-as (pointer int8) #f)) + (cond + (s5-0 + (let* ((a0-2 (unpack-comp-rle (the-as (pointer int8) (-> obj bit-mask data)) s5-0)) + (v1-7 (&- a0-2 (the-as uint s5-0))) + ) + (let ((a1-3 (+ (- (the-as int s5-0)) (-> obj compressed-data) (-> obj compressed-next-index)))) + (dotimes (a2-2 a1-3) + (set! (-> s5-0 a2-2) (the-as int (-> (the-as (pointer uint8) (&+ a0-2 a2-2))))) + ) + ) + (dotimes (a0-5 20) + (let ((a1-6 (-> obj compressed-masks a0-5))) + (if (and a1-6 (>= (the-as int a1-6) (the-as int s5-0))) + (set! (-> obj compressed-masks a0-5) (&- a1-6 (the-as uint v1-7))) + ) + ) + ) + (set! (-> obj compressed-next-index) (- (-> obj compressed-next-index) (the-as uint v1-7))) + ) + ) + (else + (let ((v1-10 (-> obj bit-mask data))) + (dotimes (a0-9 416) + (set! (-> (the-as (pointer int128) (&+ v1-10 (* a0-9 16)))) 0) + ) + ) + ) + ) + ) + 0 + ) + +;; definition for method 19 of type bigmap +(defmethod bigmap-method-19 bigmap ((obj bigmap)) + (let* ((s5-0 (+ (-> obj compressed-next-index) 0 (-> obj compressed-data))) + (v1-4 + (pack-comp-rle + (the-as (pointer uint8) s5-0) + (-> obj bit-mask data) + 6656 + (the-as int (- #x8000 (the-as int (-> obj compressed-next-index)))) + ) + ) + ) + (set! (-> obj compressed-masks (-> obj mask-index)) (the-as (pointer int8) s5-0)) + (set! (-> obj compressed-next-index) (the-as uint (+ (-> obj compressed-next-index) (the-as uint v1-4)))) + ) + (set! (-> obj max-next-index) + (the-as uint (max (the-as int (-> obj max-next-index)) (the-as int (-> obj compressed-next-index)))) + ) + 0 + ) + +;; definition for symbol *circle-mask-1x1-meter*, type (array uint32) +(define *circle-mask-1x1-meter* (new 'static 'boxed-array :type uint32 + #xff000 + #x7ffe00 + #x1ffff80 + #x3ffffc0 + #x7ffffe0 + #xffffff0 + #x1ffffff8 + #x3ffffffc + #x3ffffffc + #x7ffffffe + #x7ffffffe + #x7ffffffe + #xffffffff + #xffffffff + #xffffffff + #xffffffff + #xffffffff + #xffffffff + #xffffffff + #xffffffff + #x7ffffffe + #x7ffffffe + #x7ffffffe + #x3ffffffc + #x3ffffffc + #x1ffffff8 + #xffffff0 + #x7ffffe0 + #x3ffffc0 + #x1ffff80 + #x7ffe00 + #xff000 + ) + ) + +;; definition for symbol *circle-mask-2x2-meters*, type (array uint16) +(define *circle-mask-2x2-meters* (new 'static 'boxed-array :type uint16 + #x7e0 + #x1ff8 + #x3ffc + #x7ffe + #x7ffe + #xffff + #xffff + #xffff + #xffff + #xffff + #xffff + #x7ffe + #x7ffe + #x3ffc + #x1ff8 + #x7e0 + ) + ) + +;; definition for method 20 of type bigmap +(defmethod bigmap-method-20 bigmap ((obj bigmap)) + (let ((v1-4 (-> obj layer-mask data (+ (* (-> obj pos y) 128) (/ (-> obj pos x) 2))))) + (if (not (logtest? (-> obj pos x) 1)) + (set! (-> obj layer-mask-enable) (shr v1-4 4)) + (set! (-> obj layer-mask-enable) (logand v1-4 15)) + ) + ) + 0 + ) + +;; definition for method 21 of type bigmap +(defmethod bigmap-method-21 bigmap ((obj bigmap) (arg0 int) (arg1 int)) + (local-vars (v1-3 uint)) + (let* ((v1-1 (+ (* arg1 128) (/ arg0 2))) + (a3-3 (-> obj layer-mask data v1-1)) + ) + (if (not (logtest? v1-1 1)) + (set! v1-3 (shr a3-3 4)) + (set! v1-3 (logand a3-3 15)) + ) + ) + (when (= (-> obj layer-mask-enable) v1-3) + (let ((v1-5 (+ (* arg1 32) (/ arg0 8))) + (a0-1 (-> obj bit-mask)) + (a2-2 (logand arg0 7)) + ) + (logior! (-> a0-1 data v1-5) (ash 1 a2-2)) + ) + ) + 0 + ) + +;; definition for symbol *image-mask-table*, type (pointer int64) +(define *image-mask-table* (new 'static 'array int64 16 + 0 + #x8080 + #x80800000 + #x80808080 + #x808000000000 + #x808000008080 + #x808080800000 + #x808080808080 + -9187343239835811840 + -9187343239835778944 + -9187343237679939584 + -9187343237679906688 + -9187201952591642624 + -9187201952591609728 + -9187201950435770368 + -9187201950435737472 + ) + ) + +;; definition for method 23 of type bigmap +;; WARN: Return type mismatch int vs none. +(defmethod bigmap-method-23 bigmap ((obj bigmap)) + (let* ((v1-0 (the-as object (-> obj bit-mask))) + (a1-0 *image-mask-table*) + (a0-2 (the-as object (-> obj bigmap-image art-group))) + (a0-3 (the-as (pointer int64) (+ (+ #x34000 (-> (the-as (pointer uint32) a0-2) 1) 16) (the-as uint a0-2)))) + ) + (dotimes (a2-3 208) + (dotimes (a3-1 32) + (let ((t0-0 (-> (the-as (pointer uint8) v1-0) 0))) + (when (nonzero? t0-0) + (let* ((t2-0 (shr t0-0 4)) + (t1-1 (logand t0-0 15)) + (t0-3 (-> a1-0 t2-0)) + ) + (let ((t1-4 (-> a1-0 t1-1))) + (logior! (-> a0-3 0) t1-4) + (logior! (-> a0-3 64) t1-4) + ) + (logior! (-> a0-3 1) t0-3) + (logior! (-> a0-3 65) t0-3) + ) + ) + ) + (set! v1-0 (&-> (the-as (pointer uint8) v1-0) 1)) + (set! a0-3 (&-> a0-3 2)) + ) + (set! a0-3 (&-> a0-3 64)) + ) + ) + 0 + (none) + ) + +;; definition for method 22 of type bigmap +;; WARN: Return type mismatch int vs none. +(defmethod bigmap-method-22 bigmap ((obj bigmap) (arg0 dma-buffer) (arg1 (pointer uint32)) (arg2 int) (arg3 int) (arg4 int) (arg5 int)) + (local-vars (sv-16 int)) + (set! sv-16 arg2) + (let* ((v1-0 arg0) + (a0-1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> a0-1 dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt))) + (set! (-> a0-1 vif0) (new 'static 'vif-tag)) + (set! (-> a0-1 vif1) (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-0 base) (the-as pointer (&+ a0-1 16))) + ) + (let* ((v1-1 arg0) + (a0-3 (the-as object (-> v1-1 base))) + ) + (set! (-> (the-as gs-gif-tag a0-3) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x4)) + (set! (-> (the-as gs-gif-tag a0-3) regs) GIF_REGS_ALL_AD) + (set! (-> v1-1 base) (&+ (the-as pointer a0-3) 16)) + ) + (let* ((v1-2 arg0) + (a0-5 (-> v1-2 base)) + ) + (set! (-> (the-as (pointer gs-bitbltbuf) a0-5) 0) + (new 'static 'gs-bitbltbuf :dpsm arg5 :dbp sv-16 :dbw (/ arg3 64)) + ) + (set! (-> (the-as (pointer gs-reg64) a0-5) 1) (gs-reg64 bitbltbuf)) + (set! (-> (the-as (pointer gs-trxpos) a0-5) 2) (new 'static 'gs-trxpos)) + (set! (-> (the-as (pointer gs-reg64) a0-5) 3) (gs-reg64 trxpos)) + (set! (-> (the-as (pointer gs-trxreg) a0-5) 4) (new 'static 'gs-trxreg :rrw arg3 :rrh arg4)) + (set! (-> (the-as (pointer gs-reg64) a0-5) 5) (gs-reg64 trxreg)) + (set! (-> (the-as (pointer gs-trxdir) a0-5) 6) (new 'static 'gs-trxdir)) + (set! (-> (the-as (pointer gs-reg64) a0-5) 7) (gs-reg64 trxdir)) + (set! (-> v1-2 base) (&+ a0-5 64)) + ) + (dma-buffer-add-ref-texture arg0 arg1 arg3 arg4 (the-as gs-psm arg5)) + 0 + (none) + ) + +;; definition for method 26 of type bigmap +;; INFO: Used lq/sq +;; WARN: Return type mismatch pointer vs none. +(defmethod bigmap-method-26 bigmap ((obj bigmap) (arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int)) + (let ((v1-0 (-> arg0 base))) + (set! (-> (the-as (pointer uint128) v1-0) 0) (-> obj sprite-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) v1-0) 1) (-> obj sprite-tmpl quad 1)) + (set! (-> (the-as (pointer uint128) v1-0) 2) (-> obj color quad)) + (set-vector! (the-as vector4w (&+ v1-0 48)) 0 0 0 0) + (set-vector! (the-as vector4w (&+ v1-0 64)) (* arg1 16) (* arg2 16) #xfffff0 0) + (set-vector! (the-as vector4w (&+ v1-0 80)) 8192 3328 0 0) + (set-vector! (the-as vector4w (&+ v1-0 96)) (* arg3 16) (* arg4 16) #xfffff0 0) + ) + (&+! (-> arg0 base) 112) + (none) + ) + +;; definition for method 24 of type bigmap +(defmethod bigmap-method-24 bigmap ((obj bigmap) (arg0 dma-buffer)) + (let ((s4-0 (the-as (pointer uint32) (-> obj bigmap-image art-group)))) + (let ((v1-1 (-> s4-0 0)) + (s3-0 (-> s4-0 1)) + ) + (bigmap-method-22 obj arg0 (+ (+ v1-1 16) (the-as uint s4-0)) 0 16 16 0) + (let* ((v1-4 arg0) + (a0-2 (the-as dma-packet (-> v1-4 base))) + ) + (set! (-> a0-2 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-2 vif0) (new 'static 'vif-tag)) + (set! (-> a0-2 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-4 base) (the-as pointer (&+ a0-2 16))) + ) + (let* ((v1-5 arg0) + (a0-4 (the-as gs-gif-tag (-> v1-5 base))) + ) + (set! (-> a0-4 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> a0-4 regs) GIF_REGS_ALL_AD) + (set! (-> v1-5 base) (the-as pointer (&+ a0-4 16))) + ) + (let* ((v1-6 arg0) + (a0-6 (-> v1-6 base)) + ) + (set! (-> (the-as (pointer int64) a0-6) 0) 1) + (set! (-> (the-as (pointer gs-reg64) a0-6) 1) (gs-reg64 texflush)) + (set! (-> v1-6 base) (&+ a0-6 16)) + ) + (bigmap-method-22 obj arg0 (+ (+ s3-0 16) (the-as uint s4-0)) 8 512 208 19) + ) + (let* ((v1-10 arg0) + (a0-9 (the-as dma-packet (-> v1-10 base))) + ) + (set! (-> a0-9 dma) (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt))) + (set! (-> a0-9 vif0) (new 'static 'vif-tag)) + (set! (-> a0-9 vif1) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-10 base) (the-as pointer (&+ a0-9 16))) + ) + (let* ((v1-11 arg0) + (a0-11 (the-as gs-gif-tag (-> v1-11 base))) + ) + (set! (-> a0-11 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3)) + (set! (-> a0-11 regs) GIF_REGS_ALL_AD) + (set! (-> v1-11 base) (the-as pointer (&+ a0-11 16))) + ) + (let* ((v1-12 arg0) + (a0-13 (-> v1-12 base)) + ) + (set! (-> (the-as (pointer gs-tex0) a0-13) 0) + (new 'static 'gs-tex0 :tbp0 #x8 :tbw #x8 :psm #x13 :tw #x9 :th #x9 :cld #x1) + ) + (set! (-> (the-as (pointer gs-reg64) a0-13) 1) (gs-reg64 tex0-1)) + (set! (-> (the-as (pointer gs-tex1) a0-13) 2) (new 'static 'gs-tex1)) + (set! (-> (the-as (pointer gs-reg64) a0-13) 3) (gs-reg64 tex1-1)) + (set! (-> (the-as (pointer int64) a0-13) 4) 1) + (set! (-> (the-as (pointer gs-reg64) a0-13) 5) (gs-reg64 texflush)) + (set! (-> v1-12 base) (&+ a0-13 48)) + ) + (bigmap-method-26 obj arg0 (-> obj x0) (-> obj y0) (-> obj x1) (-> obj y2)) + (let ((v1-16 (+ #x1a000 (-> s4-0 1)))) + (bigmap-method-22 obj arg0 (+ (+ v1-16 16) (the-as uint s4-0)) 8 512 208 19) + ) + (let* ((v1-19 arg0) + (a0-18 (the-as dma-packet (-> v1-19 base))) + ) + (set! (-> a0-18 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-18 vif0) (new 'static 'vif-tag)) + (set! (-> a0-18 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-19 base) (the-as pointer (&+ a0-18 16))) + ) + (let* ((v1-20 arg0) + (a0-20 (the-as gs-gif-tag (-> v1-20 base))) + ) + (set! (-> a0-20 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> a0-20 regs) GIF_REGS_ALL_AD) + (set! (-> v1-20 base) (the-as pointer (&+ a0-20 16))) + ) + (let* ((v1-21 arg0) + (a0-22 (-> v1-21 base)) + ) + (set! (-> (the-as (pointer int64) a0-22) 0) 0) + (set! (-> (the-as (pointer gs-reg64) a0-22) 1) (gs-reg64 texflush)) + (set! (-> v1-21 base) (&+ a0-22 16)) + ) + (bigmap-method-26 obj arg0 (-> obj x0) (-> obj y2) (-> obj x1) (-> obj y1)) + (let ((v1-25 (+ (-> s4-0 0) 1024)) + (s3-1 (+ #x34000 (-> s4-0 1))) + ) + (bigmap-method-22 obj arg0 (+ (+ v1-25 16) (the-as uint s4-0)) 0 16 16 0) + (bigmap-method-22 obj arg0 (+ (+ s3-1 16) (the-as uint s4-0)) 8 512 208 19) + ) + (let* ((v1-31 arg0) + (a0-28 (the-as dma-packet (-> v1-31 base))) + ) + (set! (-> a0-28 dma) (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt))) + (set! (-> a0-28 vif0) (new 'static 'vif-tag)) + (set! (-> a0-28 vif1) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-31 base) (the-as pointer (&+ a0-28 16))) + ) + (let* ((v1-32 arg0) + (a0-30 (the-as gs-gif-tag (-> v1-32 base))) + ) + (set! (-> a0-30 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3)) + (set! (-> a0-30 regs) GIF_REGS_ALL_AD) + (set! (-> v1-32 base) (the-as pointer (&+ a0-30 16))) + ) + (let* ((v1-33 arg0) + (a0-32 (-> v1-33 base)) + ) + (set! (-> (the-as (pointer gs-tex0) a0-32) 0) + (new 'static 'gs-tex0 :tbp0 #x8 :tbw #x8 :psm #x13 :tw #x9 :th #x9 :tcc #x1 :cld #x1) + ) + (set! (-> (the-as (pointer gs-reg64) a0-32) 1) (gs-reg64 tex0-1)) + (set! (-> (the-as (pointer gs-tex1) a0-32) 2) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) + (set! (-> (the-as (pointer gs-reg64) a0-32) 3) (gs-reg64 tex1-1)) + (set! (-> (the-as (pointer int64) a0-32) 4) 1) + (set! (-> (the-as (pointer gs-reg64) a0-32) 5) (gs-reg64 texflush)) + (set! (-> v1-33 base) (&+ a0-32 48)) + ) + (bigmap-method-26 obj arg0 (-> obj x0) (-> obj y0) (-> obj x1) (-> obj y2)) + (let ((v1-37 (+ #x4e000 (-> s4-0 1)))) + (bigmap-method-22 obj arg0 (+ (+ v1-37 16) (the-as uint s4-0)) 8 512 208 19) + ) + ) + (let* ((v1-40 arg0) + (a0-37 (the-as dma-packet (-> v1-40 base))) + ) + (set! (-> a0-37 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-37 vif0) (new 'static 'vif-tag)) + (set! (-> a0-37 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-40 base) (the-as pointer (&+ a0-37 16))) + ) + (let* ((v1-41 arg0) + (a0-39 (the-as gs-gif-tag (-> v1-41 base))) + ) + (set! (-> a0-39 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> a0-39 regs) GIF_REGS_ALL_AD) + (set! (-> v1-41 base) (the-as pointer (&+ a0-39 16))) + ) + (let* ((v1-42 arg0) + (a0-41 (-> v1-42 base)) + ) + (set! (-> (the-as (pointer int64) a0-41) 0) 1) + (set! (-> (the-as (pointer gs-reg64) a0-41) 1) (gs-reg64 texflush)) + (set! (-> v1-42 base) (&+ a0-41 16)) + ) + (bigmap-method-26 obj arg0 (-> obj x0) (-> obj y2) (-> obj x1) (-> obj y1)) + (none) + ) + +;; definition for method 25 of type bigmap +(defmethod bigmap-method-25 bigmap ((obj bigmap) (arg0 dma-buffer)) + (let ((s4-0 (the-as (pointer uint32) (-> obj bigmap-image art-group)))) + (bigmap-method-22 obj arg0 (+ (+ (-> s4-0 0) 16) (the-as uint s4-0)) 0 16 16 0) + (let* ((v1-5 arg0) + (a0-2 (the-as dma-packet (-> v1-5 base))) + ) + (set! (-> a0-2 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-2 vif0) (new 'static 'vif-tag)) + (set! (-> a0-2 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-5 base) (the-as pointer (&+ a0-2 16))) + ) + (let* ((v1-6 arg0) + (a0-4 (the-as gs-gif-tag (-> v1-6 base))) + ) + (set! (-> a0-4 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> a0-4 regs) GIF_REGS_ALL_AD) + (set! (-> v1-6 base) (the-as pointer (&+ a0-4 16))) + ) + (let* ((v1-7 arg0) + (a0-6 (-> v1-7 base)) + ) + (set! (-> (the-as (pointer int64) a0-6) 0) 0) + (set! (-> (the-as (pointer gs-reg64) a0-6) 1) (gs-reg64 texflush)) + (set! (-> v1-7 base) (&+ a0-6 16)) + ) + (let ((v1-10 (+ (* (the int (-> obj scroll y)) 512) (-> s4-0 1)))) + (bigmap-method-22 obj arg0 (+ (+ v1-10 16) (the-as int s4-0)) 8 512 208 19) + ) + (let* ((v1-13 arg0) + (a0-10 (the-as dma-packet (-> v1-13 base))) + ) + (set! (-> a0-10 dma) (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt))) + (set! (-> a0-10 vif0) (new 'static 'vif-tag)) + (set! (-> a0-10 vif1) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-13 base) (the-as pointer (&+ a0-10 16))) + ) + (let* ((v1-14 arg0) + (a0-12 (the-as gs-gif-tag (-> v1-14 base))) + ) + (set! (-> a0-12 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3)) + (set! (-> a0-12 regs) GIF_REGS_ALL_AD) + (set! (-> v1-14 base) (the-as pointer (&+ a0-12 16))) + ) + (let* ((v1-15 arg0) + (a0-14 (-> v1-15 base)) + ) + (set! (-> (the-as (pointer gs-tex0) a0-14) 0) + (new 'static 'gs-tex0 :tbp0 #x8 :tbw #x8 :psm #x13 :tw #x9 :th #x9 :cld #x1) + ) + (set! (-> (the-as (pointer gs-reg64) a0-14) 1) (gs-reg64 tex0-1)) + (set! (-> (the-as (pointer gs-tex1) a0-14) 2) (new 'static 'gs-tex1)) + (set! (-> (the-as (pointer gs-reg64) a0-14) 3) (gs-reg64 tex1-1)) + (set! (-> (the-as (pointer int64) a0-14) 4) 1) + (set! (-> (the-as (pointer gs-reg64) a0-14) 5) (gs-reg64 texflush)) + (set! (-> v1-15 base) (&+ a0-14 48)) + ) + (bigmap-method-26 obj arg0 (-> obj x0) (-> obj y0) (-> obj x1) (-> obj y2)) + (let ((v1-21 (+ (* (+ (the int (-> obj scroll y)) 208) 512) (-> s4-0 1)))) + (bigmap-method-22 obj arg0 (+ (+ v1-21 16) (the-as int s4-0)) 8 512 208 19) + ) + ) + (let* ((v1-24 arg0) + (a0-19 (the-as dma-packet (-> v1-24 base))) + ) + (set! (-> a0-19 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-19 vif0) (new 'static 'vif-tag)) + (set! (-> a0-19 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-24 base) (the-as pointer (&+ a0-19 16))) + ) + (let* ((v1-25 arg0) + (a0-21 (the-as gs-gif-tag (-> v1-25 base))) + ) + (set! (-> a0-21 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> a0-21 regs) GIF_REGS_ALL_AD) + (set! (-> v1-25 base) (the-as pointer (&+ a0-21 16))) + ) + (let* ((v1-26 arg0) + (a0-23 (-> v1-26 base)) + ) + (set! (-> (the-as (pointer int64) a0-23) 0) 1) + (set! (-> (the-as (pointer gs-reg64) a0-23) 1) (gs-reg64 texflush)) + (set! (-> v1-26 base) (&+ a0-23 16)) + ) + (bigmap-method-26 obj arg0 (-> obj x0) (-> obj y2) (-> obj x1) (-> obj y1)) + (none) + ) + +;; definition for method 27 of type bigmap +;; INFO: Used lq/sq +(defmethod bigmap-method-27 bigmap ((obj bigmap) (arg0 dma-buffer) (arg1 connection-minimap)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (cond + ((= (-> arg1 position) #t) + (let* ((s3-0 (handle->process (-> arg1 handle))) + (v1-4 (if (type? s3-0 process-drawable) + (the-as process-drawable s3-0) + ) + ) + ) + (if (and v1-4 (nonzero? (-> v1-4 root))) + (set! (-> arg1 last-world-pos quad) (-> v1-4 root trans quad)) + ) + ) + ) + ((and (= (logand (the-as int (-> arg1 position)) 7) 4) + (= (-> (the-as basic (-> arg1 position)) type) entity-actor) + ) + (let* ((v1-14 (the-as entity-actor (-> arg1 position))) + (s3-1 (if v1-14 + (-> v1-14 extra process) + ) + ) + (a0-13 (if (type? s3-1 process-drawable) + (the-as process-drawable s3-1) + ) + ) + ) + (if a0-13 + (set! (-> arg1 last-world-pos quad) (-> a0-13 root trans quad)) + (set! (-> arg1 last-world-pos quad) (-> (the-as entity-actor (-> arg1 position)) extra trans quad)) + ) + ) + ) + (else + (set! (-> arg1 last-world-pos quad) (-> (the-as vector (-> arg1 position)) quad)) + ) + ) + (let ((f0-0 (-> arg1 class scale)) + (a1-5 (-> arg1 class color)) + (a3-0 (new 'stack-no-clear 'vector4w)) + (a2-1 (new-stack-vector0)) + (a0-23 (new-stack-vector0)) + (v1-21 (new-stack-vector0)) + ) + (let ((f1-0 (-> *video-params* relative-x-scale))) + (-> arg1 class) + (.lvf vf1 (&-> arg1 last-world-pos quad)) + (.lvf vf2 (&-> obj draw-offset quad)) + (.add.z.vf vf1 vf0 vf1 :mask #b10) + (.sub.vf vf1 vf1 vf2) + (.mul.w.vf vf1 vf1 vf2) + (.ftoi.vf vf1 vf1) + (.svf (&-> a3-0 quad) vf1) + (if (logtest? (-> arg1 class flags) (minimap-flag goal)) + (set! (-> arg1 class icon-xy x) (the-as uint (mod (the int (-> obj goal-time)) 6))) + ) + (if (-> *blit-displays-work* horizontal-flip-flag) + (set! f1-0 (- f1-0)) + ) + (set! (-> a2-1 x) (+ (the float (-> obj x0)) (* 2.0 f1-0 (the float (-> a3-0 x))))) + (set! (-> a2-1 y) (- (the float (+ (* (-> a3-0 y) 2) 1840)) (-> obj scroll y))) + (let ((f1-2 (* 20.0 f1-0 f0-0)) + (f0-1 (* 20.0 f0-0)) + ) + (set! (-> a0-23 x) (the float (the int (- (-> a2-1 x) (* 0.5 f1-2))))) + (set! (-> a0-23 y) (the float (the int (- (-> a2-1 y) (* 0.5 f0-1))))) + (set! (-> v1-21 x) (+ (-> a0-23 x) f1-2)) + (set! (-> v1-21 y) (+ (-> a0-23 y) f0-1)) + ) + ) + (let* ((t1-2 (+ (* (the-as uint 320) (-> arg1 class icon-xy x)) 8)) + (t2-0 (+ (* (the-as uint 320) (-> arg1 class icon-xy y)) 8)) + (a2-8 (+ t1-2 312)) + (a3-11 (+ t2-0 312)) + (t0-15 (-> arg0 base)) + ) + (set! (-> (the-as (pointer uint128) t0-15) 0) (-> obj sprite-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) t0-15) 1) (-> obj sprite-tmpl quad 1)) + (set-vector! + (the-as vector4w (&+ t0-15 32)) + (the-as int (-> a1-5 r)) + (the-as int (-> a1-5 g)) + (the-as int (-> a1-5 b)) + 128 + ) + (set-vector! (the-as vector4w (&+ t0-15 48)) t1-2 t2-0 0 0) + (set-vector! + (the-as vector4w (&+ t0-15 64)) + (the int (* 16.0 (-> a0-23 x))) + (the int (* 16.0 (-> a0-23 y))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ t0-15 80)) a2-8 a3-11 0 0) + (set-vector! + (the-as vector4w (&+ t0-15 96)) + (the int (* 16.0 (-> v1-21 x))) + (the int (* 16.0 (-> v1-21 y))) + #xffffff + 0 + ) + ) + ) + (&+! (-> arg0 base) 112) + 0 + ) + ) + +;; definition for method 9 of type bigmap +;; WARN: Return type mismatch int vs none. +(defmethod initialize bigmap ((obj bigmap)) + (set! (-> obj bigmap-index) (the-as uint 20)) + (set-pending-file (-> obj bigmap-image) (the-as string #f) 0 (process->handle *dproc*) 0.0) + (set! (-> obj compressed-next-index) (the-as uint 0)) + (set! (-> obj max-next-index) (the-as uint 0)) + (dotimes (v1-5 20) + (set! (-> obj compressed-masks v1-5) (the-as (pointer int8) #f)) + ) + (set! (-> obj mask-index) (the-as uint 20)) + (set! (-> obj layer-index) (the-as uint 20)) + (set! (-> obj layer-mask-enable) (the-as uint 0)) + 0 + (none) + ) + +;; definition for method 10 of type bigmap +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod update bigmap ((obj bigmap)) + (let ((v1-1 (level-get-target-inside *level*))) + (if v1-1 + (set! (-> obj bigmap-index) (the-as uint (-> v1-1 info bigmap-id))) + ) + ) + (cond + ((-> obj drawing-flag) + (cond + ((= (-> *blit-displays-work* count-down) 1) + (set-pending-file + (-> obj bigmap-image) + "world-map" + (the-as int (-> obj load-index)) + (process->handle *dproc*) + 0.0 + ) + (set-pending-file (-> obj tpage) "progress-minimap" 0 (process->handle *dproc*) 0.0) + (set! (-> obj loading-flag) #t) + ) + (else + (update (-> obj bigmap-image)) + (update (-> obj tpage)) + (when (and (-> obj loading-flag) + (= (file-status (-> obj bigmap-image) "world-map" (the-as int (-> obj load-index))) 'active) + (= (file-status (-> obj tpage) "progress-minimap" 0) 'active) + (not (load-in-progress? *level*)) + ) + (if (!= (-> obj bigmap-index) 20) + (bigmap-method-23 obj) + ) + (let ((s5-0 (-> *level* loading-level)) + (s4-0 (-> *texture-pool* allocate-func)) + (s3-0 (-> *texture-relocate-later* memcpy)) + ) + (set! (-> *texture-pool* allocate-func) texture-page-common-boot-allocate) + (set! (-> *level* loading-level) #f) + (set! (-> *texture-relocate-later* memcpy) #f) + (set! (-> obj progress-minimap) + (the-as + texture-page + (link (-> obj tpage buf) (-> obj tpage load-file data) (-> obj tpage len) (-> obj tpage heap) 4) + ) + ) + (set! (-> *level* loading-level) s5-0) + (set! (-> *texture-pool* allocate-func) s4-0) + (set! (-> *texture-relocate-later* memcpy) s3-0) + ) + (set! (-> obj loading-flag) #f) + ) + ) + ) + ) + ((!= (-> obj bigmap-index) 20) + (set! (-> obj offset quad) (-> *bigmap-info-array* data (-> obj mask-index) quad)) + (when (!= (-> obj bigmap-index) (-> obj mask-index)) + (if (!= (-> obj mask-index) 20) + (bigmap-method-19 obj) + ) + (set! (-> obj mask-index) (-> obj bigmap-index)) + (bigmap-method-18 obj) + ) + (when (!= (-> obj bigmap-index) (-> obj layer-index)) + (set! (-> obj layer-index) (-> obj bigmap-index)) + (unpack-comp-rle + (the-as (pointer int8) (-> obj layer-mask data)) + (the-as (pointer int8) (-> obj compressed-layers data (-> obj layer-index))) + ) + ) + (bigmap-method-17 obj (target-pos 0)) + (bigmap-method-20 obj) + (cond + ((-> obj recording-flag) + (when (-> obj fill-flag) + (let ((a1-9 (-> obj pos x)) + (a2-5 (-> obj pos y)) + ) + (if (and (>= a1-9 0) (< a1-9 256) (>= a2-5 0) (< a2-5 208)) + (bigmap-method-21 obj a1-9 a2-5) + ) + ) + ) + ) + (else + (let* ((f0-1 (* 131072.0 (-> obj offset w))) + (f30-0 (* f0-1 f0-1)) + (s4-2 (the int (* 131072.0 (-> obj offset w)))) + (s5-2 (- s4-2)) + ) + (while (>= s4-2 s5-2) + (let* ((f0-7 (the float s5-2)) + (s2-0 (the int (sqrtf (- f30-0 (* f0-7 f0-7))))) + (s3-1 (- s2-0)) + ) + (while (>= s2-0 s3-1) + (let ((a1-10 (+ (-> obj pos x) s3-1)) + (a2-6 (+ (-> obj pos y) s5-2)) + ) + (if (and (>= a1-10 0) (< a1-10 256) (>= a2-6 0) (< a2-6 208)) + (bigmap-method-21 obj a1-10 a2-6) + ) + ) + (+! s3-1 1) + ) + ) + (+! s5-2 1) + ) + ) + ) + ) + ) + (else + (set-vector! (-> obj offset) -2621440.0 -4456448.0 16384.0 0.000030517578) + ) + ) + 0 + (none) + ) + +;; definition for method 11 of type bigmap +;; INFO: Used lq/sq +;; ERROR: Failed store: (s.w! (+ v1-35 8) 0) at op 125 +(defmethod bigmap-method-11 bigmap ((obj bigmap) (arg0 int) (arg1 int) (arg2 int) (arg3 int)) + (local-vars (sv-96 pointer) (sv-100 texture) (sv-104 matrix) (sv-112 int)) + (with-pp + (when (and (= (file-status (-> obj bigmap-image) "world-map" (the-as int (-> obj load-index))) 'active) + (not (-> obj loading-flag)) + ) + (let ((f0-0 (-> *video-params* relative-x-scale))) + (cond + ((-> *blit-displays-work* horizontal-flip-flag) + (set! (-> obj x0) (+ (the int (* (the float (+ arg2 -2048)) f0-0)) 2048)) + (set! (-> obj x1) (+ (the int (* (the float (+ arg0 -2048)) f0-0)) 2048)) + ) + (else + (set! (-> obj x0) (+ (the int (* (the float (+ arg0 -2048)) f0-0)) 2048)) + (set! (-> obj x1) (+ (the int (* (the float (+ arg2 -2048)) f0-0)) 2048)) + ) + ) + ) + (set! (-> obj y0) arg1) + (set! (-> obj y1) arg3) + (set! (-> obj y2) (/ (+ arg1 arg3) 2)) + (with-dma-buffer-add-bucket ((s4-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id tex-all-map) + ) + (let ((v1-27 s4-1)) + (let ((a0-5 (the-as dma-packet (-> v1-27 base)))) + (set! (-> a0-5 dma) (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt))) + (set! (-> a0-5 vif0) (new 'static 'vif-tag)) + (set! (-> a0-5 vif1) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-27 base) (the-as pointer (&+ a0-5 16))) + ) + ) + (let ((v1-28 s4-1)) + (let ((a0-7 (the-as gs-gif-tag (-> v1-28 base)))) + (set! (-> a0-7 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3)) + (set! (-> a0-7 regs) GIF_REGS_ALL_AD) + (set! (-> v1-28 base) (the-as pointer (&+ a0-7 16))) + ) + ) + (let ((v1-29 s4-1)) + (let ((a0-9 (-> v1-29 base))) + (set! (-> (the-as (pointer gs-test) a0-9) 0) + (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)) + ) + (set! (-> (the-as (pointer gs-reg64) a0-9) 1) (gs-reg64 test-1)) + (set! (-> (the-as (pointer int64) a0-9) 2) 68) + (set! (-> (the-as (pointer gs-reg64) a0-9) 3) (gs-reg64 alpha-1)) + (set! (-> (the-as (pointer int64) a0-9) 4) 5) + (set! (-> (the-as (pointer gs-reg64) a0-9) 5) (gs-reg64 clamp-1)) + (set! (-> v1-29 base) (&+ a0-9 48)) + ) + ) + (if (= (-> obj bigmap-index) 20) + (bigmap-method-25 obj s4-1) + (bigmap-method-24 obj s4-1) + ) + ) + (with-dma-buffer-add-bucket ((s4-2 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id tex-all-map) + ) + (when (= (-> obj y0) 1840) + (let ((s2-1 (-> s4-2 base)) + (s3-1 (lookup-texture-by-id-fast (new 'static 'texture-id :index #x15 :page #xc93))) + ) + (when s3-1 + (set! (-> (the-as (pointer uint128) s2-1) 0) (-> obj adgif-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) s2-1) 1) (-> obj adgif-tmpl quad 1)) + (adgif-shader<-texture-simple! (the-as adgif-shader (&+ s2-1 32)) s3-1) + (&+! (-> s4-2 base) 112) + ) + (if (not s3-1) + (format 0 "ERROR: bigmap: mini-map-icons texture is #f~%") + ) + ) + (let ((s3-2 (the-as connection-pers (-> *minimap* engine alive-list-override)))) + (while s3-2 + (let ((a2-3 (the-as connection-minimap s3-2))) + (when (logtest? (-> a2-3 class flags) (minimap-flag bigmap)) + (cond + ((= (-> obj bigmap-index) 20) + (bigmap-method-27 obj s4-2 a2-3) + ) + (else + (if (not (logtest? (-> a2-3 class flags) (minimap-flag city-only))) + (bigmap-method-27 obj s4-2 a2-3) + ) + ) + ) + ) + ) + (set! s3-2 (-> s3-2 next)) + ) + ) + (let ((s3-3 (new 'stack-no-clear 'vector)) + (f30-0 (-> *video-params* relative-x-scale)) + ) + (vector-z-quaternion! s3-3 (-> *target* control quat)) + (vector-xz-normalize! s3-3 -1.0) + (set! (-> s3-3 y) 0.0) + (set! (-> s3-3 w) 0.0) + (set! sv-96 (-> s4-2 base)) + (set! sv-100 (lookup-texture-by-id-fast (new 'static 'texture-id :index #x42 :page #xb))) + (set! sv-104 (new 'stack-no-clear 'matrix)) + (set! sv-112 (the int (* 56.0 f30-0))) + (when sv-100 + (bigmap-method-17 obj (target-pos 0)) + (if (-> *blit-displays-work* horizontal-flip-flag) + (set! f30-0 (- f30-0)) + ) + (set-vector! (-> (the-as matrix sv-104) vector 0) (* (-> s3-3 z) f30-0) 0.0 (- (-> s3-3 x)) 0.0) + (set-vector! (-> (the-as matrix sv-104) vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> (the-as matrix sv-104) vector 2) (* (-> s3-3 x) f30-0) 0.0 (-> s3-3 z) 1.0) + (set-vector! + (-> (the-as matrix sv-104) trans) + (+ (the float (-> obj x0)) (* 2.0 f30-0 (the float (-> obj pos x)))) + 0.0 + (- (the float (+ (* (-> obj pos y) 2) 1840)) (-> obj scroll y)) + 1.0 + ) + (set-vector! (-> obj corner 0) 0.0 0.0 -7.0 1.0) + (set-vector! (-> obj corner 1) 7.0 0.0 0.0 1.0) + (set-vector! (-> obj corner 2) -7.0 0.0 0.0 1.0) + (set-vector! (-> obj corner 3) 0.0 0.0 7.0 1.0) + (vector-matrix*! (the-as vector (-> obj corner)) (the-as vector (-> obj corner)) sv-104) + (vector-matrix*! (-> obj corner 1) (-> obj corner 1) sv-104) + (vector-matrix*! (-> obj corner 2) (-> obj corner 2) sv-104) + (vector-matrix*! (-> obj corner 3) (-> obj corner 3) sv-104) + (let ((v1-101 (-> obj adgif-tmpl dma-vif quad))) + (set! (-> (the-as (pointer uint128) sv-96)) v1-101) + ) + (let ((v1-102 (-> obj adgif-tmpl quad 1))) + (set! (-> (the-as (pointer uint128) sv-96) 1) v1-102) + ) + (adgif-shader<-texture-simple! (the-as adgif-shader (&+ sv-96 32)) sv-100) + (let ((v1-104 (-> obj draw-tmpl dma-vif quad))) + (set! (-> (the-as (pointer uint128) sv-96) 7) v1-104) + ) + (let ((v1-105 (-> obj draw-tmpl quad 1))) + (set! (-> (the-as (pointer uint128) sv-96) 8) v1-105) + ) + (set-vector! (the-as vector4w (&+ sv-96 144)) 0 255 255 128) + (set-vector! (the-as vector4w (&+ sv-96 160)) 0 0 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 176)) + (the int (* 16.0 (-> obj corner 0 x))) + (the int (* 16.0 (-> obj corner 0 z))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ sv-96 192)) 256 0 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 208)) + (the int (* 16.0 (-> obj corner 1 x))) + (the int (* 16.0 (-> obj corner 1 z))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ sv-96 224)) 0 256 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 240)) + (the int (* 16.0 (-> obj corner 2 x))) + (the int (* 16.0 (-> obj corner 2 z))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ sv-96 256)) 256 256 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 272)) + (the int (* 16.0 (-> obj corner 3 x))) + (the int (* 16.0 (-> obj corner 3 z))) + #xffffff + 0 + ) + (&+! (-> s4-2 base) 288) + ) + ) + ) + ) + (+! (-> obj goal-time) (* 16.0 (-> pp clock seconds-per-frame))) + (set-dirty-mask! (-> *level* default-level) 4 #x1a400 0) + ) + 0 + ) + ) + +;; definition for method 12 of type bigmap +;; INFO: Used lq/sq +(defmethod bigmap-method-12 bigmap ((obj bigmap)) + (cond + ((= (-> obj bigmap-index) 20) + (let* ((v1-2 (-> *cpad-list* cpads 0)) + (f1-0 (analog-input (the-as int (-> v1-2 lefty)) 128.0 32.0 110.0 4.0)) + ) + (set! (-> obj scroll y) (fmax 0.0 (fmin 416.0 (+ (-> obj scroll y) f1-0)))) + ) + ) + (else + (set! (-> obj scroll quad) (the-as uint128 0)) + 0 + ) + ) + 0 + ) + +;; definition for method 13 of type bigmap +(defmethod bigmap-method-13 bigmap ((obj bigmap)) + (when (!= (-> obj mask-index) 20) + (bigmap-method-19 obj) + (set! (-> obj mask-index) (the-as uint 20)) + ) + 0 + ) + +;; definition for method 14 of type bigmap +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defmethod bigmap-method-14 bigmap ((obj bigmap)) + (set! (-> obj bigmap-index) (the-as uint (-> (level-get-target-inside *level*) info bigmap-id))) + (cond + ((= (-> obj bigmap-index) 20) + (bigmap-method-17 obj (target-pos 0)) + (set! (-> obj scroll y) (the float (max 0 (+ (* (-> obj pos y) 2) -208)))) + (set-vector! (-> obj draw-offset) -2621440.0 -4456448.0 16384.0 0.000030517578) + (cond + ((logtest? (game-feature pass-red) (-> *game-info* features)) + (cond + ((and (logtest? (game-feature pass-green) (-> *game-info* features)) + (logtest? (game-feature pass-yellow) (-> *game-info* features)) + ) + (set! (-> obj load-index) (the-as uint 24)) + ) + ((logtest? (game-feature pass-green) (-> *game-info* features)) + (set! (-> obj load-index) (the-as uint 23)) + ) + ((logtest? (game-feature pass-yellow) (-> *game-info* features)) + (set! (-> obj load-index) (the-as uint 22)) + ) + (else + (set! (-> obj load-index) (the-as uint 21)) + ) + ) + ) + (else + (set! (-> obj load-index) (the-as uint 20)) + ) + ) + ) + (else + (set! (-> obj scroll y) 0.0) + (set! (-> obj draw-offset quad) (-> *bigmap-info-array* data (-> obj bigmap-index) quad)) + (set! (-> obj load-index) (-> obj bigmap-index)) + ) + ) + (set! (-> obj drawing-flag) #t) + (none) + ) + +;; definition for method 15 of type bigmap +(defmethod bigmap-method-15 bigmap ((obj bigmap)) + (set-pending-file + (-> obj bigmap-image) + (the-as string #f) + (the-as int (-> obj bigmap-index)) + (process->handle *dproc*) + 0.0 + ) + (set-pending-file (-> obj tpage) (the-as string #f) 0 (process->handle *dproc*) 0.0) + (let ((v1-8 #f)) + (while (not v1-8) + (update (-> obj bigmap-image)) + (update (-> obj tpage)) + (set! v1-8 (and (= (-> obj bigmap-image status) 'inactive) (= (-> obj tpage status) 'inactive))) + ) + ) + (when (-> obj progress-minimap) + (unload-page *texture-pool* (-> obj progress-minimap)) + (set! (-> *level* default-level texture-page 3) (the-as texture-page 0)) + (set! (-> obj progress-minimap) #f) + ) + (set! (-> obj drawing-flag) #f) + (set! (-> obj loading-flag) #f) + 0 + ) + +;; definition for symbol *map-save-ptr*, type (pointer uint64) +(define *map-save-ptr* (the-as (pointer uint64) #f)) + +;; definition for method 16 of type bigmap +(defmethod dump-to-file bigmap ((obj bigmap)) + (if (not *map-save-ptr*) + (set! *map-save-ptr* (the-as (pointer uint64) (malloc 'debug #xd0000))) + ) + (let ((v1-3 (the-as (pointer uint8) (-> obj bit-mask))) + (a0-2 *map-save-ptr*) + ) + (dotimes (a1-1 208) + (dotimes (a2-0 32) + (let ((a3-0 (-> v1-3 0))) + (dotimes (t0-0 8) + (cond + ((not (logtest? a3-0 (ash 1 t0-0))) + (set! (-> a0-2 0) (the-as uint 0)) + (set! (-> a0-2 256) (the-as uint 0)) + 0 + ) + (else + (set! (-> a0-2 0) (the-as uint #x8080808080808080)) + (set! (-> a0-2 256) (the-as uint #x8080808080808080)) + ) + ) + (set! a0-2 (&-> a0-2 1)) + ) + ) + (set! v1-3 (&-> v1-3 1)) + ) + (set! a0-2 (&-> a0-2 256)) + ) + ) + (level-get-target-inside *level*) + (let ((gp-1 512) + (s5-0 416) + ) + (set! (-> *image-name* data 0) (the-as uint 0)) + (format *image-name* "final/mapsave/tombb-map.raw") + (format 0 "writing ~s~%" *image-name*) + (let ((s4-0 (new 'stack 'file-stream *image-name* 'write))) + (file-stream-write s4-0 *map-save-ptr* (the-as uint (* (* s5-0 gp-1) 4))) + (file-stream-close s4-0) + ) + ) + ) + +;; failed to figure out what this is: +(kmemopen global "bigmap") + +;; definition for symbol *bigmap*, type bigmap +(define *bigmap* (new 'global 'bigmap)) + +;; failed to figure out what this is: +(kmemclose) + + + + diff --git a/test/decompiler/reference/jak2/engine/ui/text_REF.gc b/test/decompiler/reference/jak2/engine/ui/text_REF.gc index cb48403192..45f1dc3612 100644 --- a/test/decompiler/reference/jak2/engine/ui/text_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/text_REF.gc @@ -96,7 +96,7 @@ (defun convert-korean-text ((arg0 string)) "Converts the provided [[string]] of [[game-text]] into korean. Returns a [[string]]" (local-vars (v1-21 int)) - (let ((gp-0 (-> arg0 data))) + (let ((charp (-> arg0 data))) *expanded-text-line0* (let ((s4-0 0)) 0 @@ -114,26 +114,26 @@ (clear s3-0) (while (< s4-0 s5-0) (cond - ((= (-> gp-0 s4-0) 3) + ((= (-> charp s4-0) 3) (+! s4-0 1) - (while (and (< s4-0 s5-0) (!= (-> gp-0 s4-0) 3) (!= (-> gp-0 s4-0) 4)) - (set! (-> s3-0 data s1-0) (-> gp-0 s4-0)) + (while (and (< s4-0 s5-0) (!= (-> charp s4-0) 3) (!= (-> charp s4-0) 4)) + (set! (-> s3-0 data s1-0) (-> charp s4-0)) (+! s4-0 1) (+! s1-0 1) ) ) (else (let ((v1-17 (+ s4-0 1))) - (-> gp-0 v1-17) + (-> charp v1-17) (set! s4-0 (+ v1-17 1)) ) (set! (-> s3-0 data s1-0) (the-as uint 126)) (let ((v1-19 (+ s1-0 1))) (set! (-> s3-0 data v1-19) (the-as uint 89)) (let ((v1-20 (+ v1-19 1))) - (while (and (< s4-0 s5-0) (< v1-20 s2-0) (!= (-> gp-0 s4-0) 3) (!= (-> gp-0 s4-0) 4)) + (while (and (< s4-0 s5-0) (< v1-20 s2-0) (!= (-> charp s4-0) 3) (!= (-> charp s4-0) 4)) (cond - ((= (-> gp-0 s4-0) 5) + ((= (-> charp s4-0) 5) (set! (-> s3-0 data v1-20) (the-as uint 1)) (+! s4-0 1) (set! v1-21 (+ v1-20 1)) @@ -143,7 +143,7 @@ (set! v1-21 (+ v1-20 1)) ) ) - (set! (-> s3-0 data v1-21) (-> gp-0 s4-0)) + (set! (-> s3-0 data v1-21) (-> charp s4-0)) (+! s4-0 1) (let ((v1-22 (+ v1-21 1))) (set! (-> s3-0 data v1-22) (the-as uint 126)) diff --git a/test/decompiler/reference/jak2/levels/city/common/citizen-enemy_REF.gc b/test/decompiler/reference/jak2/levels/city/common/citizen-enemy_REF.gc index 6cbe3502d9..6878babf08 100644 --- a/test/decompiler/reference/jak2/levels/city/common/citizen-enemy_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/citizen-enemy_REF.gc @@ -104,7 +104,7 @@ ) ) ) - (enemy-method-104 obj arg0 s3-0 a3-2) + (enemy-method-104 obj arg0 (the-as touching-shapes-entry s3-0) a3-2) ) ) (else @@ -351,3 +351,7 @@ (go (method-of-object obj active)) (none) ) + + + + diff --git a/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc index 39eda4546f..d96254738f 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc @@ -967,7 +967,7 @@ ) ;; definition for method 104 of type bot -(defmethod enemy-method-104 bot ((obj bot) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 bot ((obj bot) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (cond ((and (= (-> arg0 type) target) (not (logtest? (-> obj bot-flags) (bot-flags attacked)))) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) @@ -998,7 +998,7 @@ (set! (-> a1-2 from) (process->ppointer self)) (set! (-> a1-2 num-params) 2) (set! (-> a1-2 message) 'attack) - (set! (-> a1-2 param 0) arg1) + (set! (-> a1-2 param 0) (the-as uint arg1)) (let ((v1-14 (new 'static 'attack-info :mask (attack-info-mask mode shove-back shove-up id)))) (set! (-> v1-14 id) arg2) (set! (-> v1-14 shove-back) (-> obj enemy-info-override attack-shove-back)) @@ -1029,7 +1029,7 @@ ) (else (when (!= (-> arg0 type) target) - (let* ((s3-0 (-> arg1 param 0)) + (let* ((touch-entry (-> arg1 param 0)) (s2-0 arg0) (v1-6 (if (type? s2-0 process-focusable) s2-0 @@ -1043,14 +1043,14 @@ (not (logtest? (-> (the-as process-focusable v1-6) focus-status) (focus-status disable dead ignore grabbed))) ) ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s3-0) + (the-as touching-shapes-entry touch-entry) (-> obj root-override2) (collide-action deadly) (collide-action) ) ) (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s3-0) + (the-as touching-shapes-entry touch-entry) (-> obj root-override2) (collide-action persistent-attack) (collide-action) @@ -1060,7 +1060,7 @@ ) ) ) - (enemy-method-104 obj arg0 s3-0 a3-2) + (enemy-method-104 obj arg0 (the-as touching-shapes-entry touch-entry) a3-2) ) ) (else @@ -2095,3 +2095,7 @@ If the player is too far, play a warning speech." (none) ) ) + + + + diff --git a/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc index 636eefb6c9..ea2704aff9 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc @@ -677,7 +677,7 @@ ) ;; definition for method 104 of type tomb-baby-spider -(defmethod enemy-method-104 tomb-baby-spider ((obj tomb-baby-spider) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 tomb-baby-spider ((obj tomb-baby-spider) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (let* ((s1-0 arg0) (s2-0 (if (type? s1-0 process-focusable) s1-0 @@ -697,7 +697,7 @@ (set! (-> a1-5 from) (process->ppointer self)) (set! (-> a1-5 num-params) 2) (set! (-> a1-5 message) 'attack) - (set! (-> a1-5 param 0) arg1) + (set! (-> a1-5 param 0) (the-as uint arg1)) (let ((v1-9 (new 'static 'attack-info :mask (attack-info-mask mode shove-back shove-up id damage knock)))) (set! (-> v1-9 id) arg2) (set! (-> v1-9 shove-back) (* f0-0 (-> obj enemy-info-override attack-shove-back))) @@ -827,3 +827,7 @@ ;; failed to figure out what this is: 0 + + + + diff --git a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc index 6800f17372..9dd2be5c8e 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc @@ -507,7 +507,7 @@ ;; definition for method 104 of type metalmonk ;; INFO: Used lq/sq -(defmethod enemy-method-104 metalmonk ((obj metalmonk) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 metalmonk ((obj metalmonk) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (let* ((s3-0 arg0) (a0-2 (if (type? s3-0 process-focusable) s3-0 @@ -541,7 +541,7 @@ (set! (-> a1-10 from) (process->ppointer self)) (set! (-> a1-10 num-params) 2) (set! (-> a1-10 message) 'attack) - (set! (-> a1-10 param 0) arg1) + (set! (-> a1-10 param 0) (the-as uint arg1)) (let ((v1-17 (new 'static 'attack-info :mask (attack-info-mask vector mode angle id)))) (set! (-> v1-17 id) arg2) (set! (-> v1-17 angle) 'front) @@ -1350,3 +1350,7 @@ 0 (none) ) + + + + diff --git a/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc b/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc index 0a2b50a540..d439a5dacc 100644 --- a/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc @@ -1047,8 +1047,8 @@ ;; definition for method 75 of type rhino ;; WARN: Return type mismatch symbol vs object. -(defmethod enemy-method-75 rhino ((obj rhino) (arg0 process) (arg1 touching-shapes-entry)) - (let* ((s5-0 (-> arg1 handle1)) +(defmethod enemy-method-75 rhino ((obj rhino) (arg0 process) (arg1 event-message-block)) + (let* ((touch-entry (the-as touching-shapes-entry (-> arg1 param 0))) (s3-0 arg0) (v1-0 (if (type? s3-0 process-focusable) s3-0 @@ -1057,17 +1057,17 @@ ) (the-as object - (when (and s5-0 v1-0) + (when (and (the-as uint touch-entry) v1-0) (cond ((and (focus-test? obj dangerous) ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s5-0) + touch-entry (-> obj root-override2) (collide-action deadly) (collide-action) ) ) (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s5-0) + touch-entry (-> obj root-override2) (collide-action persistent-attack) (collide-action) @@ -1077,16 +1077,16 @@ ) ) ) - (enemy-method-104 obj arg0 (the-as uint s5-0) a3-2) + (enemy-method-104 obj arg0 touch-entry a3-2) ) ) (((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s5-0) + touch-entry (-> obj root-override2) (collide-action no-standon) (collide-action) ) - (send-shoves (-> obj root-override2) arg0 (the-as touching-shapes-entry s5-0) 0.7 6144.0 16384.0) + (send-shoves (-> obj root-override2) arg0 touch-entry 0.7 6144.0 16384.0) ) ) ) @@ -1096,7 +1096,7 @@ ;; definition for method 104 of type rhino ;; INFO: Used lq/sq -(defmethod enemy-method-104 rhino ((obj rhino) (arg0 process) (arg1 uint) (arg2 uint)) +(defmethod enemy-method-104 rhino ((obj rhino) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) (if (and (-> obj next-state) (= (-> obj next-state name) 'victory)) 'attack-or-shove 'attack @@ -1122,7 +1122,7 @@ (set! (-> a1-6 from) (process->ppointer self)) (set! (-> a1-6 num-params) 2) (set! (-> a1-6 message) 'attack) - (set! (-> a1-6 param 0) arg1) + (set! (-> a1-6 param 0) (the-as uint arg1)) (let ((v1-16 (new 'static 'attack-info :mask (attack-info-mask vector mode angle id)))) (set! (-> v1-16 id) arg2) (set! (-> v1-16 angle) 'front) @@ -2131,3 +2131,7 @@ 0 (none) ) + + + + diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 6a3edc4ce4..667d5449d7 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -89,7 +89,8 @@ ], "skip_compile_files": [ - "drill-baron" + "drill-baron", + "bigmap" ], "skip_compile_functions": [