Jak 3, fixes for animation issues, rm debug print (#3453)

This commit is contained in:
water111
2024-04-06 15:09:02 -04:00
committed by GitHub
parent 23aeda1664
commit 376194a3e7
10 changed files with 30 additions and 18 deletions
+13 -4
View File
@@ -37,10 +37,13 @@ class TrieWithDuplicates {
return curr_node->elements.back().get();
}
std::vector<T*> retrieve_with_prefix(const std::string& prefix) const {
std::vector<T*> retrieve_with_prefix(const std::string& prefix, int max_count = -1) const {
std::vector<T*> results;
TrieNode* curr_node = root.get();
for (const char character : prefix) {
if (max_count >= 0 && (int)results.size() > max_count) {
return results;
}
const auto& child = curr_node->children.at((uint8_t)character);
if (child == nullptr) {
return results; // tree ends, nothing found with that prefix
@@ -48,7 +51,7 @@ class TrieWithDuplicates {
curr_node = child.get();
}
}
retrieve_elements(curr_node, results);
retrieve_elements(curr_node, results, max_count);
return results;
}
@@ -107,13 +110,19 @@ class TrieWithDuplicates {
}
private:
void retrieve_elements(const TrieNode* node, std::vector<T*>& results) const {
void retrieve_elements(const TrieNode* node, std::vector<T*>& results, int max_count = -1) const {
for (const auto& element : node->elements) {
if (max_count >= 0 && (int)results.size() > max_count) {
return;
}
results.push_back(element.get());
}
for (const auto& child : node->children) {
if (max_count >= 0 && (int)results.size() > max_count) {
return;
}
if (child.get() != nullptr) {
retrieve_elements(child.get(), results);
retrieve_elements(child.get(), results, max_count);
}
}
}
@@ -183,7 +183,6 @@ void Sprite3::glow_dma_and_draw(DmaFollower& dma,
ScopedProfilerNode& prof) {
auto maybe_consts_setup = dma.read_and_advance();
if (maybe_consts_setup.size_bytes != sizeof(SpriteGlowConsts)) {
fmt::print("no consts...\n");
return;
}
SpriteGlowConsts consts;
+1 -1
View File
@@ -1433,7 +1433,7 @@
(execute-math-engine)
)
; ;; cloth simulation update
;; cloth simulation update
(execute-cloth-engine)
(with-profiler 'debug *profile-debug-color*
@@ -346,8 +346,6 @@
(let ((s4-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
(when (!= s4-0 (-> s4-0 last))
(format 0 "hello init buf (~D)~%" arg0)
(let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf))
(s2-1 (-> s3-0 base))
)
+1 -1
View File
@@ -572,7 +572,7 @@ More efficient than the -old version."
;; og:preserve-this
; (.mula.s f0-1 f2-3)
; (.madd.s f0-2 f1-2 f3-1)
(+ (* f0-1 f2-3) (* f1-2 f3-1))
(set! f0-2 (+ (* f0-1 f2-3) (* f1-2 f3-1)))
)
f0-2
)
+2 -1
View File
@@ -101,7 +101,8 @@ class Compiler {
const std::string& file_path) const;
std::vector<symbol_info::SymbolInfo*> lookup_symbol_info_by_prefix(
const std::string& prefix) const;
std::set<std::string> lookup_symbol_names_starting_with(const std::string& prefix) const;
std::set<std::string> lookup_symbol_names_starting_with(const std::string& prefix,
int max_count = -1) const;
std::vector<symbol_info::SymbolInfo*> lookup_exact_name_info(const std::string& name) const;
std::optional<TypeSpec> lookup_typespec(const std::string& symbol_name);
TypeSystem& type_system() { return m_ts; };
@@ -442,7 +442,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);
@@ -459,7 +459,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;
@@ -597,9 +597,10 @@ std::vector<symbol_info::SymbolInfo*> Compiler::lookup_symbol_info_by_prefix(
return m_symbol_info.lookup_symbols_starting_with(prefix);
}
std::set<std::string> Compiler::lookup_symbol_names_starting_with(const std::string& prefix) const {
std::set<std::string> Compiler::lookup_symbol_names_starting_with(const std::string& prefix,
int max_count) 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_count);
}
return {};
}
+3 -2
View File
@@ -290,9 +290,10 @@ std::vector<SymbolInfo*> SymbolInfoMap::get_all_symbols() const {
return m_symbol_map.get_all_elements();
}
std::set<std::string> SymbolInfoMap::lookup_names_starting_with(const std::string& prefix) const {
std::set<std::string> SymbolInfoMap::lookup_names_starting_with(const std::string& prefix,
int max_count) const {
std::set<std::string> 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);
}
+2 -1
View File
@@ -159,7 +159,8 @@ class SymbolInfoMap {
std::vector<SymbolInfo*> lookup_symbols_by_file(const std::string& file_path) const;
std::vector<SymbolInfo*> lookup_exact_name(const std::string& name) const;
std::vector<SymbolInfo*> lookup_symbols_starting_with(const std::string& prefix) const;
std::set<std::string> lookup_names_starting_with(const std::string& prefix) const;
std::set<std::string> lookup_names_starting_with(const std::string& prefix,
int max_count = -1) const;
std::vector<SymbolInfo*> get_all_symbols() const;
int symbol_count() const;
// Uses the per-file index to find and evict symbols globally
+3 -1
View File
@@ -165,7 +165,9 @@ std::string Debugger::get_info_about_addr(u32 addr) {
if (map_loc.empty) {
return "Unknown Address";
}
std::string result = fmt::format("Object: {}\n", map_loc.obj_name);
std::string result = fmt::format("Object: {} {} (0x{:x} to 0x{:x}) offset 0x{:x}\n",
map_loc.obj_name, map_loc.seg_id, map_loc.start_addr,
map_loc.end_addr, addr - map_loc.start_addr);
u64 obj_offset = addr - map_loc.start_addr;
FunctionDebugInfo* info = nullptr;
std::string name;