diff --git a/common/formatter/formatter.cpp b/common/formatter/formatter.cpp index 6018251992..5aa0205b7e 100644 --- a/common/formatter/formatter.cpp +++ b/common/formatter/formatter.cpp @@ -147,7 +147,7 @@ void apply_formatting_config( // Find the maximum number of columns int max_columns = 0; for (const auto& field : curr_node.refs) { - if (field.refs.size() > max_columns) { + if ((int)field.refs.size() > max_columns) { max_columns = field.refs.size(); } } @@ -156,7 +156,7 @@ void apply_formatting_config( for (int col = 0; col < max_columns; col++) { column_max_widths.push_back(0); for (const auto& field : curr_node.refs) { - if (field.refs.size() > col) { + if ((int)field.refs.size() > col) { const auto width = get_total_form_inlined_width(field.refs.at(col)); if (width > column_max_widths.at(col)) { column_max_widths[col] = width; @@ -271,7 +271,7 @@ std::vector apply_formatting(const FormatterTreeNode& curr_node, val = comments::format_block_comment(ref.token_str()); } form_lines.push_back(val); - if (!curr_node.metadata.is_top_level && i == curr_node.refs.size() - 1 && + if (!curr_node.metadata.is_top_level && i == (int)curr_node.refs.size() - 1 && (ref.metadata.is_comment)) { // if there's an inline comment at the end of a form, we have to force the paren to the next // line and do a new-line paren this is ugly, but we have no choice! @@ -354,9 +354,9 @@ std::vector apply_formatting(const FormatterTreeNode& curr_node, // Add any column padding if (!curr_node.formatting_config.list_element_column_widths.empty()) { - for (int i = 0; i < form_lines.size(); i++) { + for (int i = 0; i < (int)form_lines.size(); i++) { const auto& token = form_lines.at(i); - if (i < form_lines.size() - 1) { + if (i < (int)form_lines.size() - 1) { form_lines[i] = str_util::pad_right( token, curr_node.formatting_config.list_element_column_widths.at(i), ' '); } diff --git a/common/util/string_util.cpp b/common/util/string_util.cpp index 5f8db4f80e..b4fd766121 100644 --- a/common/util/string_util.cpp +++ b/common/util/string_util.cpp @@ -247,7 +247,7 @@ std::string titlize(const std::string& str) { } std::string pad_right(const std::string& input, const int width, const char padding_char) { - if (input.length() >= width) { + if ((int)input.length() >= width) { return input; // No need to pad if input length is already greater or equal to width } else { int padding_width = width - input.length(); diff --git a/common/util/trie_map.h b/common/util/trie_map.h index 8b4b02baed..19e67a21bb 100644 --- a/common/util/trie_map.h +++ b/common/util/trie_map.h @@ -38,7 +38,8 @@ class TrieMap { } // Retrieve elements with a given prefix - std::vector> retrieve_with_prefix(const std::string& prefix) const { + std::vector> retrieve_with_prefix(const std::string& prefix, + int max_count = -1) const { std::vector> result; std::shared_ptr node = root; // Traverse to the node representing the prefix @@ -49,7 +50,7 @@ class TrieMap { node = node->children[c]; } // Gather all elements stored at or below this node - retrieve_elements(node, result); + retrieve_elements(node, result, max_count); return result; } @@ -88,14 +89,18 @@ class TrieMap { private: // Recursive function to retrieve elements stored at or below the given node void retrieve_elements(std::shared_ptr node, - std::vector>& result) const { + std::vector>& result, + int max_count) const { // Add elements stored at this node to the result for (const auto& element : node->elements) { + if (max_count >= 0 && (int)result.size() >= max_count) { + return; + } result.push_back(element); } // Recursively traverse children for (const auto& child : node->children) { - retrieve_elements(child.second, result); + retrieve_elements(child.second, result, max_count); } } diff --git a/decompiler/analysis/find_skelgroups.cpp b/decompiler/analysis/find_skelgroups.cpp index 869374a8b4..9316c53b5d 100644 --- a/decompiler/analysis/find_skelgroups.cpp +++ b/decompiler/analysis/find_skelgroups.cpp @@ -570,7 +570,7 @@ void inspect_cloth_data_jak3(LetElement* let, DefskelgroupElement::StaticInfo& i auto array_set = dynamic_cast(when_body->at(0)); if (array_set) { // get elements - auto elts = when_body->elts().size() - 2; + auto elts = (int)when_body->elts().size() - 2; for (int i = 0; i < elts; i++) { auto parms_form = dynamic_cast(when_body->at(i + 1)); if (parms_form) { diff --git a/decompiler/data/streamed_audio.cpp b/decompiler/data/streamed_audio.cpp index 2b640325b6..81294cb560 100644 --- a/decompiler/data/streamed_audio.cpp +++ b/decompiler/data/streamed_audio.cpp @@ -38,9 +38,9 @@ struct AudioDir { int entry_count() const { return entries.size(); } void debug_print() const { - for (auto& e : entries) { - // lg::debug("\"{}\" 0x{:07x} - 0x{:07x}", e.name, e.start_byte, e.end_byte); - } + // for (auto& e : entries) { + // lg::debug("\"{}\" 0x{:07x} - 0x{:07x}", e.name, e.start_byte, e.end_byte); + // } } }; diff --git a/goal_src/jak3/engine/entity/entity.gc b/goal_src/jak3/engine/entity/entity.gc index 6a7fff7a2e..4ba0e9fc77 100644 --- a/goal_src/jak3/engine/entity/entity.gc +++ b/goal_src/jak3/engine/entity/entity.gc @@ -5,20 +5,6 @@ ;; name in dgo: entity ;; dgos: GAME -(defmethod birth bsp-header ((this bsp-header)) - (format #t "skipping birth for ~A~%" this) - (none) - ) - -(defun reset-actors ((arg0 symbol)) - (format #t "skipping reset-actors ~A~%" arg0) - (none) - ) - -(defun entity-by-name ((arg0 string)) - (the entity #f) - ) - ;; DECOMP BEGINS (define *spawn-actors* #t) @@ -1129,7 +1115,7 @@ (if (and (nonzero? (-> (the-as process-drawable arg0) draw)) *display-actor-vis*) (add-debug-sphere #t - (bucket-id bucket583) + (bucket-id debug) (-> (the-as process-drawable arg0) draw origin) (-> (the-as process-drawable arg0) draw bounds w) (new 'static 'rgba :r #x80 :a #x80) @@ -1362,7 +1348,7 @@ ) (add-debug-sphere #t - (bucket-id bucket583) + (bucket-id debug) (-> (the-as process-drawable s0-2) draw origin) (-> (the-as process-drawable s0-2) draw bounds w) (new 'static 'rgba :r #x80 :a #x80) diff --git a/goal_src/jak3/engine/scene/scene.gc b/goal_src/jak3/engine/scene/scene.gc index 837eff6109..e43b1987e3 100644 --- a/goal_src/jak3/engine/scene/scene.gc +++ b/goal_src/jak3/engine/scene/scene.gc @@ -5,13 +5,6 @@ ;; name in dgo: scene ;; dgos: GAME -;; TODO: remove this. just a stub so the game starts -(defmethod load-scene ((this scene)) - (format 0 "unsupported load-scene~%") - (format #t "unsupported load-scene~%") - this - ) - ;; DECOMP BEGINS (deftype scene-stage (process-hidden) diff --git a/goal_src/jak3/engine/target/gun/gun-red-shot.gc b/goal_src/jak3/engine/target/gun/gun-red-shot.gc index 962c1b30d8..db30608193 100644 --- a/goal_src/jak3/engine/target/gun/gun-red-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-red-shot.gc @@ -2533,7 +2533,7 @@ ) (add-debug-vector #t - (bucket-id bucket583) + (bucket-id debug) (-> self start-pos) (-> self start-dir) (meters 6) diff --git a/goalc/compiler/Compiler.h b/goalc/compiler/Compiler.h index a4e1c56db5..68fe0b3a48 100644 --- a/goalc/compiler/Compiler.h +++ b/goalc/compiler/Compiler.h @@ -101,7 +101,8 @@ class Compiler { const std::string& file_path) const; std::vector> lookup_symbol_info_by_prefix( const std::string& prefix) const; - std::set lookup_symbol_names_starting_with(const std::string& prefix) const; + std::set lookup_symbol_names_starting_with(const std::string& prefix, + int max_size) const; std::vector> lookup_exact_name_info( const std::string& name) const; std::optional lookup_typespec(const std::string& symbol_name); diff --git a/goalc/compiler/compilation/CompilerControl.cpp b/goalc/compiler/compilation/CompilerControl.cpp index d7517ac006..ff60546e44 100644 --- a/goalc/compiler/compilation/CompilerControl.cpp +++ b/goalc/compiler/compilation/CompilerControl.cpp @@ -443,7 +443,7 @@ replxx::Replxx::completions_t Compiler::find_symbols_or_object_file_by_prefix( // the syntax const auto [token, stripped_leading_paren] = m_repl->get_current_repl_token(context); // Otherwise, look for symbols - auto possible_forms = lookup_symbol_names_starting_with(token); + auto possible_forms = lookup_symbol_names_starting_with(token, 100); for (auto& x : possible_forms) { completions.push_back(stripped_leading_paren ? "(" + x : x); @@ -460,7 +460,7 @@ replxx::Replxx::hints_t Compiler::find_hints_by_prefix(std::string const& contex (void)contextLen; (void)user_data; auto token = m_repl->get_current_repl_token(context); - auto possible_forms = lookup_symbol_names_starting_with(token.first); + auto possible_forms = lookup_symbol_names_starting_with(token.first, 100); replxx::Replxx::hints_t hints; @@ -598,9 +598,10 @@ std::vector> Compiler::lookup_symbol_in return m_symbol_info.lookup_symbols_starting_with(prefix); } -std::set Compiler::lookup_symbol_names_starting_with(const std::string& prefix) const { +std::set Compiler::lookup_symbol_names_starting_with(const std::string& prefix, + int max_size) const { if (m_goos.reader.check_string_is_valid(prefix)) { - return m_symbol_info.lookup_names_starting_with(prefix); + return m_symbol_info.lookup_names_starting_with(prefix, max_size); } return {}; } diff --git a/goalc/compiler/symbol_info.cpp b/goalc/compiler/symbol_info.cpp index 3a6565a776..0f90467636 100644 --- a/goalc/compiler/symbol_info.cpp +++ b/goalc/compiler/symbol_info.cpp @@ -280,18 +280,20 @@ std::vector> SymbolInfoMap::lookup_exact_name( } std::vector> SymbolInfoMap::lookup_symbols_starting_with( - const std::string& prefix) const { + const std::string& prefix, + int max_count) const { std::vector> symbols; - const auto lookup = m_symbol_map.retrieve_with_prefix(prefix); + const auto lookup = m_symbol_map.retrieve_with_prefix(prefix, max_count); for (const auto& result : lookup) { symbols.push_back(result); } return symbols; } -std::set SymbolInfoMap::lookup_names_starting_with(const std::string& prefix) const { +std::set SymbolInfoMap::lookup_names_starting_with(const std::string& prefix, + int max_count) const { std::set names; - const auto lookup = m_symbol_map.retrieve_with_prefix(prefix); + const auto lookup = m_symbol_map.retrieve_with_prefix(prefix, max_count); for (const auto& result : lookup) { names.insert(result->m_name); } diff --git a/goalc/compiler/symbol_info.h b/goalc/compiler/symbol_info.h index 51eb3a9b92..5a8b45117b 100644 --- a/goalc/compiler/symbol_info.h +++ b/goalc/compiler/symbol_info.h @@ -159,9 +159,10 @@ class SymbolInfoMap { std::vector> lookup_symbols_by_file( const std::string& file_path) const; std::vector> lookup_exact_name(const std::string& name) const; - std::vector> lookup_symbols_starting_with( - const std::string& prefix) const; - std::set lookup_names_starting_with(const std::string& prefix) const; + std::vector> lookup_symbols_starting_with(const std::string& prefix, + int max_count = -1) const; + std::set lookup_names_starting_with(const std::string& prefix, + int max_count = -1) const; int symbol_count() const; std::vector> get_all_symbols() const; // Uses the per-file index to find and evict symbols globally