proper support for hardcoded "time" types (#1141)

* hardcode `time-frame`things

* Update cam-states_REF.gc

* Update level-info_REF.gc

* update refs 1

* update refs 2

* update refs 3

* update refs 4

* update refs 5

* update detection and casting

* Update FormExpressionAnalysis.cpp

* update refs 6

* update mood decomp

* update refs 7

* update refs 8

* remove temp entity birth code

* update time-frame casts

* fix compiler

* hardcode stuff and fix some types

* fix some bitfield detection being wrong

* bug fixes

* detect seconds on adds with immediate

* update refs 9

* fix casts and rand-vu-int-range bugs (update refs 10)

* update refs 11

* update 12

* update 13

* update 14

* Update game-info_REF.gc

* improve cpad macros detection

* remove unused code

* update refs

* clang

* update source code

* Update cam-states.gc

* `lavatube-energy` finish

* update refs

* fix actor bank stuff

* Update navigate.gc

* reduce entity default stack size

* Update transformq-h.gc

* oops forgot these

* fix code and tests

* fix mood sound stuff

* Update load-dgo.gc

* Update README.md
This commit is contained in:
ManDude
2022-02-12 17:26:19 +00:00
committed by GitHub
parent ad2278713c
commit 24578b64b9
444 changed files with 9293 additions and 10998 deletions
+5 -4
View File
@@ -6,6 +6,7 @@
#include "common/goos/PrettyPrinter.h"
#include "common/util/math_util.h"
#include "common/log/log.h"
#include "common/util/print_float.h"
#include "decompiler/ObjectFile/LinkedObjectFile.h"
#include "decompiler/IR2/Form.h"
#include "decompiler/analysis/final_output.h"
@@ -1056,7 +1057,7 @@ goos::Object decompile_value(const TypeSpec& type,
}
}
return pretty_print::to_symbol(fmt::format("(static-sound-name \"{}\")", name));
} else {
} else if (as_bitfield->get_name() != "time-frame") { // time-frame has a special case below
ASSERT((int)bytes.size() == as_bitfield->get_load_size());
ASSERT(bytes.size() <= 8);
u64 value = 0;
@@ -1104,7 +1105,7 @@ goos::Object decompile_value(const TypeSpec& type,
} else {
return pretty_print::to_symbol(fmt::format("{}", value));
}
} else if (type == TypeSpec("seconds")) {
} else if (type == TypeSpec("seconds") || type == TypeSpec("time-frame")) {
ASSERT(bytes.size() == 8);
s64 value;
memcpy(&value, bytes.data(), 8);
@@ -1116,7 +1117,7 @@ goos::Object decompile_value(const TypeSpec& type,
}
double seconds = (double)value / TICKS_PER_SECOND;
if (seconds * TICKS_PER_SECOND == value) {
return pretty_print::build_list("seconds", pretty_print::float_representation(seconds));
return pretty_print::to_symbol(fmt::format("(seconds {})", float_to_string(seconds, false)));
}
return pretty_print::to_symbol(fmt::format("#x{:x}", value));
} else if (ts.tc(TypeSpec("uint64"), type)) {
@@ -1143,7 +1144,7 @@ goos::Object decompile_value(const TypeSpec& type,
return rep;
// return pretty_print::build_list("the-as", "meters", rep);
} else {
return pretty_print::build_list("meters", rep);
return pretty_print::to_symbol(fmt::format("(meters {})", meters_to_string(value)));
}
} else if (type == TypeSpec("degrees")) {
ASSERT(bytes.size() == 4);