decomp: finish _almost all of_ the remaining camera code (#845)

* decomp: mostly finish `cam-master`

* decomp/scripts: lots of work in cam-states

* stash

* Merge remote-tracking branch 'water111/master' into decomp/camera-master

Updated submodule third-party/googletest

* decompiler: Add support for non power of 2 offsets for inline arr access

* decomp: mostly finish `cam-states` need to fix a macro issue

* blocked: `cam-master` decompiler crash when adding casts

* decomp: finish `cam-states-dbg`

* decomp: mostly finish `pov-camera` with the exception of joint-related code

* decomp: `cam-debug` finished decompiling, no way does this compile yet though

* decomp: considerable work done in `cam-layout`

* decomp: `cam-layout` almost done!

* decomp: `pov-camera` finished, TC tests will fail for now

* decomp: working on resolving issues

* decomp: cam-layout decompiling

* fixing more issues in cam-master...one event handler remains

* skip problematic function in `cam-master` for now

* gsrc: update res macros

* decomp: finish `cam-states`

* decomp: giving up on `cam-debug`

* tests: allow skipping state handlers in ref tests

* decomp: working through cam-layout bugs

* decomp: allow for shifting non-integers

* decomp: finalize `cam-layout` and `cam-master`

* decomp: finalize `cam-states`

* cleanup: bi-annual formatting of the casting files

* formatting

* address feedback - leave the float labels alone for now

* address feedback

* linting/formatting

* update gsrc and ref tests

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
This commit is contained in:
Tyler Wilding
2021-10-16 21:01:23 -04:00
committed by GitHub
parent 993f348c93
commit 45318be063
57 changed files with 29413 additions and 3078 deletions
+10
View File
@@ -26,6 +26,16 @@
}
]
},
"(.*Flagged as asm.*)": {
"filterFileRegex": ".*ir2\\.asm",
"decorations": [
{
"overviewRulerColor": "yellow",
"color": "yellow",
"fontWeight": "bold"
}
]
},
"(INFO:.*)": {
"filterFileRegex": ".*ir2\\.asm",
"decorations": [
+7 -1
View File
@@ -3,7 +3,10 @@ version: '3'
tasks:
format:
cmds:
- python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test -i
- cmd: python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test -i
# npm install -g prettier
- cmd: prettier --write ./decompiler/config/jak1_ntsc_black_label/*.jsonc
ignore_error: true
run-game:
cmds:
- ./out/build/Debug/bin/gk.exe -fakeiso -debug -nodisplay
@@ -80,3 +83,6 @@ tasks:
- task: type-test
- task: offline-tests
- task: find-label-types
cast-repl:
cmds:
- cmd: python ./scripts/cast-repl.py
+35 -1
View File
@@ -4738,7 +4738,41 @@ void ArrayFieldAccess::update_with_val(Form* new_val,
auto deref = pool.alloc_element<DerefElement>(base, false, tokens);
result->push_back(deref);
} else {
throw std::runtime_error("Not power of two case, not yet implemented (no offset)");
auto mult_matcher = Matcher::op(
GenericOpMatcher::fixed(FixedOperatorKind::MULTIPLICATION),
{Matcher::match_or({Matcher::cast("uint", Matcher::integer(m_expected_stride)),
Matcher::integer(m_expected_stride)}),
Matcher::any(0)});
mult_matcher = Matcher::match_or(
{Matcher::cast("uint", mult_matcher), Matcher::cast("int", mult_matcher), mult_matcher});
auto op_match =
GenericOpMatcher::or_match({GenericOpMatcher::fixed(FixedOperatorKind::ADDITION),
GenericOpMatcher::fixed(FixedOperatorKind::ADDITION_PTR)});
auto add_matcher = Matcher::op(op_match, {Matcher::any(1), mult_matcher});
add_matcher =
Matcher::match_or({add_matcher, Matcher::op(op_match, {mult_matcher, Matcher::any(1)})});
auto mr = match(add_matcher, new_val);
if (!mr.matched) {
throw std::runtime_error("Failed to match non-power of two case: " +
new_val->to_string(env));
}
auto base = strip_int_or_uint_cast(mr.maps.forms.at(1));
auto idx = mr.maps.forms.at(0);
assert(idx && base);
std::vector<DerefToken> tokens = m_deref_tokens;
for (auto& x : tokens) {
if (x.kind() == DerefToken::Kind::EXPRESSION_PLACEHOLDER) {
x = DerefToken::make_int_expr(idx);
}
}
auto deref = pool.alloc_element<DerefElement>(base, false, tokens);
result->push_back(deref);
}
} else {
if (m_expected_stride == 1) {
+5 -3
View File
@@ -67,9 +67,11 @@ class ObjectFileDB {
bool print_hex);
void analyze_functions_ir1(const Config& config);
void analyze_functions_ir2(const std::string& output_dir,
const Config& config,
const std::unordered_set<std::string>& skip_functions);
void analyze_functions_ir2(
const std::string& output_dir,
const Config& config,
const std::unordered_set<std::string>& skip_functions,
const std::unordered_map<std::string, std::unordered_set<std::string>>& skip_states = {});
void ir2_top_level_pass(const Config& config);
void ir2_stack_spill_slot_pass(int seg, ObjectFileData& data);
void ir2_basic_block_pass(int seg, const Config& config, ObjectFileData& data);
+6 -4
View File
@@ -33,9 +33,11 @@ namespace decompiler {
* At this point, we assume that the files are loaded and we've run find_code to locate all
* functions, but nothing else.
*/
void ObjectFileDB::analyze_functions_ir2(const std::string& output_dir,
const Config& config,
const std::unordered_set<std::string>& skip_functions) {
void ObjectFileDB::analyze_functions_ir2(
const std::string& output_dir,
const Config& config,
const std::unordered_set<std::string>& skip_functions,
const std::unordered_map<std::string, std::unordered_set<std::string>>& skip_states) {
// First, do basic analysis on the top level:
lg::info("Using IR2 analysis...");
@@ -57,7 +59,7 @@ void ObjectFileDB::analyze_functions_ir2(const std::string& output_dir,
ir2_do_segment_analysis_phase2(TOP_LEVEL_SEGMENT, config, data);
try {
if (data.linked_data.functions_by_seg.size() == 3) {
run_defstate(data.linked_data.functions_by_seg.at(2).front());
run_defstate(data.linked_data.functions_by_seg.at(2).front(), skip_states);
}
} catch (const std::exception& e) {
lg::error("Failed to find defstates: {}", e.what());
+34 -16
View File
@@ -73,7 +73,8 @@ std::vector<DefstateElement::Entry> get_defstate_entries(
const RegisterAccess& let_dest_var,
const TypeSpec& state_type,
FormPool& pool,
const std::optional<std::string>& virtual_child = {}) {
const std::optional<std::string>& virtual_child = {},
const std::unordered_map<std::string, std::unordered_set<std::string>>& skip_states = {}) {
std::vector<DefstateElement::Entry> entries;
// next, all the handlers
@@ -151,15 +152,25 @@ std::vector<DefstateElement::Entry> get_defstate_entries(
pool.alloc_single_element_form<CastElement>(nullptr, expected_type, this_entry.val);
}
}
// name = code/event/etc
if (skip_states.count(state_name) > 0) {
if (skip_states.at(state_name).find(name) != skip_states.at(state_name).end()) {
env.func->warnings.general_warning("SKIP: skipping '{}' handler for state '{}'", name,
state_name);
continue;
}
}
entries.push_back(this_entry);
}
return entries;
}
FormElement* rewrite_nonvirtual_defstate(LetElement* elt,
const Env& env,
const std::string& expected_state_name,
FormPool& pool) {
FormElement* rewrite_nonvirtual_defstate(
LetElement* elt,
const Env& env,
const std::string& expected_state_name,
FormPool& pool,
const std::unordered_map<std::string, std::unordered_set<std::string>>& skip_states = {}) {
// first thing in the body should be something like:
// (set! teetertotter-idle (the-as (state none) v1-3))
assert(elt->body()->size() > 0);
@@ -178,8 +189,9 @@ FormElement* rewrite_nonvirtual_defstate(LetElement* elt,
}
body_index++;
auto entries = get_defstate_entries(elt->body(), body_index, env, info.first,
elt->entries().at(0).dest, info.second, pool);
auto entries =
get_defstate_entries(elt->body(), body_index, env, info.first, elt->entries().at(0).dest,
info.second, pool, {}, skip_states);
return pool.alloc_element<DefstateElement>(info.second.last_arg().base_type(), info.first,
entries, false);
@@ -238,10 +250,12 @@ std::string verify_empty_state_and_get_name(DecompiledDataElement* state, const
return name_word.symbol_name;
}
FormElement* rewrite_virtual_defstate(LetElement* elt,
const Env& env,
const std::string& expected_state_name,
FormPool& pool) {
FormElement* rewrite_virtual_defstate(
LetElement* elt,
const Env& env,
const std::string& expected_state_name,
FormPool& pool,
const std::unordered_map<std::string, std::unordered_set<std::string>>& skip_states = {}) {
assert(elt->body()->size() > 1);
// variable at the top of let, contains the static state with name exptected_state_name
auto state_var_from_let_def = elt->entries().at(0).dest;
@@ -399,7 +413,7 @@ FormElement* rewrite_virtual_defstate(LetElement* elt,
auto entries = get_defstate_entries(
elt->body(), body_idx + 1, env, expected_state_name, elt->entries().at(0).dest,
method_info.type.substitute_for_method_call(type_name), pool, type_name);
method_info.type.substitute_for_method_call(type_name), pool, type_name, skip_states);
return pool.alloc_element<DefstateElement>(type_name, expected_state_name, entries, true);
}
@@ -410,7 +424,9 @@ bool is_nonvirtual_state(LetElement* elt) {
} // namespace
void run_defstate(Function& top_level_func) {
void run_defstate(
Function& top_level_func,
const std::unordered_map<std::string, std::unordered_set<std::string>>& skip_states) {
auto& env = top_level_func.ir2.env;
auto& pool = *top_level_func.ir2.form_pool;
if (!top_level_func.ir2.top_form) {
@@ -439,12 +455,14 @@ void run_defstate(Function& top_level_func) {
}
if (is_nonvirtual_state(as_let)) {
auto rewritten = rewrite_nonvirtual_defstate(as_let, env, expected_state_name, pool);
auto rewritten =
rewrite_nonvirtual_defstate(as_let, env, expected_state_name, pool, skip_states);
if (rewritten) {
fe = rewritten;
}
} else {
auto rewritten = rewrite_virtual_defstate(as_let, env, expected_state_name, pool);
auto rewritten =
rewrite_virtual_defstate(as_let, env, expected_state_name, pool, skip_states);
if (rewritten) {
fe = rewritten;
}
@@ -454,4 +472,4 @@ void run_defstate(Function& top_level_func) {
}
});
}
} // namespace decompiler
} // namespace decompiler
+4 -2
View File
@@ -4,5 +4,7 @@
#include "decompiler/util/DecompilerTypeSystem.h"
namespace decompiler {
void run_defstate(Function& top_level_func);
}
void run_defstate(
Function& top_level_func,
const std::unordered_map<std::string, std::unordered_set<std::string>>& skip_states = {});
}
+2 -1
View File
@@ -35,7 +35,8 @@ bool try_convert_lambda(const Function& parent_function,
"ignored and is no longer required.",
lab.name);
}
if (!other_func->ir2.env.has_local_vars() || !other_func->ir2.top_form) {
if (!other_func->ir2.env.has_local_vars() || !other_func->ir2.top_form ||
!other_func->ir2.expressions_succeeded) {
// don't bother if we don't even have vars.
return false;
}
File diff suppressed because it is too large Load Diff
@@ -8,9 +8,7 @@
[32, "(function process symbol)"]
],
"hud": [
[10, "(function none :behavior hud)"]
],
"hud": [[10, "(function none :behavior hud)"]],
"main": [[4, "(function none :behavior process)"]],
@@ -512,7 +510,7 @@
[6, "(function process-drawable none)"],
[7, "(function none :behavior process-drawable)"],
[8, "(function object)"]
],
],
"default-menu": [
[3, "(function none)"],
@@ -574,7 +572,6 @@
[89, "(function debug-menu debug-menu symbol)"], // not 100% sure about the debug-menu, but it has a string at offset 0
[90, "(function debug-menu debug-menu symbol)"] // not 100% sure about the debug-menu, but it has a string at offset 0
],
"memory-usage": [
[3, "(function basic symbol)"],
[2, "(function process symbol)"]
@@ -585,22 +582,27 @@
[12, "(function none :behavior anim-tester)"],
[13, "(function none :behavior anim-tester)"]
],
"cam-combiner": [
[1, "(function none :behavior camera-combiner)"],
[2, "(function basic int basic event-message-block object :behavior camera-combiner)"]
[1, "(function none :behavior camera-combiner)"],
[
2,
"(function basic int basic event-message-block object :behavior camera-combiner)"
]
],
"title-obs": [
[0, "(function none)"]
],
"title-obs": [[0, "(function none)"]],
"title-obs": [[0, "(function none)"]],
"misty-warehouse": [
[3, "(function symbol none :behavior silostep)"],
[4, "(function none :behavior silostep)"],
[6, "(function none :behavior camera-tracker)"],
[7, "(function none :behavior silostep)"],
[8, "(function process int symbol event-message-block none :behavior silostep)"]
[
8,
"(function process int symbol event-message-block none :behavior silostep)"
]
],
"rigid-body": [
@@ -675,13 +677,9 @@
[12, "(function sparticle-system sparticle-cpuinfo none)"]
],
"basebutton": [
[1, "(function symbol :behavior target)"]
],
"basebutton": [[1, "(function symbol :behavior target)"]],
"entity": [
[10, "(function process-drawable none)"]
],
"entity": [[10, "(function process-drawable none)"]],
"beach-rocks": [
[2, "(function none :behavior beach-rock)"],
@@ -689,12 +687,13 @@
[4, "(function none :behavior beach-rock)"],
[5, "(function none :behavior beach-rock)"],
[6, "(function none :behavior beach-rock)"],
[7, "(function process int symbol event-message-block none :behavior beach-rock)"]
[
7,
"(function process int symbol event-message-block none :behavior beach-rock)"
]
],
"projectiles": [
[27, "(function projectile int)"]
],
"projectiles": [[27, "(function projectile int)"]],
"sidekick-human": [
[7, "(function sparticle-launch-control :behavior sequenceC)"],
@@ -702,9 +701,7 @@
[16, "(function sparticle-launch-control :behavior sequenceB)"]
],
"demo-obs": [
[1, "(function target)"]
],
"demo-obs": [[1, "(function target)"]],
"final-door": [
[11, "(function final-door symbol)"],
@@ -717,16 +714,32 @@
[6, "(function none :behavior plat-eco)"], // post
[7, "(function handle none :behavior plat-eco)"], // code
[8, "(function none :behavior plat-eco)"], // trans
[9, "(function process int symbol event-message-block object :behavior plat-eco)"], // event
[
9,
"(function process int symbol event-message-block object :behavior plat-eco)"
], // event
[10, "(function symbol :behavior plat-eco)"], // code
[11, "(function none :behavior plat-eco)"], // trans
[12, "(function int :behavior plat-eco)"], // enter
[13, "(function process int symbol event-message-block object :behavior plat-eco)"] // event
[
13,
"(function process int symbol event-message-block object :behavior plat-eco)"
] // event
],
"plat-flip": [
[1, "(function none :behavior plat-flip)"], // code
[2, "(function process int symbol event-message-block object :behavior plat-flip)"] // event
[
2,
"(function process int symbol event-message-block object :behavior plat-flip)"
] // event
],
"pov-camera": [
[
1,
"(function process int symbol event-message-block object :behavior pov-camera)"
]
],
"flying-lurker": [
@@ -736,12 +749,13 @@
],
"ambient": [
[29, "(function process int symbol event-message-block object :behavior level-hint)"]
[
29,
"(function process int symbol event-message-block object :behavior level-hint)"
]
],
"process-taskable": [
[46, "(function process-taskable symbol)"]
],
"process-taskable": [[46, "(function process-taskable symbol)"]],
"fishermans-boat": [
[5, "(function none :behavior fishermans-boat)"],
@@ -749,13 +763,9 @@
[29, "(function none :behavior fishermans-boat)"]
],
"muse": [
[3, "(function none :behavior muse)"]
],
"muse": [[3, "(function none :behavior muse)"]],
"relocate": [
[6, "(function sparticle-system sparticle-cpuinfo none)"]
],
"relocate": [[6, "(function sparticle-system sparticle-cpuinfo none)"]],
"fisher-JUN": [
[27, "(function none :behavior process)"],
@@ -275,12 +275,6 @@
// collide-shape-rider
"(method 35 collide-shape)",
// cam-master BUG
"master-is-hopeful-better?",
// cam-layout BUG
"cam-layout-save-cam-trans",
// process-drawable BUG
"cspace-inspect-tree", // BUG:
"process-drawable-birth-fuel-cell", // BUG:
@@ -366,7 +360,6 @@
"(anon-function 2 target-tube)",
"(anon-function 5 orbit-plat)",
"(anon-function 2 ogreboss)"
],
// these functions use pairs and the decompiler
@@ -449,20 +442,7 @@
// this one is all asm branches
"circle-circle-xz-intersect": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
],
"find-knot-span": [0, 1, 2, 3, 5, 6, 7, 8, 9],
@@ -489,19 +469,44 @@
"start-perf-stat-collection": [26],
"end-perf-stat-collection": [0],
"sprite-draw-distorters": [4, 5],
"draw-string":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189],
"get-string-length":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],
"unpack-comp-rle":[1, 3, 5, 6],
"(method 16 level)":[ 1, 5, 13, 14, 15, 19, 26, 53],
"unpack-comp-huf":[2, 4, 5, 6, 7, 8, 9],
"blerc-execute":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33],
"(method 11 fact-info-target)":[42],
"(anon-function 9 game-save)":[3, 4, 5, 6, 7, 8],
"draw-string": [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
185, 186, 187, 188, 189
],
"get-string-length": [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50
],
"unpack-comp-rle": [1, 3, 5, 6],
"(method 16 level)": [1, 5, 13, 14, 15, 19, 26, 53],
"unpack-comp-huf": [2, 4, 5, 6, 7, 8, 9],
"blerc-execute": [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33
],
"(method 11 fact-info-target)": [42],
"(anon-function 9 game-save)": [3, 4, 5, 6, 7, 8],
//"(anon-function 9 game-save)":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
"particle-adgif":[0, 1, 2, 3, 4, 5, 7],
"sp-launch-particles-var":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66],
"(method 11 sparticle-launch-control)": [ 27, 28, 35, 46, 48, 49, 77],
"upload-vis-bits":[0,1,2,3,4,5, 6]
"particle-adgif": [0, 1, 2, 3, 4, 5, 7],
"sp-launch-particles-var": [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64, 65, 66
],
"(method 11 sparticle-launch-control)": [27, 28, 35, 46, 48, 49, 77],
"upload-vis-bits": [0, 1, 2, 3, 4, 5, 6]
},
// Sometimes the game might use format strings that are fetched dynamically,
@@ -510,36 +515,24 @@
// e.g. "function-name":[[op, argc], [op, argc], ...]
// where "op" is the op number for the call to format.
"dynamic_format_arg_counts": {
"(method 35 progress)":[
"(method 35 progress)": [
[44, 1],
[92, 1]
],
"(method 49 progress)":[
[35, 1]
],
"(method 37 progress)":[
[41, 1]
],
"(method 38 progress)":[
[106, 1]
],
"(method 39 progress)":[
[41, 1]
],
"(method 41 progress)":[
[73, 1]
],
"(method 42 progress)":[
[41, 1]
],
"(method 43 progress)":[
"(method 49 progress)": [[35, 1]],
"(method 37 progress)": [[41, 1]],
"(method 38 progress)": [[106, 1]],
"(method 39 progress)": [[41, 1]],
"(method 41 progress)": [[73, 1]],
"(method 42 progress)": [[41, 1]],
"(method 43 progress)": [
[51, 1],
[94, 1]
],
"":[]
"": []
},
"mips2c_functions_by_name":[
"mips2c_functions_by_name": [
"sp-init-fields!",
"particle-adgif",
"sp-launch-particles-var",
@@ -555,5 +548,3 @@
"adgif-shader<-texture-with-update!"
]
}
@@ -262,8 +262,5 @@
//"audio_dir_file_name": "jak1/VAG",
"audio_dir_file_name": "",
"streamed_audio_file_names": [
"VAGWAD.ENG",
"VAGWAD.JAP"
]
"streamed_audio_file_names": ["VAGWAD.ENG", "VAGWAD.JAP"]
}
@@ -1,10 +1,9 @@
// the format is [label_name, type, special]
// the format is [label_name, type, special]
// if the type is pointer or inline array, special should be an integer size.
// if the type is a value type (like rgba), special should be true.
// if the type is pointer or inline array, special should be an integer size.
// if the type is a value type (like rgba), special should be true.
{
"vector-h": [
["L32", "vector"],
["L31", "vector"],
@@ -17,7 +16,6 @@
"quaternion-h": [["L1", "quaternion"]],
"quaternion": [
["L67", "vector"],
["L68", "vector"],
@@ -27,9 +25,7 @@
["L72", "vector"]
],
"geometry": [
["L112", "(pointer float)", 4]
],
"geometry": [["L112", "(pointer float)", 4]],
"trigonometry": [
["L98", "(pointer float)", 32],
@@ -46,13 +42,9 @@
["L17", "font-work"]
],
"display": [
["L76", "(pointer uint32)", 2]
],
"display": [["L76", "(pointer uint32)", 2]],
"capture": [
["L12", "gs-store-image-packet"]
],
"capture": [["L12", "gs-store-image-packet"]],
"main-h": [["L1", "frame-stats"]],
@@ -103,21 +95,13 @@
["L53", "vector"]
],
"sprite": [
["L58", "vu-function"]
],
"sprite": [["L58", "vu-function"]],
"sprite-distort": [
["L27", "vu-function"]
],
"sprite-distort": [["L27", "vu-function"]],
"merc-vu1": [
["L1", "vu-function"]
],
"merc-vu1": [["L1", "vu-function"]],
"background": [
["L51", "vu-function"]
],
"background": [["L51", "vu-function"]],
"debug": [
["L179", "vector2h"],
@@ -260,38 +244,24 @@
["L231", "(pointer uint64)", 1]
],
"progress-static": [
["L121", "(array game-text-id)"]
],
"progress-static": [["L121", "(array game-text-id)"]],
"rigid-body": [
["L89", "rigid-body-platform-constants"]
],
"rigid-body": [["L89", "rigid-body-platform-constants"]],
"nav-enemy": [
["L349", "attack-info"]
],
"nav-enemy": [["L349", "attack-info"]],
"basebutton": [
["L97", "vector"],
["L102", "vector"]
],
"bird-lady": [
["L29", "vector"]
],
"bird-lady": [["L29", "vector"]],
"bird-lady-beach": [
["L26", "vector"]
],
"bird-lady-beach": [["L26", "vector"]],
"mayor": [
["L57", "vector"]
],
"mayor": [["L57", "vector"]],
"sculptor": [
["L89", "vector"]
],
"sculptor": [["L89", "vector"]],
"oracle": [
["L55", "vector"],
@@ -304,34 +274,22 @@
["L30", "vector"]
],
"explorer": [
["L77", "vector"]
],
"explorer": [["L77", "vector"]],
"sage": [
["L91", "vector"]
],
"sage": [["L91", "vector"]],
"misty-teetertotter": [
["L26", "attack-info"],
["L27", "attack-info"]
],
"farmer": [
["L28", "vector"]
],
"farmer": [["L28", "vector"]],
"gambler": [
["L52", "vector"]
],
"gambler": [["L52", "vector"]],
"warrior": [
["L30", "vector"]
],
"warrior": [["L30", "vector"]],
"geologist": [
["L38", "vector"]
],
"geologist": [["L38", "vector"]],
"font": [
["L95", "(inline-array vector)", 250],
@@ -376,9 +334,7 @@
"shadow-cpu": [["L122", "shadow-data"]],
"load-boundary": [
["L327", "(inline-array lbvtx)", 3]
],
"load-boundary": [["L327", "(inline-array lbvtx)", 3]],
"default-menu": [
["L6251", "float", true],
@@ -419,9 +375,7 @@
// ["L14", "gif-tag-regs", true]
// ],
"merc-blend-shape": [
["L62", "(pointer int16)", 32]
],
"merc-blend-shape": [["L62", "(pointer int16)", 32]],
"miners": [
["L111", "vector"],
@@ -443,9 +397,7 @@
["L471", "vector4w"]
],
"assistant": [
["L71", "vector"]
],
"assistant": [["L71", "vector"]],
"progress": [
["L667", "uint64", true],
@@ -530,13 +482,9 @@
["L341", "uint64", true]
],
"projectiles": [
["L150", "attack-info"]
],
"projectiles": [["L150", "attack-info"]],
"generic-obs": [
["L455", "quaternion"]
],
"generic-obs": [["L455", "quaternion"]],
"blocking-plane": [
["L18", "vector"],
@@ -561,25 +509,15 @@
["L994", "uint64", true]
],
"assistant-firecanyon": [
["L71", "vector"]
],
"assistant-firecanyon": [["L71", "vector"]],
"sage-bluehut": [
["L82", "vector"]
],
"sage-bluehut": [["L82", "vector"]],
"flutflut-bluehut": [
["L34", "vector"]
],
"flutflut-bluehut": [["L34", "vector"]],
"sharkey": [
["L101", "attack-info"]
],
"sharkey": [["L101", "attack-info"]],
"assistant-citadel": [
["L28", "vector"]
],
"assistant-citadel": [["L28", "vector"]],
"robotboss-h": [
["L67", "float", true],
@@ -612,25 +550,242 @@
["L323", "vector2h"]
],
"hint-control": [
["L45", "(array task-hint-control-group)"]
"hint-control": [["L45", "(array task-hint-control-group)"]],
"cam-master": [
["L356", "vector"],
["L357", "vector"]
],
"sparticle-launcher": [
["L192", "adgif-shader"]
"cam-states": [
["L630", "vector"],
["L631", "vector"],
["L632", "vector"],
["L633", "vector"],
["L672", "float", true],
["L673", "float", true],
["L674", "float", true],
["L675", "float", true],
["L676", "float", true],
["L677", "float", true],
["L678", "float", true],
["L679", "float", true],
["L680", "float", true],
["L681", "float", true],
["L682", "float", true],
["L683", "float", true],
["L684", "float", true],
["L685", "float", true],
["L686", "float", true],
["L687", "float", true],
["L688", "float", true],
["L689", "float", true],
["L690", "float", true],
["L691", "float", true],
["L692", "float", true],
["L693", "float", true],
["L694", "float", true],
["L695", "float", true],
["L696", "float", true],
["L697", "float", true],
["L698", "float", true],
["L699", "float", true],
["L700", "float", true],
["L701", "float", true],
["L702", "float", true],
["L703", "float", true],
["L704", "float", true],
["L705", "float", true],
["L706", "float", true],
["L707", "float", true],
["L708", "float", true],
["L709", "float", true],
["L710", "float", true],
["L711", "float", true],
["L712", "float", true],
["L713", "float", true],
["L714", "float", true],
["L715", "float", true],
["L716", "float", true],
["L717", "float", true],
["L718", "float", true],
["L719", "float", true],
["L720", "float", true],
["L721", "float", true],
["L722", "float", true],
["L723", "float", true],
["L724", "float", true],
["L725", "float", true],
["L726", "float", true],
["L727", "float", true],
["L728", "float", true],
["L729", "float", true],
["L730", "float", true],
["L731", "float", true],
["L732", "float", true],
["L733", "float", true],
["L734", "float", true],
["L735", "float", true],
["L736", "float", true],
["L737", "float", true],
["L738", "float", true],
["L739", "float", true],
["L740", "float", true],
["L741", "float", true],
["L742", "float", true],
["L743", "float", true],
["L744", "float", true],
["L745", "float", true],
["L790", "uint64", true],
["L791", "uint64", true],
["L792", "uint64", true],
["L793", "uint64", true]
],
"process-taskable": [
["L251", "attack-info"]
"cam-states-dbg": [["L78", "camera-orbit-info"]],
"cam-layout": [
["L766", "quaternion"],
["L768", "vector"],
["L775", "vector4w"],
["L777", "vector4w"],
["L779", "vector4w"],
["L781", "vector4w"],
["L783", "vector4w"],
["L785", "vector4w"],
["L787", "vector4w"],
["L788", "vector4w"],
["L789", "vector4w"],
["L790", "vector4w"],
["L791", "vector"],
["L792", "vector"],
["L793", "vector4w"],
["L794", "vector"],
["L795", "vector4w"],
["L796", "vector"],
["L797", "vector"],
["L798", "vector4w"],
["L799", "vector"],
["L800", "vector4w"],
["L801", "vector"],
["L802", "vector"],
["L803", "vector4w"],
["L804", "vector"],
["L805", "vector"],
["L806", "vector4w"],
["L807", "vector4w"],
["L808", "vector"],
["L809", "vector"],
["L810", "vector4w"],
["L811", "vector4w"],
["L812", "vector"],
["L813", "vector"],
["L814", "vector4w"],
["L815", "vector"],
["L816", "vector"],
["L817", "vector4w"],
["L818", "vector"],
["L819", "vector"],
["L820", "vector4w"],
["L821", "vector"],
["L822", "vector"],
["L823", "vector"],
["L824", "vector"],
["L832", "vector4w"],
["L872", "float", true],
["L873", "float", true],
["L874", "(pointer float)", 1],
["L875", "(pointer float)", 1],
["L876", "float", true],
["L877", "float", true],
["L878", "float", true],
["L879", "float", true],
["L880", "float", true],
["L881", "(pointer float)", 1],
["L882", "float", true],
["L883", "float", true],
["L884", "(pointer float)", 1],
["L885", "(pointer float)", 1],
["L886", "float", true],
["L887", "float", true],
["L888", "(pointer float)", 1],
["L889", "(pointer float)", 1],
["L890", "(pointer float)", 1],
["L891", "(pointer float)", 1],
["L892", "(pointer float)", 1],
["L893", "float", true],
["L894", "float", true],
["L895", "float", true],
["L896", "(pointer float)", 1],
["L897", "(pointer float)", 1],
["L898", "(pointer float)", 1],
["L899", "float", true],
["L900", "(pointer float)", 1],
["L901", "uint64", true],
["L904", "uint64", true],
["L905", "uint64", true],
["L906", "uint64", true],
["L907", "uint64", true],
["L908", "uint64", true],
["L909", "uint64", true],
["L910", "uint64", true]
],
"babak-with-cannon": [
["L92", "vector"]
"cam-debug": [
["L174", "rgba", true],
["L175", "rgba", true],
["L176", "rgba", true],
["L177", "rgba", true],
["L178", "rgba", true],
["L209", "rgba", true],
["L210", "rgba", true],
["L211", "rgba", true],
["L212", "rgba", true],
["L213", "rgba", true],
["L214", "rgba", true],
["L215", "rgba", true],
["L216", "rgba", true],
["L217", "rgba", true],
["L218", "rgba", true],
["L219", "rgba", true],
["L220", "rgba", true],
["L221", "rgba", true],
["L222", "rgba", true],
["L223", "rgba", true],
["L224", "rgba", true],
["L225", "rgba", true],
["L226", "rgba", true],
["L227", "rgba", true],
["L228", "rgba", true],
["L229", "rgba", true],
["L230", "rgba", true],
["L231", "rgba", true],
["L232", "rgba", true],
["L233", "rgba", true],
["L234", "rgba", true],
["L239", "rgba", true],
["L240", "rgba", true],
["L241", "rgba", true],
["L242", "rgba", true],
["L243", "vector"],
["L244", "vector"],
["L245", "rgba", true],
["L246", "vector"],
["L247", "vector"],
["L254", "vector"],
["L255", "vector"],
["L256", "vector"],
["L257", "vector"],
["L263", "rgba", true]
],
"flutflut": [
["L94", "vector"]
],
"sparticle-launcher": [["L192", "adgif-shader"]],
"process-taskable": [["L251", "attack-info"]],
"babak-with-cannon": [["L92", "vector"]],
"flutflut": [["L94", "vector"]],
"fishermans-boat": [
["L210", "vector"],
@@ -643,9 +798,7 @@
["L434", "rigid-body-platform-constants"]
],
"training-obs": [
["L175", "rigid-body-platform-constants"]
],
"training-obs": [["L175", "rigid-body-platform-constants"]],
"bonelurker": [
["L72", "attack-info"],
@@ -663,13 +816,9 @@
["L268", "vector"]
],
"citb-plat": [
["L155", "rigid-body-platform-constants"]
],
"citb-plat": [["L155", "rigid-body-platform-constants"]],
"qbert-plat": [
["L99", "rigid-body-platform-constants"]
],
"qbert-plat": [["L99", "rigid-body-platform-constants"]],
"misty-conveyor": [
["L60", "vector"],
@@ -691,25 +840,15 @@
["L46", "vector"]
],
"gnawer": [
["L216", "(inline-array gnawer-segment-info)", 10]
],
"gnawer": [["L216", "(inline-array gnawer-segment-info)", 10]],
"target-tube": [
["L142", "vector"]
],
"target-tube": [["L142", "vector"]],
"assistant-village3": [
["L43", "vector"]
],
"assistant-village3": [["L43", "vector"]],
"sage-village3": [
["L74", "vector"]
],
"sage-village3": [["L74", "vector"]],
"target-snowball": [
["L23", "vector"]
],
"target-snowball": [["L23", "vector"]],
"ice-cube": [
["L212", "attack-info"],
@@ -717,9 +856,7 @@
["L215", "attack-info"]
],
"assistant-lavatube": [
["L30", "vector"]
],
"assistant-lavatube": [["L30", "vector"]],
"citadel-part": [
["L235", "float", true],
@@ -737,13 +874,9 @@
["L245", "uint64", true]
],
"sunken-part": [
["L220", "uint64", true]
],
"sunken-part": [["L220", "uint64", true]],
"ogre-part": [
["L93", "uint64", true]
],
"ogre-part": [["L93", "uint64", true]],
"collectables-part": [
["L309", "float", true],
@@ -765,13 +898,9 @@
["L233", "uint64", true]
],
"village3-part": [
["L244", "uint64", true]
],
"village3-part": [["L244", "uint64", true]],
"lavatube-part": [
["L110", "uint64", true]
],
"lavatube-part": [["L110", "uint64", true]],
"hud-classes": [
["L279", "vector"],
@@ -799,9 +928,7 @@
["L733", "uint64", true]
],
"sky": [
["L13", "vu-function"]
],
"sky": [["L13", "vu-function"]],
"sky-tng": [
["L82", "sky-work"],
@@ -826,9 +953,7 @@
["L314", "float", true]
],
"seagull": [
["L226", "(inline-array air-box)", 20]
],
"seagull": [["L226", "(inline-array air-box)", 20]],
"rolling-race-ring": [
["L94", "vector"],
@@ -840,9 +965,7 @@
["L100", "vector"]
],
"part-tester": [
["L32", "uint64", true]
],
"part-tester": [["L32", "uint64", true]],
"anim-tester": [
["L509", "(inline-array list-field)", 12],
@@ -885,9 +1008,7 @@
["L145", "vector"]
],
"robotboss-misc": [
["L99", "vector"]
],
"robotboss-misc": [["L99", "vector"]],
"robotboss": [
["L646", "attack-info"],
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -3128,225 +3128,241 @@
},
"add-debug-outline-triangle": {
"args":["enable", "bucket", "p0", "p1", "p2", "color"]
"args": ["enable", "bucket", "p0", "p1", "p2", "color"]
},
"unpack-comp-rle": {
"args":["out", "in"],
"vars":{
"v1-2":"current-input",
"a2-0":"repeated-value",
"v1-3":"copy-length",
"a2-1":"src-val"
"args": ["out", "in"],
"vars": {
"v1-2": "current-input",
"a2-0": "repeated-value",
"v1-3": "copy-length",
"a2-1": "src-val"
}
},
"(method 16 level)": {
"args":["obj", "vis-info"],
"vars":{
"a0-1":"cam-leaf-idx",
"v1-1":"curr-vis-str",
"s4-0":"desired-vis-str",
"s4-1":"vis-buffer",
"s3-1":"vis-load-result",
"v1-28":"dest-bits",
"a1-3":"len",
"a0-19":"bsp-bits",
"a1-5":"len-qw",
"s2-0":"lower-flag-bits",
"s1-0":"spad-start",
"s0-0":"spad-end",
"s3-2":"list-len",
"v1-49":"list-qwc",
"v0-1":"result"
"args": ["obj", "vis-info"],
"vars": {
"a0-1": "cam-leaf-idx",
"v1-1": "curr-vis-str",
"s4-0": "desired-vis-str",
"s4-1": "vis-buffer",
"s3-1": "vis-load-result",
"v1-28": "dest-bits",
"a1-3": "len",
"a0-19": "bsp-bits",
"a1-5": "len-qw",
"s2-0": "lower-flag-bits",
"s1-0": "spad-start",
"s0-0": "spad-end",
"s3-2": "list-len",
"v1-49": "list-qwc",
"v0-1": "result"
}
},
"(method 9 merc-fragment)": {
"vars":{
"s5-0":"fp-data",
"s4-0":"eye-ctrl",
"s3-0":"shader",
"v1-7":"eye-tex-block",
"v1-34":"eye-tex-block-2",
"v1-57":"tex",
"a0-36":"seg"
"vars": {
"s5-0": "fp-data",
"s4-0": "eye-ctrl",
"s3-0": "shader",
"v1-7": "eye-tex-block",
"v1-34": "eye-tex-block-2",
"v1-57": "tex",
"a0-36": "seg"
}
},
"(method 9 merc-effect)": {
"vars":{
"v1-0":"data",
"v1-1":"tex",
"a0-8":"seg",
"s3-0":"frag-idx",
"s2-0":"ctrl-size",
"s1-0":"geo-size",
"s4-0":["geo", "merc-fragment"],
"s5-0":["ctrl", "merc-fragment-control"]
"vars": {
"v1-0": "data",
"v1-1": "tex",
"a0-8": "seg",
"s3-0": "frag-idx",
"s2-0": "ctrl-size",
"s1-0": "geo-size",
"s4-0": ["geo", "merc-fragment"],
"s5-0": ["ctrl", "merc-fragment-control"]
}
},
"merc-vu1-add-vu-function": {
"args":["dma", "func", "flush-mode"],
"args": ["dma", "func", "flush-mode"],
"vars": {
"v1-0":"func-data",
"a3-0":"qwc",
"a1-1":"dst",
"t0-1":"qwc-this-time"
"v1-0": "func-data",
"a3-0": "qwc",
"a1-1": "dst",
"t0-1": "qwc-this-time"
}
},
"(method 8 merc-ctrl)": {
"vars": {
"s4-0":"ctrl-mem",
"s3-0":"effect-idx",
"s2-0":["fctrl", "merc-fragment-control"],
"s1-0":"frag-idx",
"v1-35":"effect-mem",
"a0-15":"effect-idx2",
"a1-9":["bctrl", "merc-blend-ctrl"],
"a2-1":"blend-frag-idx"
"s4-0": "ctrl-mem",
"s3-0": "effect-idx",
"s2-0": ["fctrl", "merc-fragment-control"],
"s1-0": "frag-idx",
"v1-35": "effect-mem",
"a0-15": "effect-idx2",
"a1-9": ["bctrl", "merc-blend-ctrl"],
"a2-1": "blend-frag-idx"
}
},
"(method 9 merc-ctrl)": {
"vars":{
"v1-3":"seg",
"s5-0":"effect-idx",
"a0-4":"idx-with-bit1",
"a0-7":"this-effect",
"a1-5":"last-effect",
"a2-6":"copy-idx"
"vars": {
"v1-3": "seg",
"s5-0": "effect-idx",
"a0-4": "idx-with-bit1",
"a0-7": "this-effect",
"a1-5": "last-effect",
"a2-6": "copy-idx"
}
},
"merc-vu1-init-buffer": {
"args":["dma-bucket", "test"],
"args": ["dma-bucket", "test"],
"vars": {
"gp-0":"bucket",
"s4-0":"dma-buf"
"gp-0": "bucket",
"s4-0": "dma-buf"
}
},
"(method 9 screen-filter)": {
"vars": {
"v1-4":["v1-4", "dma-packet"],
"s5-0":"buf"
"v1-4": ["v1-4", "dma-packet"],
"s5-0": "buf"
}
},
"(method 11 fact-info-target)": {
"args":["obj", "kind", "amount", "source-handle"],
"vars":{"f0-29":"buzz-count","f30-0":"eco-lev"}
"args": ["obj", "kind", "amount", "source-handle"],
"vars": { "f0-29": "buzz-count", "f30-0": "eco-lev" }
},
"auto-save-init-by-other": {
"args":["desired-mode", "notify-proc", "card-idx", "file-idx"]
"args": ["desired-mode", "notify-proc", "card-idx", "file-idx"]
},
"debug-menu-item-var-make-int": {
"args":["item", "callback", "inc", "has-range", "range-min", "range-max", "hex"]
"args": [
"item",
"callback",
"inc",
"has-range",
"range-min",
"range-max",
"hex"
]
},
"debug-menu-item-var-make-float": {
"args":["item", "callback", "inc", "has-range", "range-min", "range-max", "precision"]
"args": [
"item",
"callback",
"inc",
"has-range",
"range-min",
"range-max",
"precision"
]
},
"(method 0 debug-menu-item-var)": {
"args":["allocation", "type-to-make", "name", "id", "max-width"]
"args": ["allocation", "type-to-make", "name", "id", "max-width"]
},
"debug-menu-context-grab-joypad": {
"args":["menu", "callback-arg", "callback-func"]
"args": ["menu", "callback-arg", "callback-func"]
},
"debug-menu-context-default-selection": {
"args": ["ctxt", "keep-current"],
"vars": {
"s5-0":"menu",
"s4-0":"currently-active"
"s5-0": "menu",
"s4-0": "currently-active"
}
},
"debug-menu-rebuild": {
"args":["menu"],
"args": ["menu"],
"vars": {
"s4-0":"max-width",
"s5-0":"entry-count",
"s3-0":"iter",
"a0-1":"current-item"
"s4-0": "max-width",
"s5-0": "entry-count",
"s3-0": "iter",
"a0-1": "current-item"
}
},
"debug-menu-context-set-root-menu":{
"args":["context", "menu"],
"vars":{
"s4-0":"active"
"debug-menu-context-set-root-menu": {
"args": ["context", "menu"],
"vars": {
"s4-0": "active"
}
},
"debug-menu-append-item": {
"args":["menu", "item"],
"args": ["menu", "item"],
"vars": {
"gp-0":"context",
"s4-0":"was-active"
"gp-0": "context",
"s4-0": "was-active"
}
},
"(anon-function 82 default-menu)": {
"vars":{"s4-0":["s4-0", "texture-id"]}
"vars": { "s4-0": ["s4-0", "texture-id"] }
},
"process-status-bits": {
"vars":{"s3-0":["proc-draw", "process-drawable"]}
"vars": { "s3-0": ["proc-draw", "process-drawable"] }
},
"(method 29 entity-actor)":{
"args":["obj", "mode", "expected-type"]
"(method 29 entity-actor)": {
"args": ["obj", "mode", "expected-type"]
},
"(method 13 level-group)":{
"args":["obj", "mode", "expected-type"]
"(method 13 level-group)": {
"args": ["obj", "mode", "expected-type"]
},
"(method 24 entity)": {
"args":["obj", "lev-group", "lev", "aid"],
"vars":{
"v1-4":"level-link",
"t0-5":"other-prev",
"t1-1":"other-front"
"args": ["obj", "lev-group", "lev", "aid"],
"vars": {
"v1-4": "level-link",
"t0-5": "other-prev",
"t1-1": "other-front"
}
},
"update-actor-vis-box": {
"args":["proc", "min-pt", "max-pt"],
"vars":{"v1-4":"world-bounds-origin", "f0-0":"radius"}
"args": ["proc", "min-pt", "max-pt"],
"vars": { "v1-4": "world-bounds-origin", "f0-0": "radius" }
},
"init-entity": {
"args":["proc", "ent"]
"args": ["proc", "ent"]
},
"(method 22 entity-actor)": {
"vars":{
"s5-0":"entity-type",
"v1-0":"info",
"s4-0":"entity-process"
"vars": {
"s5-0": "entity-type",
"v1-0": "info",
"s4-0": "entity-process"
}
},
"(method 18 bsp-header)": {
"vars":{
"a2-0":"existing-actor-count",
"s4-0":"birth-idx",
"a0-4":"idx-to-birth",
"v1-25":"actor-to-birth",
"a2-5":"existing-amb-count",
"s4-1":"amb-array",
"s3-0":"bsp-ambs",
"a0-10":"amb-to-birth",
"s4-2":"cams"
"vars": {
"a2-0": "existing-actor-count",
"s4-0": "birth-idx",
"a0-4": "idx-to-birth",
"v1-25": "actor-to-birth",
"a2-5": "existing-amb-count",
"s4-1": "amb-array",
"s3-0": "bsp-ambs",
"a0-10": "amb-to-birth",
"s4-2": "cams"
}
},
@@ -3401,12 +3417,12 @@
"calculate-completion": {
"args": ["the-progress"],
"vars": {
"sv-40":"total-cells",
"sv-48":"total-buzzers",
"sv-56":"total-orbs",
"sv-16":"current-cells",
"sv-24":"current-buzzers",
"sv-32":"current-orbs"
"sv-40": "total-cells",
"sv-48": "total-buzzers",
"sv-56": "total-orbs",
"sv-16": "current-cells",
"sv-24": "current-buzzers",
"sv-32": "current-orbs"
}
},
@@ -3461,6 +3477,37 @@
}
},
"master-track-target": {
"vars": {
"v0-1": ["v0-1", "symbol"],
"v1-14": ["v1-14", "handle"]
}
},
"cam-los-spline-collide": {
"vars": {
"s3-0": ["s3-0", "(inline-array collide-cache-tri)"]
}
},
"cam-draw-collide-cache": {
"vars": {
"gp-0": ["gp-0", "(inline-array collide-cache-tri)"]
}
},
"cam-los-collide": {
"vars": {
"s1-1": ["s1-1", "(inline-array collide-cache-tri)"]
}
},
"(event cam-master-active)": {
"vars": {
// "v0-0": ["v0-0", "symbol"]
}
},
"(code plunger-lurker-plunge)": {
"vars": {
"gp-1": ["gp-1", "handle"],
@@ -3512,10 +3559,10 @@
"upload-vis-bits": {
"vars": {
"v1-2":"qwc",
"a0-1":["lev-vis-bits", "(pointer uint128)"],
"a1-1":["all-vis", "(pointer uint128)"],
"a2-2":["spad-vis", "(pointer uint128)"]
"v1-2": "qwc",
"a0-1": ["lev-vis-bits", "(pointer uint128)"],
"a1-1": ["all-vis", "(pointer uint128)"],
"a2-2": ["spad-vis", "(pointer uint128)"]
}
},
@@ -3531,8 +3578,8 @@
}
},
"(method 9 load-dir-art-group)":{
"args":["obj", "art-name", "do-reload", "heap", "version"]
"(method 9 load-dir-art-group)": {
"args": ["obj", "art-name", "do-reload", "heap", "version"]
},
"(method 15 hud-money)": {
+3 -2
View File
@@ -509,8 +509,9 @@ goos::Object decompile_structure(const TypeSpec& type,
// want to get the specific function/string/etc implementations.
return decompile_at_label(actual_type, label, labels, words, ts, file);
} else {
throw std::runtime_error(fmt::format("Basic has the wrong type pointer, got {} expected {}",
word.symbol_name, actual_type.base_type()));
throw std::runtime_error(
fmt::format("Basic has the wrong type pointer, got {} expected {} at label {}:{}",
word.symbol_name, actual_type.base_type(), label.name, label.offset));
}
}
}
+27 -4
View File
@@ -5,6 +5,33 @@
;; name in dgo: cam-debug-h
;; dgos: GAME, ENGINE
;; TODO - for cam-layout
(define-extern camera-line-setup (function vector none))
(define-extern camera-line-draw (function vector vector symbol))
(define-extern camera-line (function vector vector vector4w none))
(define-extern camera-cross (function vector vector vector vector float basic))
(define-extern camera-fov-frame (function matrix vector float float float vector none))
(define-extern cam-slave-options->string (function uint string string))
(define-extern cam-index-options->string (function uint string string))
(define-extern debug-set-camera-pos-rot! (function vector matrix vector))
(define-extern camera-slave-debug (function camera-slave object object object object)) ;; passed to engine::method-15
;; TODO - for cam-states
(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none))
(define-extern cam-collision-record-save (function vector vector int basic camera-slave none))
(define-extern slave-los-state->string (function uint string)) ;; uint comes from 2244 camera-slave
(define-extern cam-debug-reset-coll-tri (function none)) ;; not confirmed
(declare-type clm basic)
(define-extern *clm* clm) ;; unknown type
(define-extern *clm-edit* clm)
(define-extern *clm-focalpull-attr* clm) ;; unknown type
(define-extern *clm-index-attr* clm) ;; unknown type
(define-extern *clm-intro-attr* clm) ;; unknown type
(define-extern *clm-spline-attr* clm) ;; unknown type
(define-extern *clm-vol-attr* clm) ;; unknown type
(define-extern *clm-select* clm) ;; unknown type
;; decomp begins
;; this file is debug only
(when *debug-segment*
@@ -97,8 +124,4 @@
)
(define-perm *cam-layout* symbol #f)
(defun-extern debug-set-camera-pos-rot! vector matrix int)
)
(define-extern camera-line (function vector vector vector none))
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+46 -32
View File
@@ -6,6 +6,7 @@
;; dgos: GAME, ENGINE
;; definition for function cam-stop
;; INFO: Return type mismatch (state camera-slave) vs state.
(defun cam-stop ()
(kill-by-name 'camera-master *active-pool*)
(kill-by-name 'camera-slave *active-pool*)
@@ -14,7 +15,7 @@
(set! *camera-combiner* #f)
(let ((v0-3 cam-string))
(set! *camera-base-mode* v0-3)
v0-3
(the-as state v0-3)
)
)
@@ -23,45 +24,58 @@
(defun cam-start ((arg0 symbol))
(cam-stop)
(let ((s5-0 (get-process *camera-dead-pool* camera-combiner #x4000)))
(when s5-0
(let ((t9-2 (method-of-type camera-combiner activate)))
(t9-2
(the-as camera-combiner s5-0)
*camera-pool*
'camera-combiner
(the-as pointer #x70004000)
)
)
(run-now-in-process s5-0 cam-combiner-init)
(-> s5-0 ppointer)
(when s5-0
(let ((t9-2 (method-of-type camera-combiner activate)))
(t9-2
(the-as camera-combiner s5-0)
*camera-pool*
'camera-combiner
(the-as pointer #x70004000)
)
)
(run-now-in-process s5-0 cam-combiner-init)
(-> s5-0 ppointer)
)
)
(let ((s5-1 (get-process *camera-master-dead-pool* camera-master #x4000)))
(set! *camera*
(the-as camera-master
(ppointer->process
(when s5-1
(let ((t9-5 (method-of-type camera-master activate)))
(t9-5 (the-as camera-master s5-1)
*camera-pool*
'camera-master
(the-as pointer #x70004000)
)
)
(run-next-time-in-process s5-1 cam-master-init)
(-> s5-1 ppointer)
)
)
)
)
(set! *camera* (the-as camera-master (ppointer->process (when s5-1
(let
((t9-5
(method-of-type
camera-master
activate
)
)
)
(t9-5
(the-as
camera-master
s5-1
)
*camera-pool*
'camera-master
(the-as
pointer
#x70004000
)
)
)
(run-next-time-in-process
s5-1
cam-master-init
)
(-> s5-1 ppointer)
)
)
)
)
)
(if arg0
(reset-cameras)
)
(reset-cameras)
)
0
(none)
)
;; failed to figure out what this is:
;; TODO - causes a crash in the tests!
; (cam-start #f)
+907 -2
View File
@@ -5,5 +5,910 @@
;; name in dgo: cam-states-dbg
;; dgos: GAME, ENGINE
;; TODO - for anim-tester
(define-extern cam-orbit state)
;; DECOMP BEGINS
(deftype cam-point-watch-bank (basic)
((speed float :offset-assert 4)
(rot-speed degrees :offset-assert 8)
)
:method-count-assert 9
:size-assert #xc
:flag-assert #x90000000c
)
(define
*CAM_POINT_WATCH-bank*
(new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6))
)
(defstate cam-point-watch (camera-slave)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('teleport)
#f
)
(else
(cam-standard-event-handler arg0 arg1 arg2 arg3)
)
)
)
:enter
(behavior ()
(when (not (-> self enter-has-run))
(set! (-> self pivot-rad) 40960.0)
(set! (-> self blend-from-type) (the-as uint 1))
(set! (-> self blend-to-type) (the-as uint 1))
)
(none)
)
:code
(behavior ()
(while #t
(let ((s5-0 (new-stack-vector0))
(gp-0 (new-stack-vector0))
)
(when *camera-read-analog*
(let
((f28-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 leftx))
128.0
48.0
110.0
-1.0
)
)
(f30-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 lefty))
128.0
48.0
110.0
-1.0
)
)
(f26-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 rightx))
128.0
48.0
110.0
-1.0
)
)
(f0-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 righty))
128.0
48.0
110.0
-1.0
)
)
)
(cond
((logtest?
(-> *cpad-list* cpads (-> *CAMERA-bank* joypad) button0-abs 0)
(pad-buttons r2)
)
(set!
(-> s5-0 y)
(-
(-> s5-0 y)
(* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0))
)
)
(set!
(-> s5-0 x)
(- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))
)
(+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0))
(+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0))
)
(else
(set!
(-> s5-0 y)
(-
(-> s5-0 y)
(* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0))
)
)
(set!
(-> s5-0 x)
(- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))
)
(+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0))
(+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0))
)
)
)
(let ((s4-0 (new-stack-vector0)))
(let ((s3-0 (new-stack-matrix0)))
(matrix-axis-angle!
s3-0
(the-as vector (-> self tracking))
(- (-> s5-0 x))
)
(vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0)
(matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y)))
(vector-matrix*! s4-0 s4-0 s3-0)
)
(forward-down->inv-matrix
(the-as matrix (-> self tracking))
s4-0
(-> *camera* local-down)
)
)
(set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z)))
(if (< (-> self pivot-rad) 4096.0)
(set! (-> self pivot-rad) 4096.0)
)
(set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0)
(vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking)))
)
)
(suspend)
0
)
(none)
)
)
(deftype cam-free-bank (basic)
((speed float :offset-assert 4)
(rot-speed degrees :offset-assert 8)
)
:method-count-assert 9
:size-assert #xc
:flag-assert #x90000000c
)
(define
*CAM_FREE-bank*
(new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6))
)
(defun
cam-free-floating-input
((arg0 vector) (arg1 vector) (arg2 symbol) (arg3 int))
(when (and (!= *master-mode* 'menu) (not *cam-layout*))
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons x))
(set!
(-> arg0 x)
(-
(-> arg0 x)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 6))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
)
(when *camera-read-buttons*
(if
(logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons triangle))
(+!
(-> arg0 x)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 4))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
(when *camera-read-buttons*
(if
(logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons square))
(+!
(-> arg0 y)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 7))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
(when *camera-read-buttons*
(if
(logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons circle))
(set!
(-> arg0 y)
(-
(-> arg0 y)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 5))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
)
)
(when arg2
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2))
(+!
(-> arg0 z)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 10))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2))
(set!
(-> arg0 z)
(-
(-> arg0 z)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 11))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
)
)
(cond
((not *cam-free-move-along-z*)
)
((not *camera-read-analog*)
)
((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2))
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r1))
(+!
(-> arg1 y)
(+
(* 0.2 (-> *CAM_FREE-bank* speed))
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 9))
0.0
32.0
230.0
(* 0.2 (-> *CAM_FREE-bank* speed))
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l1))
(set!
(-> arg1 y)
(-
(-> arg1 y)
(+
(* 0.2 (-> *CAM_FREE-bank* speed))
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 8))
0.0
32.0
230.0
(* 0.2 (-> *CAM_FREE-bank* speed))
)
)
)
)
)
)
)
(else
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r1))
(+!
(-> arg1 y)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 9))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l1))
(set!
(-> arg1 y)
(-
(-> arg1 y)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 8))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
)
)
)
(when (and (!= *master-mode* 'menu) (not *cam-layout*))
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons left))
(+!
(-> arg1 x)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 1))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons right))
(set!
(-> arg1 x)
(-
(-> arg1 x)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 0))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons up))
(+!
(-> arg1 z)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 2))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons down))
(set!
(-> arg1 z)
(-
(-> arg1 z)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 3))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
)
)
(when *camera-read-analog*
(let
((f28-14
(analog-input
(the-as int (-> *cpad-list* cpads arg3 leftx))
128.0
48.0
110.0
-1.0
)
)
(f30-14
(analog-input
(the-as int (-> *cpad-list* cpads arg3 lefty))
128.0
48.0
110.0
-1.0
)
)
(f24-0
(analog-input
(the-as int (-> *cpad-list* cpads arg3 rightx))
128.0
48.0
110.0
-1.0
)
)
(f26-0
(analog-input
(the-as int (-> *cpad-list* cpads arg3 righty))
128.0
48.0
110.0
-1.0
)
)
)
(when *display-load-boundaries*
(when
(and
(!= arg3 1)
(zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x)))
(zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r1)))
(zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2)))
)
(+!
f28-14
(analog-input
(the-as int (-> *cpad-list* cpads 1 leftx))
128.0
48.0
110.0
-1.0
)
)
(+!
f30-14
(analog-input
(the-as int (-> *cpad-list* cpads 1 lefty))
128.0
48.0
110.0
-1.0
)
)
(+!
f24-0
(analog-input
(the-as int (-> *cpad-list* cpads 1 rightx))
128.0
48.0
110.0
-1.0
)
)
(+!
f26-0
(analog-input
(the-as int (-> *cpad-list* cpads 1 righty))
128.0
48.0
110.0
-1.0
)
)
)
)
(cond
((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2))
(cond
((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2))
(set!
(-> arg0 y)
(- (-> arg0 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f24-0)))
)
(set!
(-> arg0 x)
(- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))
)
)
(else
(set!
(-> arg0 y)
(- (-> arg0 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed)))
)
(set!
(-> arg0 x)
(- (-> arg0 x) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed)))
)
)
)
(+! (-> arg1 x) (* 0.2 (-> *CAM_FREE-bank* speed) f28-14))
(+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14))
)
((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2))
(+! (-> arg1 x) (* f28-14 (-> *CAM_FREE-bank* speed)))
(+! (-> arg1 y) (* f26-0 (-> *CAM_FREE-bank* speed)))
(+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed)))
)
(else
(set!
(-> arg0 y)
(- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0)))
)
(set!
(-> arg0 x)
(- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))
)
(+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14))
(+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14))
)
)
)
)
(vector-float*! arg0 arg0 (-> *display* time-adjust-ratio))
(vector-float*! arg1 arg1 (-> *display* time-adjust-ratio))
)
(deftype camera-free-floating-move-info (structure)
((rv vector :inline :offset-assert 0)
(tv vector :inline :offset-assert 16)
(up vector :inline :offset-assert 32)
(tm matrix :inline :offset-assert 48)
)
:method-count-assert 9
:size-assert #x70
:flag-assert #x900000070
)
(defun
cam-free-floating-move
((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int))
(if (logtest? (-> *cpad-list* cpads arg3 valid) 128)
(return (the-as vector #f))
)
(if (= *master-mode* 'menu)
(return (the-as vector #f))
)
(let ((s3-0 (new 'stack 'camera-free-floating-move-info)))
(cam-free-floating-input (-> s3-0 rv) (-> s3-0 tv) (not arg2) arg3)
(cond
(arg2
(matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y))
(matrix*! arg0 arg0 (-> s3-0 tm))
(cond
((< (vector-dot (-> arg0 vector 1) arg2) 0.0)
(forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2)
)
(else
(vector-negate! (-> s3-0 up) arg2)
(forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up))
)
)
)
(else
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y)))
(matrix*! arg0 arg0 (-> s3-0 tm))
)
)
(matrix-axis-angle!
(-> s3-0 tm)
(the-as vector (-> arg0 vector))
(- (-> s3-0 rv x))
)
(matrix*! arg0 arg0 (-> s3-0 tm))
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z)))
(matrix*! arg0 arg0 (-> s3-0 tm))
(vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0)
(vector+! arg1 arg1 (-> s3-0 tv))
)
)
(defstate cam-free-floating (camera-slave)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('teleport)
#f
)
(else
(cam-standard-event-handler arg0 arg1 arg2 arg3)
)
)
)
:enter
(behavior ()
(when (not (-> self enter-has-run))
(set! (-> self blend-from-type) (the-as uint 1))
(set! (-> self blend-to-type) (the-as uint 1))
(send-event *camera-combiner* 'stop-tracking)
)
(none)
)
:code
(behavior ()
(while #t
(let ((a2-0 (-> *camera* local-down)))
(if (logtest? (-> self options) 8)
(set! a2-0 (the-as vector #f))
)
(cam-free-floating-move
(the-as matrix (-> self tracking))
(-> self trans)
a2-0
(the-as int (-> *CAMERA-bank* joypad))
)
)
(suspend)
)
(none)
)
)
(deftype camera-orbit-info (structure)
((radius float :offset-assert 0)
(rot float :offset-assert 4)
(target-off vector :inline :offset-assert 16)
(orbit-off vector :inline :offset-assert 32)
(radius-lerp float :offset-assert 48)
)
:method-count-assert 9
:size-assert #x34
:flag-assert #x900000034
)
(deftype CAM_ORBIT-bank (basic)
((RADIUS_MAX float :offset-assert 4)
(RADIUS_MIN float :offset-assert 8)
(TARGET_OFF_ADJUST float :offset-assert 12)
(ORBIT_OFF_ADJUST float :offset-assert 16)
)
:method-count-assert 9
:size-assert #x14
:flag-assert #x900000014
)
(define
*CAM_ORBIT-bank*
(new 'static 'CAM_ORBIT-bank
:RADIUS_MAX 61440.0
:RADIUS_MIN 409.6
:TARGET_OFF_ADJUST 81.92
:ORBIT_OFF_ADJUST 81.92
)
)
(define *camera-orbit-info* (new 'static 'camera-orbit-info))
(set! (-> *camera-orbit-info* radius-lerp) 0.45)
(set! (-> *camera-orbit-info* target-off y) 4096.0)
(set! (-> *camera-orbit-info* orbit-off y) 4096.0)
(defstate cam-orbit (camera-slave)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('teleport)
#f
)
(else
(cam-standard-event-handler arg0 arg1 arg2 arg3)
)
)
)
:enter
(behavior ()
(when (not (-> self enter-has-run))
(if (not *camera-orbit-target*)
(cam-slave-go cam-free-floating)
)
(let ((v1-4 (new-stack-vector0)))
(vector-! v1-4 (-> self trans) (-> *camera-orbit-target* 0 root trans))
(set! (-> *camera-orbit-info* rot) (atan (-> v1-4 x) (-> v1-4 z)))
)
(set! (-> self blend-from-type) (the-as uint 1))
(set! (-> self blend-to-type) (the-as uint 1))
)
(none)
)
:exit
(behavior ()
'()
(none)
)
:code
(behavior ()
(while #t
(if (not *camera-orbit-target*)
(cam-slave-go cam-free-floating)
)
(when *camera-read-analog*
(let
((f0-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 righty))
128.0
32.0
110.0
0.05
)
)
)
(cond
((< (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) f0-0)
(+!
(-> *camera-orbit-info* radius-lerp)
(* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp)))
)
)
((< f0-0 (* 0.05 (- (-> *camera-orbit-info* radius-lerp))))
(+!
(-> *camera-orbit-info* radius-lerp)
(* 0.05 (- (-> *camera-orbit-info* radius-lerp)))
)
)
(else
(+! (-> *camera-orbit-info* radius-lerp) f0-0)
)
)
)
(set!
(-> *camera-orbit-info* radius)
(lerp
(-> *CAM_ORBIT-bank* RADIUS_MIN)
(-> *CAM_ORBIT-bank* RADIUS_MAX)
(-> *camera-orbit-info* radius-lerp)
)
)
)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2))
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1))
(set!
(-> *camera-orbit-info* target-off y)
(-
(-> *camera-orbit-info* target-off y)
(-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST)
)
)
)
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(+!
(-> *camera-orbit-info* target-off y)
(-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST)
)
)
)
(else
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1))
(set!
(-> *camera-orbit-info* orbit-off y)
(-
(-> *camera-orbit-info* orbit-off y)
(-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST)
)
)
)
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(+!
(-> *camera-orbit-info* orbit-off y)
(-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST)
)
)
)
)
(when *camera-read-analog*
(let
((f0-20
(analog-input
(the-as int (-> *cpad-list* cpads 0 rightx))
128.0
32.0
110.0
(* 21845.334 (-> *display* seconds-per-frame))
)
)
)
(set!
(-> *camera-orbit-info* rot)
(the
float
(sar (shl (the int (+ (-> *camera-orbit-info* rot) f0-20)) 48) 48)
)
)
)
)
(let ((gp-0 (new-stack-vector0)))
(let ((s5-0 (new-stack-vector0)))
(set-vector!
(-> self trans)
(+
(-> *camera-orbit-target* 0 root trans x)
(* (sin (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius))
)
(-> *camera-orbit-target* 0 root trans y)
(+
(-> *camera-orbit-target* 0 root trans z)
(* (cos (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius))
)
1.0
)
(vector+!
(-> self trans)
(-> self trans)
(-> *camera-orbit-info* orbit-off)
)
(vector+!
(-> self tracking follow-pt)
(-> *camera-orbit-target* 0 root trans)
(-> *camera-orbit-info* target-off)
)
(vector-! s5-0 (-> self trans) (-> self tracking follow-pt))
(set!
(-> gp-0 y)
(the
float
(sar (shl (the int (+ 32768.0 (atan (-> s5-0 x) (-> s5-0 z)))) 48) 48)
)
)
(set! (-> gp-0 x) (atan (-> s5-0 y) (vector-xz-length s5-0)))
)
(set! (-> gp-0 z) 0.0)
(matrix-rotate-zxy! (the-as matrix (-> self tracking)) gp-0)
)
(suspend)
)
(none)
)
)
File diff suppressed because it is too large Load Diff
+38 -27
View File
@@ -5,6 +5,34 @@
;; name in dgo: camera-h
;; dgos: GAME, ENGINE
;; TODO - for cam-layout
(define-extern v-slrp2! (function vector vector vector float vector float vector))
(define-extern v-slrp3! (function vector vector vector vector float vector))
(declare-type camera-slave process)
(declare-type camera-master process)
(declare-type tracking-point structure)
(declare-type cam-rotation-tracker structure)
(declare-type camera-combiner process)
;; TODO - for cam-master
(define-extern cam-eye (state camera-slave))
;; TODO - for camera
(define-extern cam-circular (state camera-slave))
(define-extern cam-standoff-read-entity (state camera-slave))
(define-extern cam-spline (state camera-slave))
(define-extern *camera-base-mode* state)
(define-extern cam-fixed-read-entity (state camera-slave))
(define-extern camera-line-rel-len (function tracking-point vector float rgba none))
(define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector))
(define-extern slave-set-rotation! (function cam-rotation-tracker vector float float symbol none))
;; TODO - for cam-combiner
(define-extern cam-combiner-active (state camera-combiner))
(define-extern paused? (function symbol))
;; TODO - for cam-start
(define-extern cam-master-init (function none :behavior camera-master))
;; decomp begins
;; definition of type camera-bank
(deftype camera-bank (basic)
((collide-move-rad float :offset-assert 4)
@@ -77,7 +105,7 @@
;; definition of type tracking-spline
(deftype tracking-spline (structure)
((point tracking-point 32 :inline :offset-assert 0)
((point tracking-point 32 :inline :offset-assert 0)
(summed-len float :offset-assert 1536)
(free-point int32 :offset-assert 1540)
(used-point int32 :offset-assert 1544)
@@ -98,8 +126,8 @@
(:methods
(TODO-RENAME-9 (_type_) none 9)
(TODO-RENAME-10 (_type_ vector) none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(print-nth-point (_type_ int) none 11)
(TODO-RENAME-12 (_type_) none 12)
(TODO-RENAME-13 (_type_ int) none 13)
(TODO-RENAME-14 (_type_ vector) none 14)
(TODO-RENAME-15 (_type_) none 15)
@@ -110,7 +138,7 @@
(TODO-RENAME-20 (_type_ vector int) none 20)
(TODO-RENAME-21 (_type_ vector float float) vector 21)
(TODO-RENAME-22 (_type_ float) none 22)
(dummy-23 () none 23)
(TODO-RENAME-23 (_type_) none 23)
)
)
@@ -377,7 +405,7 @@
(slave-options uint32 :offset-assert 128)
(view-off-param-save float :offset-assert 132)
(changer uint32 :offset-assert 136)
(cam-entity entity :offset-assert 140) ; not totally confirmed yet
(cam-entity entity :offset-assert 140) ; not totally confirmed yet
(stringMinLength float :offset-assert 144)
(stringMaxLength float :offset-assert 148)
(stringMinHeight float :offset-assert 152)
@@ -390,15 +418,15 @@
(force-blend uint32 :offset-assert 296)
(force-blend-time uint32 :offset-assert 300)
(local-down vector :inline :offset-assert 304)
(drawable-target uint64 :offset-assert 320)
(drawable-target handle :offset-assert 320) ; likely a `target`?
(which-bone int32 :offset-assert 328)
(pov-handle uint64 :offset-assert 336)
(pov-handle handle :offset-assert 336)
(pov-bone int32 :offset-assert 344)
(being-attacked basic :offset-assert 348)
(being-attacked symbol :offset-assert 348)
(attack-start uint64 :offset-assert 352)
(on-ground basic :offset-assert 360)
(on-ground symbol :offset-assert 360)
(under-water int32 :offset-assert 364)
(on-pole basic :offset-assert 368)
(on-pole symbol :offset-assert 368)
(tgt-rot-mat matrix :inline :offset-assert 384)
(tgt-face-mat matrix :inline :offset-assert 448)
(tpos-old vector :inline :offset-assert 512)
@@ -431,20 +459,3 @@
:flag-assert #xe09000964
;; inherited inspect of process
)
;; TODO - for camera
(define-extern cam-circular state)
(define-extern cam-standoff-read-entity state)
(define-extern cam-spline state)
(define-extern *camera-base-mode* state)
(define-extern cam-fixed-read-entity state)
(define-extern camera-line-rel-len (function tracking-point vector float rgba none))
(define-extern camera-slave-debug (function object object object object object)) ;; passed to engine::method-15
(define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector))
(define-extern slave-set-rotation! (function cam-rotation-tracker vector float float symbol none))
;; TODO - for cam-combiner
(define-extern cam-combiner-active (state camera-combiner))
(define-extern paused? (function symbol))
;; TODO - for cam-start
(define-extern cam-master-init (function none :behavior camera-master))
(define-extern v-slrp3! (function vector vector vector vector float vector))
+11 -16
View File
@@ -200,7 +200,7 @@
)
)
(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 quaternion))
(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 matrix))
(let ((s4-0 (method-of-type res-lump get-property-struct))
(s3-0 arg0)
)
@@ -223,11 +223,11 @@
(let ((s4-1 (new 'stack-no-clear 'quaternion)))
(quaternion*! s4-1 (the-as quaternion a1-3) (-> arg0 quat))
(quaternion-normalize! s4-1)
(quaternion->matrix (the-as matrix arg1) s4-1)
(quaternion->matrix arg1 s4-1)
)
)
(else
(quaternion->matrix (the-as matrix arg1) (-> arg0 quat))
(quaternion->matrix arg1 (-> arg0 quat))
)
)
)
@@ -797,16 +797,16 @@
(< f0-4 1.0)
)
(set! (-> arg2 partial-pt) f0-4)
(let ((s5-0 (new 'stack-no-clear 'vector)))
(let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler)))
(let ((a2-5 (-> obj point (-> arg2 cur-pt) next)))
(vector-lerp!
s5-0
(the-as vector s5-0)
(the-as vector (-> obj point (-> arg2 cur-pt)))
(the-as vector (-> obj point a2-5))
f0-4
)
)
(vector+! arg1 arg1 s5-0)
(vector+! arg1 arg1 (the-as vector s5-0))
)
(return arg1)
)
@@ -1856,12 +1856,11 @@
)
)
)
; ;; definition for function slave-set-rotation!
; ;; INFO: Return type mismatch int vs none.
; ;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3]
; ;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4]
; ;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
; ;; Used lq/sq
;; TODO - fix me!
;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4]
;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
; (defun
; slave-set-rotation!
; ((arg0 cam-rotation-tracker)
@@ -2007,13 +2006,11 @@
; )
; )
; ;; definition for function v-slrp2!
; ;; WARN: Stack slot offset 144 signed mismatch
; ;; WARN: Stack slot offset 144 signed mismatch
; ;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3]
; ;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4]
; ;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
; ;; Used lq/sq
; (defun
; v-slrp2!
; ((arg0 vector)
@@ -2128,13 +2125,11 @@
; arg0
; )
; ;; definition for function v-slrp3!
; ;; WARN: Stack slot offset 144 signed mismatch
; ;; WARN: Stack slot offset 144 signed mismatch
; ;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3]
; ;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4]
; ;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
; ;; Used lq/sq
; (defun
; v-slrp3!
; ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float))
+14 -13
View File
@@ -6,11 +6,12 @@
;; dgos: GAME, ENGINE
(deftype pov-camera (process-drawable)
((flags int32 :offset-assert 176)
((cspace-array cspace-array :offset 112)
(flags int32 :offset-assert 176)
(debounce-start-time uint64 :offset-assert 184)
(notify-handle uint64 :offset-assert 192)
(anim-name basic :offset-assert 200)
(command-list basic :offset-assert 204)
(notify-handle handle :offset-assert 192)
(anim-name string :offset-assert 200)
(command-list pair :offset-assert 204) ;; not a basic atleast!
(mask-to-clear uint32 :offset-assert 208)
(music-volume-movie float :offset-assert 212)
(sfx-volume-movie float :offset-assert 216)
@@ -20,15 +21,15 @@
:size-assert #xdc
:flag-assert #x1e007000dc
(:methods
(dummy-20 () none 20)
(dummy-21 () none 21)
(pov-camera-playing () none 22) ;; state
(dummy-23 () none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(pov-camera-abort () _type_ :state 20)
(pov-camera-done-playing () _type_ :state 21)
(pov-camera-playing () _type_ :state 22) ;; state
(pov-camera-start-playing () _type_ :state 23) ;; state
(pov-camera-startup () _type_ :state 24) ;; state
(TODO-RENAME-25 (_type_) symbol 25)
(target-grabbed? (_type_) symbol 26)
(dummy-27 () none 27)
(dummy-28 () none 28)
(target-released? () symbol 28)
(dummy-29 () none 29)
)
)
)
+413 -2
View File
@@ -5,5 +5,416 @@
;; name in dgo: pov-camera
;; dgos: GAME, ENGINE
;; TODO - for sunken-elevator
(define-extern pov-camera-init-by-other (function vector skeleton-group string int symbol pair none)) ;; TODO - not confirmed -- sunken-elevator
;; DECOMP BEGINS
(defmethod TODO-RENAME-25 pov-camera ((obj pov-camera))
(when
(or
(and
(>=
(-
(-> *display* base-frame-counter)
(the-as int (-> obj debounce-start-time))
)
60
)
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
)
(logtest? (-> obj flags) 2)
)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(when (logtest? (-> obj flags) 1)
(send-event (handle->process (-> obj notify-handle)) 'notify 'abort-request)
#t
)
)
)
(defmethod target-grabbed? pov-camera ((obj pov-camera))
(or (not *target*) (process-grab? *target*))
)
(defmethod target-released? pov-camera ()
(or (not *target*) (process-release? *target*))
)
(defstate pov-camera-startup (pov-camera)
:virtual #t
:code
(behavior ()
(go-virtual pov-camera-start-playing)
(none)
)
)
(defstate pov-camera-start-playing (pov-camera)
:virtual #t
:code
(behavior ()
(logclear! (-> self mask) (process-mask actor-pause))
(while (not (target-grabbed? self))
(suspend)
)
(let ((gp-0 0))
(let ((v1-7 (dummy-10 (-> self draw jgeo) "camera" (the-as type #f))))
(if v1-7
(set! gp-0 (+ (-> v1-7 number) 1))
)
)
(let* ((s5-0 (get-process *default-dead-pool* othercam #x4000))
(v1-10 (when s5-0
(let ((t9-3 (method-of-type othercam activate)))
(t9-3
(the-as othercam s5-0)
self
'othercam
(the-as pointer #x70004000)
)
)
(run-now-in-process
s5-0
othercam-init-by-other
self
gp-0
#t
#t
)
(-> s5-0 ppointer)
)
)
)
(send-event (ppointer->process v1-10) 'mask (-> self mask-to-clear))
)
)
(go-virtual pov-camera-playing)
(none)
)
)
(defbehavior
pov-camera-play-and-reposition pov-camera
((arg0 joint-anim-compressed) (arg1 vector) (arg2 float))
(let ((s4-0 #f))
(let ((v1-2 (-> self skel root-channel 0)))
(set! (-> v1-2 frame-group) (the-as art-joint-anim arg0))
(set! (-> v1-2 param 0) (the float (+ (-> arg0 data 9 unknown-half) -1)))
(set! (-> v1-2 param 1) arg2)
(set! (-> v1-2 frame-num) 0.0)
(joint-control-channel-group!
v1-2
(the-as art-joint-anim arg0)
num-func-seek!
)
)
(until (ja-done? 0)
(let
((v1-4
(and
(not s4-0)
(< (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-4
)
)
(ja-frame-num 0)
)
)
)
)
(when v1-4
(set! s4-0 #t)
(send-event *camera* 'teleport-to-vector-start-string arg1)
)
)
(suspend)
(let ((a0-4 (-> self skel root-channel 0)))
(set!
(-> a0-4 param 0)
(the float (+ (-> a0-4 frame-group data 0 length) -1))
)
(set! (-> a0-4 param 1) arg2)
(joint-control-channel-group-eval!
a0-4
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
0
(none)
)
(defstate pov-camera-playing (pov-camera)
:virtual #t
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (when (= v1-0 'abort)
(when (logtest? (-> self flags) 1)
(logior! (-> self flags) 2)
(if (= (-> self anim-name type) string)
(go-virtual pov-camera-abort)
)
)
)
)
)
)
:enter
(behavior ()
(set!
(-> self debounce-start-time)
(the-as uint (-> *display* base-frame-counter))
)
(if (= (-> self anim-name type) string)
(backup-load-state-and-set-cmds *load-state* (-> self command-list))
)
(none)
)
:exit
(behavior ()
(if (= (-> self anim-name type) string)
(restore-load-state-and-cleanup *load-state*)
)
(clear-pending-settings-from-process *setting-control* self 'music-volume)
(clear-pending-settings-from-process *setting-control* self 'sfx-volume)
(none)
)
:code
(behavior ()
(push-setting!
*setting-control*
self
'music-volume
'rel
(-> self music-volume-movie)
0
)
(push-setting!
*setting-control*
self
'sfx-volume
'rel
(-> self sfx-volume-movie)
0
)
(cond
((= (-> self anim-name type) string)
(let ((a0-4 (-> self skel root-channel 0)))
(set! (-> a0-4 frame-group) (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
)
(set!
(-> a0-4 param 0)
(the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
)
(set! (-> a0-4 param 1) 1.0)
(set! (-> a0-4 frame-num) 0.0)
(joint-control-channel-group!
a0-4
(if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
num-func-seek!
)
)
(until (ja-done? 0)
(TODO-RENAME-25 self)
(suspend)
(let ((a0-6 (-> self skel root-channel 0)))
(set!
(-> a0-6 param 0)
(the float (+ (-> a0-6 frame-group data 0 length) -1))
)
(set! (-> a0-6 param 1) 1.0)
(joint-control-channel-group-eval!
a0-6
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
((= (-> self anim-name type) spool-anim)
(ja-play-spooled-anim
(the-as spool-anim (-> self anim-name))
(the-as art-joint-anim #f)
(the-as art-joint-anim #f)
(method-of-object self TODO-RENAME-25)
)
)
)
(go-virtual pov-camera-done-playing)
(none)
)
:post
(behavior ()
(if (= (-> self anim-name type) string)
(execute-commands-up-to *load-state* (ja-aframe-num 0))
)
(ja-post)
(none)
)
)
(defstate pov-camera-abort (pov-camera)
:virtual #t
:enter
(behavior ()
(logior! (-> self flags) 2)
(none)
)
:code
(behavior ()
(set-blackout-frames 10)
(suspend)
(suspend)
(go-virtual pov-camera-done-playing)
(none)
)
)
(defstate pov-camera-done-playing (pov-camera)
:virtual #t
:code
(behavior ()
(while (begin
self
(not ((method-of-object self target-released?)))
)
(suspend)
)
(send-event (handle->process (-> self notify-handle)) 'notify 'die)
(suspend)
(suspend)
(dummy-18 self)
(deactivate self)
(none)
)
)
(defmethod dummy-27 pov-camera ()
0
(none)
)
(defmethod dummy-29 pov-camera ()
(none)
)
(defbehavior
pov-camera-init-by-other pov-camera
((arg0 vector)
(arg1 skeleton-group)
(arg2 string)
(arg3 int)
(arg4 process-drawable)
(arg5 pair)
)
((method-of-object self dummy-29))
(set! (-> *game-info* pov-camera-handle) (process->handle self))
(set! (-> self flags) arg3)
(set! (-> self command-list) arg5)
(set! (-> self music-volume-movie) 100.0)
(set! (-> self sfx-volume-movie) 100.0)
(if arg4
(set! (-> self notify-handle) (process->handle arg4))
(set! (-> self notify-handle) (the-as handle #f))
)
(set!
(-> self debounce-start-time)
(the-as uint (-> *display* base-frame-counter))
)
(logclear!
(-> self mask)
(process-mask actor-pause movie enemy platform projectile)
)
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (-> arg0 quad))
(when (logtest? (-> self flags) 4)
(let
((v1-20
(if (and (nonzero? arg4) (type-type? (-> arg4 type) process-drawable))
arg4
)
)
)
(quaternion-copy! (-> self root quat) (-> v1-20 root quat))
)
)
(dummy-14 self arg1 '())
(logior! (-> self draw status) 32)
(logior! (-> self skel status) 1)
(set! (-> self anim-name) arg2)
(cond
((= (-> arg2 type) string)
(logior! (-> self skel status) 32)
(let ((s5-1 (dummy-10 (-> self draw art-group) arg2 art-joint-anim)))
(if (not s5-1)
(go process-drawable-art-error arg2)
)
(ja-channel-set! 1)
(set!
(-> self skel root-channel 0 frame-group)
(the-as art-joint-anim s5-1)
)
)
)
((= (-> arg2 type) spool-anim)
)
)
(set! (-> self mask-to-clear) (the-as uint #x4a0800))
(set!
(-> self event-hook)
(lambda :behavior pov-camera
((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (cond
((= v1-0 'mask)
(let ((v0-0 (the-as number (-> arg3 param 0))))
(set! (-> self mask-to-clear) (the-as uint v0-0))
v0-0
)
)
((= v1-0 'music-movie-volume)
(let ((f0-0 (the-as float (-> arg3 param 0))))
(set! (-> self music-volume-movie) f0-0)
f0-0
)
)
((= v1-0 'sfx-movie-volume)
(let ((f0-1 (the-as float (-> arg3 param 0))))
(set! (-> self sfx-volume-movie) f0-1)
f0-1
)
)
)
)
)
)
)
((method-of-object self dummy-27))
(go-virtual pov-camera-startup)
(none)
)
+4
View File
@@ -5,6 +5,8 @@
;; name in dgo: collide-func
;; dgos: GAME, ENGINE
(define-extern moving-sphere-triangle-intersect (function vector vector float collide-cache-tri vector vector float))
;; This file contains the primitive intersection functions used for collision.
;; Most take a description of primitive and a "probe"
;; The probe has an origin and a direction. The length of the direction vector is the length
@@ -19,6 +21,8 @@
;; If there's a miss, return COLLISION_MISS, a large negative number.
;; If we are inside of the primitive, return 0.0
;; decomp begins
(defconstant COLLISION_MISS -100000000.0)
+1
View File
@@ -73,6 +73,7 @@
(deftype joint-anim-compressed-hdr (structure)
((control-bits uint32 14 :offset-assert 0)
(unknown-half int16 :offset 6)
(num-joints uint32 :offset-assert 56)
(matrix-bits uint32 :offset-assert 60)
)
+14 -16
View File
@@ -12,23 +12,21 @@
(define-extern find-instance-by-name (function string instance))
(define-extern *edit-instance* string)
(define-extern cam-free-floating (state camera-slave))
(define-extern cam-standoff state)
(define-extern cam-pov state)
(define-extern cam-pov180 state)
(define-extern cam-pov-track state)
(define-extern cam-billy state)
(define-extern cam-endlessfall state)
(define-extern cam-lookat state)
(define-extern cam-stick state)
(define-extern cam-bike state)
(define-extern cam-fixed state)
(define-extern cam-decel state)
(define-extern cam-eye state)
(define-extern cam-point-watch state)
(define-extern cam-orbit state)
(define-extern cam-standoff (state camera-slave)) ;; unknown type
(define-extern cam-pov (state camera-slave)) ;; unknown type
(define-extern cam-pov180 (state camera-slave)) ;; unknown type
(define-extern cam-pov-track (state camera-slave)) ;; unknown type
(define-extern cam-billy (state camera-slave)) ;; unknown type
(define-extern cam-endlessfall (state camera-slave)) ;; unknown type
(define-extern cam-lookat (state camera-slave)) ;; unknown type
(define-extern cam-stick (state camera-slave)) ;; unknown type
(define-extern cam-bike (state camera-slave)) ;; unknown type
(define-extern cam-fixed (state camera-slave))
(define-extern cam-decel (state camera-slave))
(define-extern cam-eye (state camera-slave))
(define-extern cam-point-watch (state camera-slave))
(define-extern cam-orbit (state camera-slave))
(define-extern cam-robotboss (state camera-slave))
(define-extern cam-layout-stop (function none))
(define-extern cam-layout-start (function none))
(define-extern prototype-bucket-recalc-fields (function instance none))
(define-extern auto-save-command (function symbol int int process-tree none))
+1 -1
View File
@@ -30,7 +30,7 @@
(define-extern ja-num-frames (function int int))
;; TODO - for flutflut
(define-extern ja-group-size (function int))
;; TODO - for yakow
;; TODO - for yakow | pov-camera
(define-extern ja-frame-num (function int float))
;; TODO - for anim-tester
(define-extern draw-joint-spheres (function process-drawable symbol))
+2 -2
View File
@@ -62,7 +62,7 @@
)
(defmethod debug-draw cylinder ((obj cylinder) (arg0 vector))
(defmethod debug-draw cylinder ((obj cylinder) (arg0 vector4w))
"Debug draw a cylinder. This is slow and ugly"
(local-vars
(sv-896 matrix)
@@ -267,7 +267,7 @@
)
(defmethod debug-draw cylinder-flat ((obj cylinder-flat) (arg0 vector))
(defmethod debug-draw cylinder-flat ((obj cylinder-flat) (arg0 vector4w))
(local-vars (sv-448 vector) (sv-464 int))
(rlet ((vf0 :class vf)
(vf4 :class vf)
+1 -1
View File
@@ -7,7 +7,7 @@
;; definition of type plane-volume
(deftype plane-volume (structure)
((volume-type basic :offset-assert 0)
((volume-type symbol :offset-assert 0)
(point-count int16 :offset-assert 4)
(normal-count int16 :offset-assert 6)
(first-point vector :offset-assert 8)
+3 -3
View File
@@ -341,7 +341,7 @@
)
(deftype vector-array (inline-array-class)
(
((data vector :inline :dynamic :offset 16)
)
:method-count-assert 9
:size-assert #x10
@@ -422,7 +422,7 @@
:size-assert #x28
:flag-assert #xb00000028
(:methods
(debug-draw (_type_ vector) none 9)
(debug-draw (_type_ vector4w) none 9)
(ray-capsule-intersect (_type_ vector vector) float 10)
)
)
@@ -438,7 +438,7 @@
:size-assert #x28
:flag-assert #xb00000028
(:methods
(debug-draw (_type_ vector) none 9)
(debug-draw (_type_ vector4w) none 9)
(ray-flat-cyl-intersect (_type_ vector vector) float 10)
)
)
+21 -5
View File
@@ -5,6 +5,27 @@
;; name in dgo: target-h
;; dgos: GAME, ENGINE
;; TODO - for cam-master
(define-extern target-cam-pos (function vector))
(defun-extern stop symbol int)
(defun-extern start symbol continue-point target)
;; TODO - for mood
(define-extern target-joint-pos (function vector)) ;; TODO - unconfirmed
;; TODO - for target-util
(define-extern target-falling (state symbol none))
(define-extern target-slide-down (state none))
;; TODO - for logic-target - defined in shadow
(define-extern do-target-shadow (function none :behavior target))
;; TODO - for logic-target - defined in powerups
(define-extern target-powerup-process (function none))
;; TODO - for logic-target - defined in target-handler
(define-extern target-exit (function none))
(define-extern target-generic-event-handler (function process int symbol event-message-block object))
;; TODO - for logic-target - defined in sidekick
(define-extern init-sidekick (function none)) ;; TODO - not finished
;; TODO - for logic-target - defined in target-death
(define-extern target-continue (state continue-point none))
(declare-type sidekick basic)
(declare-type collide-cache basic)
(declare-type snowball-info basic)
@@ -84,8 +105,3 @@
)
(define-perm *sidekick* sidekick #f)
(defun-extern stop symbol int)
(defun-extern start symbol continue-point target)
+57 -55
View File
@@ -1471,63 +1471,65 @@
)
;; definition for function target-cam-pos
;; INFO: Return type mismatch object vs vector.
;; Used lq/sq
(defun target-cam-pos ()
(let ((gp-0 *target*))
(cond
((not gp-0)
(camera-pos)
)
((logtest? (-> gp-0 state-flags) 1024)
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(-> gp-0 alt-cam-pos)
)
((logtest? #x20000 (-> gp-0 state-flags))
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(-> gp-0 alt-cam-pos)
)
((logtest? #x80000 (-> gp-0 state-flags))
(let ((s5-0 (the-as object (new 'static 'vector))))
(set!
(-> (the-as vector s5-0) quad)
(-> (&-> (-> gp-0 control) unknown-qword00) 0)
)
(set!
(-> (the-as vector s5-0) y)
(fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y))
)
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(the-as vector s5-0)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
s5-0
)
)
(else
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(the-as vector (&-> (-> gp-0 control) unknown-qword00))
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(&-> (-> gp-0 control) unknown-qword00)
)
(the-as vector (cond
((not gp-0)
(camera-pos)
)
((logtest? (-> gp-0 state-flags) 1024)
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(-> gp-0 alt-cam-pos)
)
((logtest? #x20000 (-> gp-0 state-flags))
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(-> gp-0 alt-cam-pos)
)
((logtest? #x80000 (-> gp-0 state-flags))
(let ((s5-0 (the-as object (new 'static 'vector))))
(set!
(-> (the-as vector s5-0) quad)
(-> (&-> (-> gp-0 control) unknown-qword00) 0)
)
(set!
(-> (the-as vector s5-0) y)
(fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y))
)
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(the-as vector s5-0)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
s5-0
)
)
(else
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(the-as vector (&-> (-> gp-0 control) unknown-qword00))
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(&-> (-> gp-0 control) unknown-qword00)
)
)
)
)
)
@@ -1559,4 +1561,4 @@
*unity-quaternion*
)
)
)
)
+4 -10
View File
@@ -107,17 +107,17 @@
(while (< sv-272 7)
(vector+! s4-0 (-> s1-0 sv-272) (-> obj origin))
(vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> obj origin))
(camera-line s4-0 s3-0 arg0)
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(set! sv-272 (+ sv-272 1))
)
(vector+! s4-0 (-> s1-0 0) (-> obj origin))
(camera-line s4-0 s3-0 arg0)
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(set! sv-288 0)
(while (< sv-288 8)
(vector+! s4-0 (-> s1-0 sv-288) (-> obj origin))
(vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0)
(vector+! s3-0 (-> s1-0 sv-288) (-> obj origin))
(camera-line s4-0 s3-0 arg0)
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(set! sv-288 (+ sv-288 1))
)
)
@@ -217,13 +217,7 @@
(camera-line
gp-0
s5-0
(the-as
vector
(new 'static 'vector4w
:data
(new 'static 'array int32 4 #xff #xff 0 #x80)
)
)
(new 'static 'vector4w :data (new 'static 'array int32 4 #xff #xff 0 #x80))
)
(set! (-> s5-0 quad) (-> gp-0 quad))
)
+188
View File
@@ -0,0 +1,188 @@
from prompt_toolkit import PromptSession
from prompt_toolkit.history import FileHistory
from jsmin import jsmin
import shlex
import json
import collections
stack_cast_file_path = "./decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc"
type_cast_file_path = "./decompiler/config/jak1_ntsc_black_label/type_casts.jsonc"
lambda_cast_file_path = "./decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc"
global_file_name = ""
global_func_name = ""
def ordered_dict_insert(ordered_dict, index, key, value):
if key in ordered_dict:
raise KeyError("Key already exists")
if index < 0 or index > len(ordered_dict):
raise IndexError("Index out of range")
keys = list(ordered_dict.keys())[index:]
ordered_dict[key] = value
for k in keys:
ordered_dict.move_to_end(k)
# TODO - optional size
def stack_cast(function_name, type_name, offset):
with open(stack_cast_file_path, "r+") as config_file:
minified = jsmin(config_file.read())
json_data = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(minified)
# Check if the function name has already been added
if function_name not in json_data:
ordered_dict_insert(json_data, len(json_data)-1, function_name, [])
# Check if there already exists a cast with the same offset, if so replace it
casts = json_data[function_name]
for cast in casts:
if cast[0] == offset:
print("Found cast with the same offset, replacing!")
cast[1] = type_name
config_file.seek(0)
json.dump(json_data, config_file, indent=2)
config_file.truncate()
return
json_data[function_name].append([offset, type_name])
config_file.seek(0)
json.dump(json_data, config_file, indent=2)
config_file.truncate()
print("Stack Cast Applied!")
def type_cast(function_name, register, type_cast, cast_range):
with open(type_cast_file_path, "r+") as config_file:
minified = jsmin(config_file.read())
json_data = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(minified)
# Check if the function name has already been added
if function_name not in json_data:
ordered_dict_insert(json_data, len(json_data)-1, function_name, [])
range_start = -1
range_end = -1
if "-" in cast_range:
range_start = int(cast_range.split("-")[0])
range_end = int(cast_range.split("-")[1])
else:
range_start = int(cast_range)
# Check if there already exists a cast with the same offset, if so replace it
casts = json_data[function_name]
new_casts = []
for cast in casts:
cast_range_start = -1
cast_range_end = -1
if isinstance(cast[0], list):
cast_range_start = cast[0][0]
cast_range_end = cast[0][1]
else:
cast_range_start = cast[0]
cast_register = cast[1]
if range_end == -1 and cast_range_end == -1 and range_start == cast_range_start and register == cast_register:
print("Found cast with the same range, replacing!")
continue
elif range_end == -1:
if range_start >= cast_range_start and range_start <= cast_range_end and register == cast_register:
print("Found cast with the same range, replacing!")
continue
elif cast_range_end == -1:
if cast_range_start >= range_start and cast_range_start <= range_end and register == cast_register:
print("Found cast with the same range, replacing!")
continue
new_casts.append(cast)
json_data[function_name] = new_casts
if range_end == -1:
json_data[function_name].append([range_start, register, type_cast])
else:
json_data[function_name].append([[range_start, range_end], register, type_cast])
config_file.seek(0)
json.dump(json_data, config_file, indent=2)
config_file.truncate()
print("Type Cast Applied!")
def lambda_cast(file_name, func_sig, func_id):
with open(lambda_cast_file_path, "r+") as config_file:
minified = jsmin(config_file.read())
json_data = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(minified)
# Check if the function name has already been added
if file_name not in json_data:
ordered_dict_insert(json_data, len(json_data)-1, file_name, [])
# Check if there already exists a cast with the same offset, if so replace it
functions = json_data[file_name]
for func in functions:
if func[0] == func_id:
print("Found lambda with the same id, replacing!")
func[1] = func_sig
config_file.seek(0)
json.dump(json_data, config_file, indent=2)
config_file.truncate()
return
json_data[file_name].append([func_id, func_sig])
config_file.seek(0)
json.dump(json_data, config_file, indent=2)
config_file.truncate()
print("Lambda Cast Applied!")
def main():
global global_file_name
global global_func_name
from pathlib import Path
home = str(Path.home())
session = PromptSession(history=FileHistory('{}/.castReplHistory'.format(home)))
# LOOP
while True:
# READ
try:
prompt_string = "castREPL> "
if global_file_name and global_func_name:
prompt_string = "castREPL-{}-{}> ".format(global_file_name, global_func_name)
elif global_file_name:
prompt_string = "castREPL-{}> ".format(global_file_name)
elif global_func_name:
prompt_string = "castREPL-{}> ".format(global_func_name)
text = session.prompt(prompt_string)
except KeyboardInterrupt:
continue
except EOFError:
break
# TODO - help command
# TODO - command to list current casts
# TODO - command to delete casts
# TODO - command to lookup function signature in all-types
# TODO - command to tie into the C++ program I'll right to narrow down an unknown type
# TODO - command to define function signature in all-types
# EVAL / CAST / PRINT
tokens = shlex.split(text)
if len(tokens) < 1:
continue
# PROCESS COMMANDS
command = tokens[0]
# Allows you to persist a file name -- cutting down on command args (useful if working on a big file)
if command == "enter-file" and len(tokens) == 2:
global_file_name = tokens[1]
elif command == "exit-file":
global_file_name = ""
# Allows you to persist a function name -- cutting down on command args (useful if working on a big function)
elif command == "enter-func" and len(tokens) == 2:
global_func_name = tokens[1]
elif command == "exit-func":
global_func_name = ""
elif command == "stack" and len(tokens) == 4:
# Stack casts are in the following format stack <func> <type> <offset>
stack_cast(tokens[1], tokens[2], int(tokens[3]))
elif command == "lambda" and len(tokens) == 4:
# Stack casts are in the following format lambda <file_name> <id> <func_sig>
lambda_cast(tokens[1], tokens[2], int(tokens[3]))
elif command == "type" and len(tokens) == 5:
# Stack casts are in the following format type <func> <register> <type_cast> <range = X | X-Y>
type_cast(tokens[1], tokens[2], tokens[3], tokens[4])
else:
print("Invalid Cast Command!")
# Exit
print('GoodBye!')
if __name__ == '__main__':
main()
+3
View File
@@ -0,0 +1,3 @@
watchdog[watchmedo]
prompt_toolkit
jsmin
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -5
View File
@@ -2,6 +2,7 @@
(in-package goal)
;; definition for function cam-stop
;; INFO: Return type mismatch (state camera-slave) vs state.
(defun cam-stop ()
(kill-by-name 'camera-master *active-pool*)
(kill-by-name 'camera-slave *active-pool*)
@@ -10,7 +11,7 @@
(set! *camera-combiner* #f)
(let ((v0-3 cam-string))
(set! *camera-base-mode* v0-3)
v0-3
(the-as state v0-3)
)
)
@@ -74,7 +75,3 @@
;; failed to figure out what this is:
(cam-start #f)
@@ -0,0 +1,966 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type cam-point-watch-bank
(deftype cam-point-watch-bank (basic)
((speed float :offset-assert 4)
(rot-speed degrees :offset-assert 8)
)
:method-count-assert 9
:size-assert #xc
:flag-assert #x90000000c
)
;; definition for method 3 of type cam-point-watch-bank
(defmethod inspect cam-point-watch-bank ((obj cam-point-watch-bank))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tspeed: ~f~%" (-> obj speed))
(format #t "~Trot-speed: (deg ~r)~%" (-> obj rot-speed))
obj
)
;; definition for symbol *CAM_POINT_WATCH-bank*, type cam-point-watch-bank
(define
*CAM_POINT_WATCH-bank*
(new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6))
)
;; failed to figure out what this is:
(defstate cam-point-watch (camera-slave)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('teleport)
#f
)
(else
(cam-standard-event-handler arg0 arg1 arg2 arg3)
)
)
)
:enter
(behavior ()
(when (not (-> self enter-has-run))
(set! (-> self pivot-rad) 40960.0)
(set! (-> self blend-from-type) (the-as uint 1))
(set! (-> self blend-to-type) (the-as uint 1))
)
(none)
)
:code
(behavior ()
(while #t
(let ((s5-0 (new-stack-vector0))
(gp-0 (new-stack-vector0))
)
(when *camera-read-analog*
(let
((f28-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 leftx))
128.0
48.0
110.0
-1.0
)
)
(f30-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 lefty))
128.0
48.0
110.0
-1.0
)
)
(f26-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 rightx))
128.0
48.0
110.0
-1.0
)
)
(f0-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 righty))
128.0
48.0
110.0
-1.0
)
)
)
(cond
((logtest?
(-> *cpad-list* cpads (-> *CAMERA-bank* joypad) button0-abs 0)
(pad-buttons r2)
)
(set!
(-> s5-0 y)
(-
(-> s5-0 y)
(* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0))
)
)
(set!
(-> s5-0 x)
(- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))
)
(+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0))
(+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0))
)
(else
(set!
(-> s5-0 y)
(-
(-> s5-0 y)
(* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0))
)
)
(set!
(-> s5-0 x)
(- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))
)
(+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0))
(+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0))
)
)
)
(let ((s4-0 (new-stack-vector0)))
(let ((s3-0 (new-stack-matrix0)))
(matrix-axis-angle!
s3-0
(the-as vector (-> self tracking))
(- (-> s5-0 x))
)
(vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0)
(matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y)))
(vector-matrix*! s4-0 s4-0 s3-0)
)
(forward-down->inv-matrix
(the-as matrix (-> self tracking))
s4-0
(-> *camera* local-down)
)
)
(set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z)))
(if (< (-> self pivot-rad) 4096.0)
(set! (-> self pivot-rad) 4096.0)
)
(set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0)
(vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking)))
)
)
(suspend)
0
)
(none)
)
)
;; definition of type cam-free-bank
(deftype cam-free-bank (basic)
((speed float :offset-assert 4)
(rot-speed degrees :offset-assert 8)
)
:method-count-assert 9
:size-assert #xc
:flag-assert #x90000000c
)
;; definition for method 3 of type cam-free-bank
(defmethod inspect cam-free-bank ((obj cam-free-bank))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tspeed: ~f~%" (-> obj speed))
(format #t "~Trot-speed: (deg ~r)~%" (-> obj rot-speed))
obj
)
;; definition for symbol *CAM_FREE-bank*, type cam-free-bank
(define
*CAM_FREE-bank*
(new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6))
)
;; definition for function cam-free-floating-input
(defun
cam-free-floating-input
((arg0 vector) (arg1 vector) (arg2 symbol) (arg3 int))
(when (and (!= *master-mode* 'menu) (not *cam-layout*))
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons x))
(set!
(-> arg0 x)
(-
(-> arg0 x)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 6))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
)
(when *camera-read-buttons*
(if
(logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons triangle))
(+!
(-> arg0 x)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 4))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
(when *camera-read-buttons*
(if
(logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons square))
(+!
(-> arg0 y)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 7))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
(when *camera-read-buttons*
(if
(logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons circle))
(set!
(-> arg0 y)
(-
(-> arg0 y)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 5))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
)
)
(when arg2
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2))
(+!
(-> arg0 z)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 10))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2))
(set!
(-> arg0 z)
(-
(-> arg0 z)
(+
(-> *CAM_FREE-bank* rot-speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 11))
0.0
32.0
230.0
(-> *CAM_FREE-bank* rot-speed)
)
)
)
)
)
)
)
(cond
((not *cam-free-move-along-z*)
)
((not *camera-read-analog*)
)
((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2))
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r1))
(+!
(-> arg1 y)
(+
(* 0.2 (-> *CAM_FREE-bank* speed))
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 9))
0.0
32.0
230.0
(* 0.2 (-> *CAM_FREE-bank* speed))
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l1))
(set!
(-> arg1 y)
(-
(-> arg1 y)
(+
(* 0.2 (-> *CAM_FREE-bank* speed))
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 8))
0.0
32.0
230.0
(* 0.2 (-> *CAM_FREE-bank* speed))
)
)
)
)
)
)
)
(else
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r1))
(+!
(-> arg1 y)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 9))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l1))
(set!
(-> arg1 y)
(-
(-> arg1 y)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 8))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
)
)
)
(when (and (!= *master-mode* 'menu) (not *cam-layout*))
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons left))
(+!
(-> arg1 x)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 1))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons right))
(set!
(-> arg1 x)
(-
(-> arg1 x)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 0))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons up))
(+!
(-> arg1 z)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 2))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
(when *camera-read-buttons*
(if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons down))
(set!
(-> arg1 z)
(-
(-> arg1 z)
(+
(-> *CAM_FREE-bank* speed)
(analog-input
(the-as int (-> *cpad-list* cpads arg3 abutton 3))
0.0
32.0
230.0
(-> *CAM_FREE-bank* speed)
)
)
)
)
)
)
)
(when *camera-read-analog*
(let
((f28-14
(analog-input
(the-as int (-> *cpad-list* cpads arg3 leftx))
128.0
48.0
110.0
-1.0
)
)
(f30-14
(analog-input
(the-as int (-> *cpad-list* cpads arg3 lefty))
128.0
48.0
110.0
-1.0
)
)
(f24-0
(analog-input
(the-as int (-> *cpad-list* cpads arg3 rightx))
128.0
48.0
110.0
-1.0
)
)
(f26-0
(analog-input
(the-as int (-> *cpad-list* cpads arg3 righty))
128.0
48.0
110.0
-1.0
)
)
)
(when *display-load-boundaries*
(when
(and
(!= arg3 1)
(zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x)))
(zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r1)))
(zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2)))
)
(+!
f28-14
(analog-input
(the-as int (-> *cpad-list* cpads 1 leftx))
128.0
48.0
110.0
-1.0
)
)
(+!
f30-14
(analog-input
(the-as int (-> *cpad-list* cpads 1 lefty))
128.0
48.0
110.0
-1.0
)
)
(+!
f24-0
(analog-input
(the-as int (-> *cpad-list* cpads 1 rightx))
128.0
48.0
110.0
-1.0
)
)
(+!
f26-0
(analog-input
(the-as int (-> *cpad-list* cpads 1 righty))
128.0
48.0
110.0
-1.0
)
)
)
)
(cond
((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2))
(cond
((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2))
(set!
(-> arg0 y)
(- (-> arg0 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f24-0)))
)
(set!
(-> arg0 x)
(- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))
)
)
(else
(set!
(-> arg0 y)
(- (-> arg0 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed)))
)
(set!
(-> arg0 x)
(- (-> arg0 x) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed)))
)
)
)
(+! (-> arg1 x) (* 0.2 (-> *CAM_FREE-bank* speed) f28-14))
(+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14))
)
((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2))
(+! (-> arg1 x) (* f28-14 (-> *CAM_FREE-bank* speed)))
(+! (-> arg1 y) (* f26-0 (-> *CAM_FREE-bank* speed)))
(+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed)))
)
(else
(set!
(-> arg0 y)
(- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0)))
)
(set!
(-> arg0 x)
(- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))
)
(+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14))
(+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14))
)
)
)
)
(vector-float*! arg0 arg0 (-> *display* time-adjust-ratio))
(vector-float*! arg1 arg1 (-> *display* time-adjust-ratio))
)
;; definition of type camera-free-floating-move-info
(deftype camera-free-floating-move-info (structure)
((rv vector :inline :offset-assert 0)
(tv vector :inline :offset-assert 16)
(up vector :inline :offset-assert 32)
(tm matrix :inline :offset-assert 48)
)
:method-count-assert 9
:size-assert #x70
:flag-assert #x900000070
)
;; definition for method 3 of type camera-free-floating-move-info
(defmethod
inspect
camera-free-floating-move-info
((obj camera-free-floating-move-info))
(format #t "[~8x] ~A~%" obj 'camera-free-floating-move-info)
(format #t "~Trv: #<vector @ #x~X>~%" (-> obj rv))
(format #t "~Ttv: #<vector @ #x~X>~%" (-> obj tv))
(format #t "~Tup: #<vector @ #x~X>~%" (-> obj up))
(format #t "~Ttm: #<matrix @ #x~X>~%" (-> obj tm))
obj
)
;; definition for function cam-free-floating-move
(defun
cam-free-floating-move
((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int))
(if (logtest? (-> *cpad-list* cpads arg3 valid) 128)
(return (the-as vector #f))
)
(if (= *master-mode* 'menu)
(return (the-as vector #f))
)
(let ((s3-0 (new 'stack 'camera-free-floating-move-info)))
(cam-free-floating-input (-> s3-0 rv) (-> s3-0 tv) (not arg2) arg3)
(cond
(arg2
(matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y))
(matrix*! arg0 arg0 (-> s3-0 tm))
(cond
((< (vector-dot (-> arg0 vector 1) arg2) 0.0)
(forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2)
)
(else
(vector-negate! (-> s3-0 up) arg2)
(forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up))
)
)
)
(else
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y)))
(matrix*! arg0 arg0 (-> s3-0 tm))
)
)
(matrix-axis-angle!
(-> s3-0 tm)
(the-as vector (-> arg0 vector))
(- (-> s3-0 rv x))
)
(matrix*! arg0 arg0 (-> s3-0 tm))
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z)))
(matrix*! arg0 arg0 (-> s3-0 tm))
(vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0)
(vector+! arg1 arg1 (-> s3-0 tv))
)
)
;; failed to figure out what this is:
(defstate cam-free-floating (camera-slave)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('teleport)
#f
)
(else
(cam-standard-event-handler arg0 arg1 arg2 arg3)
)
)
)
:enter
(behavior ()
(when (not (-> self enter-has-run))
(set! (-> self blend-from-type) (the-as uint 1))
(set! (-> self blend-to-type) (the-as uint 1))
(send-event *camera-combiner* 'stop-tracking)
)
(none)
)
:code
(behavior ()
(while #t
(let ((a2-0 (-> *camera* local-down)))
(if (logtest? (-> self options) 8)
(set! a2-0 (the-as vector #f))
)
(cam-free-floating-move
(the-as matrix (-> self tracking))
(-> self trans)
a2-0
(the-as int (-> *CAMERA-bank* joypad))
)
)
(suspend)
)
(none)
)
)
;; definition of type camera-orbit-info
(deftype camera-orbit-info (structure)
((radius float :offset-assert 0)
(rot float :offset-assert 4)
(target-off vector :inline :offset-assert 16)
(orbit-off vector :inline :offset-assert 32)
(radius-lerp float :offset-assert 48)
)
:method-count-assert 9
:size-assert #x34
:flag-assert #x900000034
)
;; definition for method 3 of type camera-orbit-info
(defmethod inspect camera-orbit-info ((obj camera-orbit-info))
(format #t "[~8x] ~A~%" obj 'camera-orbit-info)
(format #t "~Tradius: ~f~%" (-> obj radius))
(format #t "~Trot: ~f~%" (-> obj rot))
(format #t "~Ttarget-off: #<vector @ #x~X>~%" (-> obj target-off))
(format #t "~Torbit-off: #<vector @ #x~X>~%" (-> obj orbit-off))
(format #t "~Tradius-lerp: ~f~%" (-> obj radius-lerp))
obj
)
;; definition of type CAM_ORBIT-bank
(deftype CAM_ORBIT-bank (basic)
((RADIUS_MAX float :offset-assert 4)
(RADIUS_MIN float :offset-assert 8)
(TARGET_OFF_ADJUST float :offset-assert 12)
(ORBIT_OFF_ADJUST float :offset-assert 16)
)
:method-count-assert 9
:size-assert #x14
:flag-assert #x900000014
)
;; definition for method 3 of type CAM_ORBIT-bank
(defmethod inspect CAM_ORBIT-bank ((obj CAM_ORBIT-bank))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~TRADIUS_MAX: ~f~%" (-> obj RADIUS_MAX))
(format #t "~TRADIUS_MIN: ~f~%" (-> obj RADIUS_MIN))
(format #t "~TTARGET_OFF_ADJUST: ~f~%" (-> obj TARGET_OFF_ADJUST))
(format #t "~TORBIT_OFF_ADJUST: ~f~%" (-> obj ORBIT_OFF_ADJUST))
obj
)
;; definition for symbol *CAM_ORBIT-bank*, type CAM_ORBIT-bank
(define
*CAM_ORBIT-bank*
(new 'static 'CAM_ORBIT-bank
:RADIUS_MAX 61440.0
:RADIUS_MIN 409.6
:TARGET_OFF_ADJUST 81.92
:ORBIT_OFF_ADJUST 81.92
)
)
;; definition for symbol *camera-orbit-info*, type camera-orbit-info
(define *camera-orbit-info* (new 'static 'camera-orbit-info))
;; failed to figure out what this is:
(set! (-> *camera-orbit-info* radius-lerp) 0.45)
;; failed to figure out what this is:
(set! (-> *camera-orbit-info* target-off y) 4096.0)
;; failed to figure out what this is:
(set! (-> *camera-orbit-info* orbit-off y) 4096.0)
;; failed to figure out what this is:
(defstate cam-orbit (camera-slave)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('teleport)
#f
)
(else
(cam-standard-event-handler arg0 arg1 arg2 arg3)
)
)
)
:enter
(behavior ()
(when (not (-> self enter-has-run))
(if (not *camera-orbit-target*)
(cam-slave-go cam-free-floating)
)
(let ((v1-4 (new-stack-vector0)))
(vector-! v1-4 (-> self trans) (-> *camera-orbit-target* 0 root trans))
(set! (-> *camera-orbit-info* rot) (atan (-> v1-4 x) (-> v1-4 z)))
)
(set! (-> self blend-from-type) (the-as uint 1))
(set! (-> self blend-to-type) (the-as uint 1))
)
(none)
)
:exit
(behavior ()
'()
(none)
)
:code
(behavior ()
(while #t
(if (not *camera-orbit-target*)
(cam-slave-go cam-free-floating)
)
(when *camera-read-analog*
(let
((f0-0
(analog-input
(the-as int (-> *cpad-list* cpads 0 righty))
128.0
32.0
110.0
0.05
)
)
)
(cond
((< (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) f0-0)
(+!
(-> *camera-orbit-info* radius-lerp)
(* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp)))
)
)
((< f0-0 (* 0.05 (- (-> *camera-orbit-info* radius-lerp))))
(+!
(-> *camera-orbit-info* radius-lerp)
(* 0.05 (- (-> *camera-orbit-info* radius-lerp)))
)
)
(else
(+! (-> *camera-orbit-info* radius-lerp) f0-0)
)
)
)
(set!
(-> *camera-orbit-info* radius)
(lerp
(-> *CAM_ORBIT-bank* RADIUS_MIN)
(-> *CAM_ORBIT-bank* RADIUS_MAX)
(-> *camera-orbit-info* radius-lerp)
)
)
)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2))
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1))
(set!
(-> *camera-orbit-info* target-off y)
(-
(-> *camera-orbit-info* target-off y)
(-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST)
)
)
)
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(+!
(-> *camera-orbit-info* target-off y)
(-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST)
)
)
)
(else
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1))
(set!
(-> *camera-orbit-info* orbit-off y)
(-
(-> *camera-orbit-info* orbit-off y)
(-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST)
)
)
)
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(+!
(-> *camera-orbit-info* orbit-off y)
(-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST)
)
)
)
)
(when *camera-read-analog*
(let
((f0-20
(analog-input
(the-as int (-> *cpad-list* cpads 0 rightx))
128.0
32.0
110.0
(* 21845.334 (-> *display* seconds-per-frame))
)
)
)
(set!
(-> *camera-orbit-info* rot)
(the
float
(sar (shl (the int (+ (-> *camera-orbit-info* rot) f0-20)) 48) 48)
)
)
)
)
(let ((gp-0 (new-stack-vector0)))
(let ((s5-0 (new-stack-vector0)))
(set-vector!
(-> self trans)
(+
(-> *camera-orbit-target* 0 root trans x)
(* (sin (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius))
)
(-> *camera-orbit-target* 0 root trans y)
(+
(-> *camera-orbit-target* 0 root trans z)
(* (cos (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius))
)
1.0
)
(vector+!
(-> self trans)
(-> self trans)
(-> *camera-orbit-info* orbit-off)
)
(vector+!
(-> self tracking follow-pt)
(-> *camera-orbit-target* 0 root trans)
(-> *camera-orbit-info* target-off)
)
(vector-! s5-0 (-> self trans) (-> self tracking follow-pt))
(set!
(-> gp-0 y)
(the
float
(sar (shl (the int (+ 32768.0 (atan (-> s5-0 x) (-> s5-0 z)))) 48) 48)
)
)
(set! (-> gp-0 x) (atan (-> s5-0 y) (vector-xz-length s5-0)))
)
(set! (-> gp-0 z) 0.0)
(matrix-rotate-zxy! (the-as matrix (-> self tracking)) gp-0)
)
(suspend)
)
(none)
)
)
File diff suppressed because it is too large Load Diff
+8 -8
View File
@@ -158,8 +158,8 @@
(:methods
(TODO-RENAME-9 (_type_) none 9)
(TODO-RENAME-10 (_type_ vector) none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(print-nth-point (_type_ int) none 11)
(TODO-RENAME-12 (_type_) none 12)
(TODO-RENAME-13 (_type_ int) none 13)
(TODO-RENAME-14 (_type_ vector) none 14)
(TODO-RENAME-15 (_type_) none 15)
@@ -170,7 +170,7 @@
(TODO-RENAME-20 (_type_ vector int) none 20)
(TODO-RENAME-21 (_type_ vector float float) vector 21)
(TODO-RENAME-22 (_type_ float) none 22)
(dummy-23 () none 23)
(TODO-RENAME-23 (_type_) none 23)
)
)
@@ -628,15 +628,15 @@
(force-blend uint32 :offset-assert 296)
(force-blend-time uint32 :offset-assert 300)
(local-down vector :inline :offset-assert 304)
(drawable-target uint64 :offset-assert 320)
(drawable-target handle :offset-assert 320)
(which-bone int32 :offset-assert 328)
(pov-handle uint64 :offset-assert 336)
(pov-handle handle :offset-assert 336)
(pov-bone int32 :offset-assert 344)
(being-attacked basic :offset-assert 348)
(being-attacked symbol :offset-assert 348)
(attack-start uint64 :offset-assert 352)
(on-ground basic :offset-assert 360)
(on-ground symbol :offset-assert 360)
(under-water int32 :offset-assert 364)
(on-pole basic :offset-assert 368)
(on-pole symbol :offset-assert 368)
(tgt-rot-mat matrix :inline :offset-assert 384)
(tgt-face-mat matrix :inline :offset-assert 448)
(tpos-old vector :inline :offset-assert 512)
+6 -6
View File
@@ -203,7 +203,7 @@
)
;; definition for function cam-slave-get-rot
(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 quaternion))
(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 matrix))
(let ((s4-0 (method-of-type res-lump get-property-struct))
(s3-0 arg0)
)
@@ -226,11 +226,11 @@
(let ((s4-1 (new 'stack-no-clear 'quaternion)))
(quaternion*! s4-1 (the-as quaternion a1-3) (-> arg0 quat))
(quaternion-normalize! s4-1)
(quaternion->matrix (the-as matrix arg1) s4-1)
(quaternion->matrix arg1 s4-1)
)
)
(else
(quaternion->matrix (the-as matrix arg1) (-> arg0 quat))
(quaternion->matrix arg1 (-> arg0 quat))
)
)
)
@@ -827,16 +827,16 @@
(< f0-4 1.0)
)
(set! (-> arg2 partial-pt) f0-4)
(let ((s5-0 (new 'stack-no-clear 'vector)))
(let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler)))
(let ((a2-5 (-> obj point (-> arg2 cur-pt) next)))
(vector-lerp!
s5-0
(the-as vector s5-0)
(the-as vector (-> obj point (-> arg2 cur-pt)))
(the-as vector (-> obj point a2-5))
f0-4
)
)
(vector+! arg1 arg1 s5-0)
(vector+! arg1 arg1 (the-as vector s5-0))
)
(return arg1)
)
+17 -16
View File
@@ -3,29 +3,30 @@
;; definition of type pov-camera
(deftype pov-camera (process-drawable)
((flags int32 :offset-assert 176)
(debounce-start-time uint64 :offset-assert 184)
(notify-handle uint64 :offset-assert 192)
(anim-name basic :offset-assert 200)
(command-list basic :offset-assert 204)
(mask-to-clear uint32 :offset-assert 208)
(music-volume-movie float :offset-assert 212)
(sfx-volume-movie float :offset-assert 216)
((cspace-array cspace-array :offset 112)
(flags int32 :offset-assert 176)
(debounce-start-time uint64 :offset-assert 184)
(notify-handle handle :offset-assert 192)
(anim-name string :offset-assert 200)
(command-list pair :offset-assert 204)
(mask-to-clear uint32 :offset-assert 208)
(music-volume-movie float :offset-assert 212)
(sfx-volume-movie float :offset-assert 216)
)
:heap-base #x70
:method-count-assert 30
:size-assert #xdc
:flag-assert #x1e007000dc
(:methods
(dummy-20 () none 20)
(dummy-21 () none 21)
(pov-camera-playing () none 22)
(dummy-23 () none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(pov-camera-abort () _type_ :state 20)
(pov-camera-done-playing () _type_ :state 21)
(pov-camera-playing () _type_ :state 22)
(pov-camera-start-playing () _type_ :state 23)
(pov-camera-startup () _type_ :state 24)
(TODO-RENAME-25 (_type_) symbol 25)
(target-grabbed? (_type_) symbol 26)
(dummy-27 () none 27)
(dummy-28 () none 28)
(target-released? () symbol 28)
(dummy-29 () none 29)
)
)
@@ -0,0 +1,426 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for method 25 of type pov-camera
(defmethod TODO-RENAME-25 pov-camera ((obj pov-camera))
(when
(or
(and
(>=
(-
(-> *display* base-frame-counter)
(the-as int (-> obj debounce-start-time))
)
60
)
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
)
(logtest? (-> obj flags) 2)
)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(when (logtest? (-> obj flags) 1)
(send-event (handle->process (-> obj notify-handle)) 'notify 'abort-request)
#t
)
)
)
;; definition for method 26 of type pov-camera
(defmethod target-grabbed? pov-camera ((obj pov-camera))
(or (not *target*) (process-grab? *target*))
)
;; definition for method 28 of type pov-camera
(defmethod target-released? pov-camera ()
(or (not *target*) (process-release? *target*))
)
;; failed to figure out what this is:
(defstate pov-camera-startup (pov-camera)
:virtual #t
:code
(behavior ()
(go-virtual pov-camera-start-playing)
(none)
)
)
;; failed to figure out what this is:
(defstate pov-camera-start-playing (pov-camera)
:virtual #t
:code
(behavior ()
(logclear! (-> self mask) (process-mask actor-pause))
(while (not (target-grabbed? self))
(suspend)
)
(let ((gp-0 0))
(let ((v1-7 (dummy-10 (-> self draw jgeo) "camera" (the-as type #f))))
(if v1-7
(set! gp-0 (+ (-> v1-7 number) 1))
)
)
(let* ((s5-0 (get-process *default-dead-pool* othercam #x4000))
(v1-10 (when s5-0
(let ((t9-3 (method-of-type othercam activate)))
(t9-3
(the-as othercam s5-0)
self
'othercam
(the-as pointer #x70004000)
)
)
(run-now-in-process
s5-0
othercam-init-by-other
self
gp-0
#t
#t
)
(-> s5-0 ppointer)
)
)
)
(send-event (ppointer->process v1-10) 'mask (-> self mask-to-clear))
)
)
(go-virtual pov-camera-playing)
(none)
)
)
;; definition for function pov-camera-play-and-reposition
;; INFO: Return type mismatch int vs none.
(defbehavior
pov-camera-play-and-reposition pov-camera
((arg0 joint-anim-compressed) (arg1 vector) (arg2 float))
(let ((s4-0 #f))
(let ((v1-2 (-> self skel root-channel 0)))
(set! (-> v1-2 frame-group) (the-as art-joint-anim arg0))
(set! (-> v1-2 param 0) (the float (+ (-> arg0 data 9 unknown-half) -1)))
(set! (-> v1-2 param 1) arg2)
(set! (-> v1-2 frame-num) 0.0)
(joint-control-channel-group!
v1-2
(the-as art-joint-anim arg0)
num-func-seek!
)
)
(until (ja-done? 0)
(let
((v1-4
(and
(not s4-0)
(< (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-4
)
)
(ja-frame-num 0)
)
)
)
)
(when v1-4
(set! s4-0 #t)
(send-event *camera* 'teleport-to-vector-start-string arg1)
)
)
(suspend)
(let ((a0-4 (-> self skel root-channel 0)))
(set!
(-> a0-4 param 0)
(the float (+ (-> a0-4 frame-group data 0 length) -1))
)
(set! (-> a0-4 param 1) arg2)
(joint-control-channel-group-eval!
a0-4
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
0
(none)
)
;; failed to figure out what this is:
(defstate pov-camera-playing (pov-camera)
:virtual #t
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (when (= v1-0 'abort)
(when (logtest? (-> self flags) 1)
(logior! (-> self flags) 2)
(if (= (-> self anim-name type) string)
(go-virtual pov-camera-abort)
)
)
)
)
)
)
:enter
(behavior ()
(set!
(-> self debounce-start-time)
(the-as uint (-> *display* base-frame-counter))
)
(if (= (-> self anim-name type) string)
(backup-load-state-and-set-cmds *load-state* (-> self command-list))
)
(none)
)
:exit
(behavior ()
(if (= (-> self anim-name type) string)
(restore-load-state-and-cleanup *load-state*)
)
(clear-pending-settings-from-process *setting-control* self 'music-volume)
(clear-pending-settings-from-process *setting-control* self 'sfx-volume)
(none)
)
:code
(behavior ()
(push-setting!
*setting-control*
self
'music-volume
'rel
(-> self music-volume-movie)
0
)
(push-setting!
*setting-control*
self
'sfx-volume
'rel
(-> self sfx-volume-movie)
0
)
(cond
((= (-> self anim-name type) string)
(let ((a0-4 (-> self skel root-channel 0)))
(set! (-> a0-4 frame-group) (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
)
(set!
(-> a0-4 param 0)
(the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
)
(set! (-> a0-4 param 1) 1.0)
(set! (-> a0-4 frame-num) 0.0)
(joint-control-channel-group!
a0-4
(if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
num-func-seek!
)
)
(until (ja-done? 0)
(TODO-RENAME-25 self)
(suspend)
(let ((a0-6 (-> self skel root-channel 0)))
(set!
(-> a0-6 param 0)
(the float (+ (-> a0-6 frame-group data 0 length) -1))
)
(set! (-> a0-6 param 1) 1.0)
(joint-control-channel-group-eval!
a0-6
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
((= (-> self anim-name type) spool-anim)
(ja-play-spooled-anim
(the-as spool-anim (-> self anim-name))
(the-as art-joint-anim #f)
(the-as art-joint-anim #f)
(method-of-object self TODO-RENAME-25)
)
)
)
(go-virtual pov-camera-done-playing)
(none)
)
:post
(behavior ()
(if (= (-> self anim-name type) string)
(execute-commands-up-to *load-state* (ja-aframe-num 0))
)
(ja-post)
(none)
)
)
;; failed to figure out what this is:
(defstate pov-camera-abort (pov-camera)
:virtual #t
:enter
(behavior ()
(logior! (-> self flags) 2)
(none)
)
:code
(behavior ()
(set-blackout-frames 10)
(suspend)
(suspend)
(go-virtual pov-camera-done-playing)
(none)
)
)
;; failed to figure out what this is:
(defstate pov-camera-done-playing (pov-camera)
:virtual #t
:code
(behavior ()
(while (begin
self
(not ((method-of-object self target-released?)))
)
(suspend)
)
(send-event (handle->process (-> self notify-handle)) 'notify 'die)
(suspend)
(suspend)
(dummy-18 self)
(deactivate self)
(none)
)
)
;; definition for method 27 of type pov-camera
;; INFO: Return type mismatch int vs none.
(defmethod dummy-27 pov-camera ()
0
(none)
)
;; definition for method 29 of type pov-camera
;; INFO: Return type mismatch symbol vs none.
(defmethod dummy-29 pov-camera ()
(none)
)
;; definition for function pov-camera-init-by-other
;; Used lq/sq
(defbehavior
pov-camera-init-by-other pov-camera
((arg0 vector)
(arg1 skeleton-group)
(arg2 string)
(arg3 int)
(arg4 process-drawable)
(arg5 pair)
)
((method-of-object self dummy-29))
(set! (-> *game-info* pov-camera-handle) (process->handle self))
(set! (-> self flags) arg3)
(set! (-> self command-list) arg5)
(set! (-> self music-volume-movie) 100.0)
(set! (-> self sfx-volume-movie) 100.0)
(if arg4
(set! (-> self notify-handle) (process->handle arg4))
(set! (-> self notify-handle) (the-as handle #f))
)
(set!
(-> self debounce-start-time)
(the-as uint (-> *display* base-frame-counter))
)
(logclear!
(-> self mask)
(process-mask actor-pause movie enemy platform projectile)
)
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (-> arg0 quad))
(when (logtest? (-> self flags) 4)
(let
((v1-20
(if (and (nonzero? arg4) (type-type? (-> arg4 type) process-drawable))
arg4
)
)
)
(quaternion-copy! (-> self root quat) (-> v1-20 root quat))
)
)
(dummy-14 self arg1 '())
(logior! (-> self draw status) 32)
(logior! (-> self skel status) 1)
(set! (-> self anim-name) arg2)
(cond
((= (-> arg2 type) string)
(logior! (-> self skel status) 32)
(let ((s5-1 (dummy-10 (-> self draw art-group) arg2 art-joint-anim)))
(if (not s5-1)
(go process-drawable-art-error arg2)
)
(ja-channel-set! 1)
(set!
(-> self skel root-channel 0 frame-group)
(the-as art-joint-anim s5-1)
)
)
)
((= (-> arg2 type) spool-anim)
)
)
(set! (-> self mask-to-clear) (the-as uint #x4a0800))
(set!
(-> self event-hook)
(lambda :behavior pov-camera
((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (cond
((= v1-0 'mask)
(let ((v0-0 (the-as number (-> arg3 param 0))))
(set! (-> self mask-to-clear) (the-as uint v0-0))
v0-0
)
)
((= v1-0 'music-movie-volume)
(let ((f0-0 (the-as float (-> arg3 param 0))))
(set! (-> self music-volume-movie) f0-0)
f0-0
)
)
((= v1-0 'sfx-movie-volume)
(let ((f0-1 (the-as float (-> arg3 param 0))))
(set! (-> self sfx-volume-movie) f0-1)
f0-1
)
)
)
)
)
)
)
((method-of-object self dummy-27))
(go-virtual pov-camera-startup)
(none)
)
+1
View File
@@ -118,6 +118,7 @@
;; definition of type joint-anim-compressed-hdr
(deftype joint-anim-compressed-hdr (structure)
((control-bits uint32 14 :offset-assert 0)
(unknown-half int16 :offset 6)
(num-joints uint32 :offset-assert 56)
(matrix-bits uint32 :offset-assert 60)
)
+2 -2
View File
@@ -72,7 +72,7 @@
;; definition for method 9 of type cylinder
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defmethod debug-draw cylinder ((obj cylinder) (arg0 vector))
(defmethod debug-draw cylinder ((obj cylinder) (arg0 vector4w))
(local-vars
(sv-896 matrix)
(sv-912 int)
@@ -310,7 +310,7 @@
;; definition for method 9 of type cylinder-flat
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defmethod debug-draw cylinder-flat ((obj cylinder-flat) (arg0 vector))
(defmethod debug-draw cylinder-flat ((obj cylinder-flat) (arg0 vector4w))
(local-vars (sv-448 vector) (sv-464 int))
(rlet ((vf0 :class vf)
(vf4 :class vf)
+1 -1
View File
@@ -3,7 +3,7 @@
;; definition of type plane-volume
(deftype plane-volume (structure)
((volume-type basic :offset-assert 0)
((volume-type symbol :offset-assert 0)
(point-count int16 :offset-assert 4)
(normal-count int16 :offset-assert 6)
(first-point vector :offset-assert 8)
+5 -4
View File
@@ -513,7 +513,8 @@
;; definition of type vector-array
(deftype vector-array (inline-array-class)
()
((data vector :inline :dynamic :offset 16)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
@@ -524,7 +525,7 @@
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tlength: ~D~%" (-> obj length))
(format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
(format #t "~Tdata[0] @ #x~X~%" (-> obj _data))
(format #t "~Tdata[0] @ #x~X~%" (-> obj data))
obj
)
@@ -676,7 +677,7 @@
:size-assert #x28
:flag-assert #xb00000028
(:methods
(debug-draw (_type_ vector) none 9)
(debug-draw (_type_ vector4w) none 9)
(ray-capsule-intersect (_type_ vector vector) float 10)
)
)
@@ -702,7 +703,7 @@
:size-assert #x28
:flag-assert #xb00000028
(:methods
(debug-draw (_type_ vector) none 9)
(debug-draw (_type_ vector4w) none 9)
(ray-flat-cyl-intersect (_type_ vector vector) float 10)
)
)
+56 -54
View File
@@ -1677,63 +1677,65 @@
)
;; definition for function target-cam-pos
;; INFO: Return type mismatch object vs vector.
;; Used lq/sq
(defun target-cam-pos ()
(let ((gp-0 *target*))
(cond
((not gp-0)
(camera-pos)
)
((logtest? (-> gp-0 state-flags) 1024)
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(-> gp-0 alt-cam-pos)
)
((logtest? #x20000 (-> gp-0 state-flags))
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(-> gp-0 alt-cam-pos)
)
((logtest? #x80000 (-> gp-0 state-flags))
(let ((s5-0 (the-as object (new 'static 'vector))))
(set!
(-> (the-as vector s5-0) quad)
(-> (&-> (-> gp-0 control) unknown-qword00) 0)
)
(set!
(-> (the-as vector s5-0) y)
(fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y))
)
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(the-as vector s5-0)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
s5-0
)
)
(else
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(the-as vector (&-> (-> gp-0 control) unknown-qword00))
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(&-> (-> gp-0 control) unknown-qword00)
)
(the-as vector (cond
((not gp-0)
(camera-pos)
)
((logtest? (-> gp-0 state-flags) 1024)
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(-> gp-0 alt-cam-pos)
)
((logtest? #x20000 (-> gp-0 state-flags))
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(-> gp-0 alt-cam-pos)
)
((logtest? #x80000 (-> gp-0 state-flags))
(let ((s5-0 (the-as object (new 'static 'vector))))
(set!
(-> (the-as vector s5-0) quad)
(-> (&-> (-> gp-0 control) unknown-qword00) 0)
)
(set!
(-> (the-as vector s5-0) y)
(fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y))
)
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(the-as vector s5-0)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
s5-0
)
)
(else
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(the-as vector (&-> (-> gp-0 control) unknown-qword00))
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(&-> (-> gp-0 control) unknown-qword00)
)
)
)
)
)
@@ -119,17 +119,17 @@
(while (< sv-272 7)
(vector+! s4-0 (-> s1-0 sv-272) (-> obj origin))
(vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> obj origin))
(camera-line s4-0 s3-0 arg0)
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(set! sv-272 (+ sv-272 1))
)
(vector+! s4-0 (-> s1-0 0) (-> obj origin))
(camera-line s4-0 s3-0 arg0)
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(set! sv-288 0)
(while (< sv-288 8)
(vector+! s4-0 (-> s1-0 sv-288) (-> obj origin))
(vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0)
(vector+! s3-0 (-> s1-0 sv-288) (-> obj origin))
(camera-line s4-0 s3-0 arg0)
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(set! sv-288 (+ sv-288 1))
)
)
@@ -250,13 +250,7 @@
(camera-line
gp-0
s5-0
(the-as
vector
(new 'static 'vector4w
:data
(new 'static 'array int32 4 #xff #xff 0 #x80)
)
)
(new 'static 'vector4w :data (new 'static 'array int32 4 #xff #xff 0 #x80))
)
(set! (-> s5-0 quad) (-> gp-0 quad))
)
@@ -104,6 +104,12 @@
// decompiler BUG
"level-hint-task-process",
// cam-states
"cam-los-collide", // vector-dot involving the stack
// cam-layout
"cam-layout-save-cam-trans", // temporary, im sure this can be fixed
// anim-tester
"(method 3 anim-tester)",
"anim-tester-save-object-seqs", // anim-tester -- new basic on the stack
@@ -113,5 +119,8 @@
],
"skip_compile_states": {
"cam-master-active": [
"event"
]
}
}
}
+4 -8
View File
@@ -65,7 +65,7 @@ struct OfflineTestConfig {
* Read and parse the json config file, config.json, located in test/offline
*/
OfflineTestConfig parse_config() {
auto json_file_path = file_util::get_file_path({"test", "offline", "config.json"});
auto json_file_path = file_util::get_file_path({"test", "offline", "config.jsonc"});
auto json = parse_commented_json(file_util::read_text_file(json_file_path), json_file_path);
OfflineTestConfig result;
result.dgos = json["dgos"].get<std::vector<std::string>>();
@@ -75,11 +75,6 @@ OfflineTestConfig parse_config() {
result.skip_compile_states =
json["skip_compile_states"]
.get<std::unordered_map<std::string, std::unordered_set<std::string>>>();
if (!result.skip_compile_states.empty()) {
fmt::print("skip_compile_states wasn't emtpy. It's not implemented in the decompiler yet\n");
exit(1);
}
return result;
}
@@ -239,7 +234,8 @@ void disassemble(Decompiler& dc) {
}
void decompile(Decompiler& dc, const OfflineTestConfig& config) {
dc.db->analyze_functions_ir2({}, *dc.config, config.skip_compile_functions);
dc.db->analyze_functions_ir2({}, *dc.config, config.skip_compile_functions,
config.skip_compile_states);
}
std::string strip_trailing_newlines(const std::string& in) {
@@ -393,4 +389,4 @@ int main(int argc, char* argv[]) {
}
}
return 1;
}
}