[decompile] Joint (#1813)

* temp

* decompile joints

* fix merge
This commit is contained in:
water111
2022-08-28 16:38:58 -04:00
committed by GitHub
parent d4a065a4e5
commit 2bead6db97
28 changed files with 6858 additions and 158 deletions
+6
View File
@@ -132,6 +132,12 @@ class TypeSpec {
return m_arguments->back();
}
TypeSpec& last_arg() {
ASSERT(m_arguments);
ASSERT(!m_arguments->empty());
return m_arguments->back();
}
bool empty() const {
if (!m_arguments) {
return true;
+9 -1
View File
@@ -3086,7 +3086,8 @@ void FunctionCallElement::update_from_stack(const Env& env,
auto vtable_var_name = env.get_variable_name(*vtable_reg);
auto arg0_mr = match(Matcher::any_reg(0), unstacked.at(1));
if (arg0_mr.matched && env.get_variable_name(*arg0_mr.maps.regs.at(0)) == vtable_var_name) {
if (tp_type.kind != TP_Type::Kind::VIRTUAL_METHOD) {
if (tp_type.kind != TP_Type::Kind::VIRTUAL_METHOD &&
tp_type.kind != TP_Type::Kind::GET_ART_BY_NAME_METHOD) {
throw std::runtime_error(
"Method internal mismatch. METHOD_OF_OBJECT operator didn't get a VIRTUAL_METHOD "
"type.");
@@ -3111,6 +3112,13 @@ void FunctionCallElement::update_from_stack(const Env& env,
arg_forms.at(0) = pop;
auto head = mr.maps.forms.at(1);
// rewrite get-art-by-name-method calls to get-art-by-name, which is a macro that
// will apply the appropriate cast.
if (tp_type.kind == TP_Type::Kind::GET_ART_BY_NAME_METHOD) {
ASSERT(head->to_string(env) == "get-art-by-name-method");
head = pool.form<ConstantTokenElement>("get-art-by-name");
}
auto head_obj = head->to_form(env);
if (head_obj.is_symbol() && tp_type.method_from_type().base_type() == "setting-control" &&
arg_forms.at(0)->to_form(env).is_symbol("*setting-control*") &&
+1 -1
View File
@@ -1030,7 +1030,7 @@
(sidekick-hint-rounddoor #x23c)
(sidekick-hint-lurkerm #x23d)
(sidekick-hint-tower #x23e)
(sidekick-reminder-fish #x240)
(firecanyon-need-cells #x24f)
+94 -68
View File
@@ -5840,7 +5840,7 @@
(:methods
(level-get (_type_ symbol) level 9)
(level-get-with-status (_type_ symbol) level 10)
(get-level-by-heap-ptr-and-status (_type_ pointer uint) level 11) ;;
(get-level-by-heap-ptr-and-status (_type_ pointer symbol) level 11) ;;
(level-get-for-use (_type_ symbol symbol) level 12)
(activate-levels! (_type_) int 13) ;; (debug-print-entities (_type_ symbol type) none 13)
(level-group-method-14 () none 14) ;; (debug-draw-actors (_type_ symbol) none 14)
@@ -7285,13 +7285,35 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defenum mem-usage-id
:type uint32
(bsp-leaf-vis-self 62)
(bsp-leaf-vis-adj 63)
:bitfield #f
:type uint32
(entity 43)
(camera 44)
(level-code 65)
(entity-links 66)
)
(res 48)
(bsp-leaf-vis-self 62)
(bsp-leaf-vis-adj 63)
(level-code 65)
(entity-links 66)
(joint 67)
(joint-anim-compressed-control 69)
(joint-anim-fixed 70)
(joint-anim-frame 71)
(art-group 73)
(art-mesh-anim 74)
(art-mesh-geo 75)
(art-joint-geo 76)
(art-joint-anim 77)
(joint-anim-drawable 78)
(eye-anim 111)
)
(deftype memory-usage-info (structure)
((name string :offset-assert 0) ;; guessed by decompiler
@@ -7654,8 +7676,8 @@
:flag-assert #xa00000020
;; field param1 uses ~A with a signed load field param2 uses ~A with a signed load
(:methods
;; (new (symbol type basic) _type_ 0)
(cspace-method-9 () none 9) ;; (reset-and-assign-geo! (_type_ basic) _type_ 9)
(new (symbol type basic) _type_ 0)
(reset-and-assign-geo! (_type_ basic) _type_ 9)
)
)
@@ -9710,7 +9732,7 @@
(deftype joint-anim-frame (structure)
((matrices matrix 2 :inline :offset-assert 0) ;; guessed by decompiler
(data matrix :dynamic :offset-assert 128) ;; guessed by decompiler
(data transformq :dynamic :inline :offset-assert 128) ;; guessed by decompiler
)
(:methods
(new (symbol type int) _type_ 0)
@@ -9777,10 +9799,10 @@
:size-assert #x14
:flag-assert #xd00000014
(:methods
(art-method-9 () none 9) ;; (login (_type_) _type_ 9)
(art-method-10 () none 10) ;; (lookup-art (_type_ string type) joint 10)
(art-method-11 () none 11) ;; (lookup-idx-of-art (_type_ string type) int 11)
(art-method-12 () none 12) ;; (needs-link? (_type_) symbol 12)
(login (_type_) _type_ 9)
(get-art-by-name-method (_type_ string type) basic 10)
(get-art-idx-by-name-method (_type_ string type) int 11)
(needs-link? (_type_) symbol 12)
)
)
@@ -9794,15 +9816,16 @@
(deftype art-mesh-anim (art-element)
()
((data basic :dynamic))
:flag-assert #xd00000020
)
(declare-type merc-eye-anim-block structure)
(deftype art-joint-anim (art-element)
((speed float :offset 20)
(artist-base float :offset 24)
(artist-step float :offset 28)
(eye-anim basic :offset 4)
(eye-anim merc-eye-anim-block :offset 4)
(master-art-group-name string :offset-assert 32) ;; guessed by decompiler
(master-art-group-index int32 :offset-assert 36)
(blend-shape-anim basic :offset-assert 40)
@@ -9825,23 +9848,26 @@
:flag-assert #xf00000020
;; Failed to read fields.
(:methods
(art-group-method-13 () none 13) ;; (link-art! (_type_) art-group 13)
(relocate (_type_ kheap (pointer uint8)) none :replace 7)
(link-art! (_type_) art-group 13)
(art-group-method-14 () none 14) ;; (unlink-art! (_type_) int 14)
)
)
(deftype art-mesh-geo (art-element)
()
((data basic :dynamic :offset-assert 32)
)
:flag-assert #xd00000020
)
(deftype art-joint-geo (art-element)
()
((data joint :dynamic :offset-assert 32)
)
:flag-assert #xd00000020
)
(deftype art-joint-anim-manager-slot (structure)
((anim basic :offset-assert 0)
((anim art-joint-anim :offset-assert 0)
(comp-data uint32 :offset-assert 4)
(time-stamp uint64 :offset-assert 8)
)
@@ -9862,10 +9888,10 @@
;; Failed to read fields.
(:methods
(new (symbol type int) _type_ 0)
(art-joint-anim-manager-method-9 () none 9)
(art-joint-anim-manager-method-10 () none 10)
(unload-from-slot (_type_ int) none 11)
(art-joint-anim-manager-method-12 () none 12)
(decompress (_type_ art-joint-anim) art-joint-anim 9)
(update-time-stamp (_type_ art-joint-anim) art-joint-anim 10)
(unload-from-slot (_type_ int) art-joint-anim 11)
(used-bytes-for-slot (_type_ int) int 12)
(unload-from-level (_type_ level) none 13)
)
)
@@ -12049,13 +12075,13 @@
(frame-group art-joint-anim :offset-assert 4)
(frame-num float :offset-assert 8)
(dist meters :offset-assert 12)
(num-func (function joint-control-channel float float float))
(num-func (function joint-control-channel float float float float))
(param float 3)
(frame-interp float 2)
(inspector-amount uint8)
(command joint-control-command)
(group-sub-index int8 :offset-assert 56)
(grou-size int8)
(group-size int8)
(eval-time uint32)
)
:method-count-assert 9
@@ -12136,10 +12162,10 @@
:flag-assert #xc00000040
;; Failed to read fields.
(:methods
;; (new (symbol type int) _type_ 0)
(new (symbol type int) _type_ 0)
(joint-control-method-9 () none 9) ;; (current-cycle-distance (_type_) float 9)
(joint-control-method-10 () none 10) ;; (debug-print-channels (_type_ symbol) int 10)
(joint-control-method-11 () none 11)
(joint-control-method-10 () none 10)
(debug-print-channels (_type_ symbol) int 11)
)
)
@@ -20803,47 +20829,47 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (define-extern joint-anim-login function) ;; (function joint-anim-drawable joint-anim-drawable)
;; (define-extern joint-anim-inspect-elt function) ;; (function joint-anim float joint-anim)
;; (define-extern jacc-mem-usage function) ;; (function joint-anim-compressed-control memory-usage-block int joint-anim-compressed-control)
;; (define-extern joint-control-channel-eval function) ;; (function joint-control-channel none)
;; (define-extern joint-control-channel-eval! function) ;; (function joint-control-channel (function joint-control-channel float float float) none)
;; (define-extern joint-control-channel-group-eval! function) ;; (function joint-control-channel art-joint-anim (function joint-control-channel float float float) int)
;; (define-extern joint-control-channel-group! function) ;; (function joint-control-channel art-joint-anim (function joint-control-channel float float float) int)
;; (define-extern joint-control-copy! function) ;; (function joint-control joint-control joint-control)
;; (define-extern joint-control-remap! function) ;; (function joint-control art-group art-group pair int string object)
;; (define-extern flatten-joint-control-to-spr function) ;; (function joint-control int)
;; (define-extern matrix-from-joint-anim-frame function) ;; (function joint-anim-compressed-control int int matrix)
;; (define-extern matrix-from-control-channel! function) ;; (function matrix joint joint-control-channel matrix)
;; (define-extern matrix-from-control-pair! function) ;; (function matrix matrix joint matrix)
;; (define-extern matrix-from-control! function) ;; (function matrix-stack joint joint-control symbol matrix)
;; (define-extern cspace<-cspace! function) ;; (function cspace cspace matrix)
;; (define-extern cspace<-cspace-normalized! function)
;; (define-extern cspace<-parent-joint! function)
;; (define-extern cspace<-rot-yxy! function) ;; (function cspace transform matrix)
;; (define-extern cspace<-transform-yxy! function) ;; (function cspace transform matrix)
(define-extern joint-anim-login (function joint-anim-drawable joint-anim-drawable))
(define-extern joint-anim-inspect-elt (function joint-anim float joint-anim))
(define-extern jacc-mem-usage (function joint-anim-compressed-control memory-usage-block int joint-anim-compressed-control))
(define-extern joint-control-channel-eval (function joint-control-channel float :behavior process))
(define-extern joint-control-channel-eval! (function joint-control-channel (function joint-control-channel float float float float) float :behavior process))
(define-extern joint-control-channel-group-eval! (function joint-control-channel art-joint-anim (function joint-control-channel float float float float) int))
(define-extern joint-control-channel-group! (function joint-control-channel art-joint-anim (function joint-control-channel float float float float) int))
(define-extern joint-control-copy! (function joint-control joint-control joint-control))
(define-extern joint-control-remap! (function joint-control art-group art-group pair int string object))
(define-extern flatten-joint-control-to-spr (function joint-control int))
(define-extern matrix-from-joint-anim-frame (function joint-anim-compressed-control int int matrix))
(define-extern matrix-from-control-channel! (function matrix joint joint-control-channel matrix))
(define-extern matrix-from-control-pair! (function matrix matrix joint int matrix))
(define-extern matrix-from-control! (function matrix-stack joint joint-control symbol matrix))
(define-extern cspace<-cspace! (function cspace cspace matrix))
(define-extern cspace<-cspace-normalized! (function cspace cspace matrix))
(define-extern cspace<-parent-joint! (function cspace (pointer process-drawable) int matrix))
(define-extern cspace<-rot-yxy! (function cspace transform matrix))
(define-extern cspace<-transform-yxy! (function cspace transform matrix))
(define-extern cspace<-transformq! (function cspace transformq matrix))
;; (define-extern cspace<-transformq+trans! function) ;; (function cspace transformq vector matrix)
;; (define-extern cspace<-transformq+world-trans! function) ;; (function cspace transformq vector matrix)
;; (define-extern cspace<-transformq+rot-offset! function)
;; (define-extern cspace-calc-total-matrix! function) ;; (function cspace matrix matrix)
;; (define-extern cspace<-matrix-no-push-joint! function) ;; (function cspace joint-control matrix)
;; (define-extern cspace<-matrix-joint! function) ;; (function cspace matrix matrix)
;; (define-extern cspace<-parented-matrix-joint! function) ;; (function cspace matrix matrix)
;; (define-extern cspace<-parented-matrix-mirror! function)
;; (define-extern cspace<-parented-matrix-joint-flip-z! function)
;; (define-extern cspace<-matrix-joint-flip-z! function)
(define-extern cspace<-transformq+trans! (function cspace transformq vector matrix))
(define-extern cspace<-transformq+world-trans! (function cspace transformq vector matrix))
(define-extern cspace<-transformq+rot-offset! (function cspace transformq vector matrix))
(define-extern cspace-calc-total-matrix! (function cspace matrix matrix))
(define-extern cspace<-matrix-no-push-joint! (function cspace joint-control matrix))
(define-extern cspace<-matrix-joint! (function cspace matrix matrix))
(define-extern cspace<-parented-matrix-joint! (function cspace matrix matrix))
(define-extern cspace<-parented-matrix-mirror! (function cspace matrix matrix))
(define-extern cspace<-parented-matrix-joint-flip-z! (function cspace matrix matrix))
(define-extern cspace<-matrix-joint-flip-z! (function cspace matrix none))
(define-extern cspace<-parented-transformq-joint! (function cspace transformq none))
;; (define-extern cspace<-parented-transformq-joint-flip-z! function)
(define-extern cspace<-parented-transformq-joint-flip-z! (function cspace transformq none))
;; (define-extern clear-frame-accumulator function) ;; (function (inline-array vector) none)
;; (define-extern normalize-frame-quaternions function) ;; function
;; (define-extern decompress-fixed-data-to-accumulator function) ;; (function none)
;; (define-extern decompress-frame-data-to-accumulator function) ;; (function none)
;; (define-extern decompress-frame-data-pair-to-accumulator function) ;; (function none)
;; (define-extern make-joint-jump-tables function) ;; (function int)
;; (define-extern calc-animation-from-spr function) ;; (function (inline-array vector) int none)
;; (define-extern create-interpolated-joint-animation-frame function) ;; (function (inline-array vector) int process-drawable int)
;; (define-extern create-interpolated2-joint-animation-frame function)
(define-extern decompress-fixed-data-to-accumulator function) ;; (function none)
(define-extern decompress-frame-data-to-accumulator function) ;; (function none)
(define-extern decompress-frame-data-pair-to-accumulator function) ;; (function none)
(define-extern make-joint-jump-tables (function int))
(define-extern calc-animation-from-spr (function joint-anim-frame int none))
(define-extern create-interpolated-joint-animation-frame (function joint-anim-frame int joint-control int))
(define-extern create-interpolated2-joint-animation-frame (function joint-anim-frame int joint-control int))
(define-extern *anim-manager* art-joint-anim-manager)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -22111,7 +22137,7 @@
;; (define-extern unpack-comp-rle function) ;; (function (pointer int8) (pointer int8) none)
;; (define-extern unpack-comp-huf function) ;; (function (pointer uint8) (pointer uint8) uint huf-dictionary-node none)
;; (define-extern unpack-comp-lzo function)
(define-extern unpack-comp-lzo (function object object none))
;; (define-extern pack-comp-rle function)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -27391,7 +27417,7 @@
)
|#
;; (define-extern mem-size function) ;; (function basic symbol int int)
(define-extern mem-size (function basic symbol int int))
;; (define-extern *max-dma* object) ;; int
+3 -2
View File
@@ -36,7 +36,6 @@
"asm_functions_by_name": [
// checking boxed type is different now - these make the cfg stuff sad
"name=",
"joint-control-remap!",
"(method 21 game-info)",
"(anon-function 2 cam-combiner)",
"cspace-inspect-tree",
@@ -200,6 +199,7 @@
"~170h~5d~220h~5d~280h~5,,2f": 3,
"~338h~5d~388h~5d~448h~5,,2f": 3,
"~1k~%": 0,
"~0K": 0,
"~30Htf: ~8D~134Hpr: ~8D~252Hsh: ~8D~370Hhd: ~8D~%": 4,
"~30Hal: ~8D~131Hwa: ~8D~252Hsp: ~8D~370Hwp: ~8D~%": 4,
"~0Kload ~16S ~5S ~5DK ~5,,2fs ~5,,2fs~1K ~5,,0f k/s~%": 6
@@ -233,7 +233,8 @@
"mips2c_functions_by_name": [
"collide-do-primitives",
"moving-sphere-triangle-intersect"
"moving-sphere-triangle-intersect",
"calc-animation-from-spr"
],
"mips2c_jump_table_functions": {},
+82
View File
@@ -616,6 +616,88 @@
[[454, 467], "a0", "handle"],
[[455, 462], "v1", "handle"]
],
"(method 9 art)": [
[9, "v1", "pointer"]
],
"(method 12 art-group)":[
[12, "a0", "art-joint-anim"]
],
"(method 9 art-mesh-geo)": [
[20, "s4", "(pointer int16)"],
[[14, 19], "a0", "drawable"],
[10, "v1", "(pointer art)"],
[14, "v1", "(pointer art)"]
],
"(method 9 art-joint-anim)": [
[9, "v1", "pointer"]
],
"joint-control-copy!": [
[8, "a0", "uint"]
],
"joint-control-remap!": [
[127, "t9", "(function joint-control joint-control-channel int object)"],
[181, "t9", "(function joint-control joint-control-channel int object)"],
["_stack_", 60, "basic"]
],
"flatten-joint-control-to-spr": [
[[201, 203], "a1", "terrain-context"],
[[131, 133], "a0", "terrain-context"],
[[182, 184], "a1", "terrain-context"],
[[164, 166], "a0", "terrain-context"],
[195, "v1", "terrain-context"],
[65, "a3", "(pointer float)"],
[67, "a3", "(pointer float)"],
[[18, 24], "a2", "(inline-array vector)"],
[24, "a3", "(pointer float)"],
[[59, 65], "a2", "(inline-array vector)"],
[[112, 118], "a2", "(inline-array vector)"],
[17, "a2", "int"]
],
"(method 2 art-joint-anim-manager-slot)": [
[21, "s2", "uint"],
[21, "v1", "uint"]
],
"create-interpolated2-joint-animation-frame": [
[[48, 125], "v1", "joint-anim-frame"]
],
"(method 12 art-joint-anim-manager)": [
[15, "a0", "pointer"],
[15, "v1", "pointer"],
[21, "a0", "pointer"],
[21, "v1", "pointer"]
],
"(method 11 art-joint-anim-manager)": [
[54, "v1", "uint"],
[54, "s2", "uint"],
[60, "s2", "uint"],
[65, "s2", "uint"],
[71, "s2", "uint"],
[87, "a1", "uint"],
[94, "a2", "uint"]
],
"joint-anim-inspect-elt": [
[[4, 15], "gp", "joint-anim-matrix"],
[[17, 30], "gp", "joint-anim-transformq"]
],
"matrix-from-control!": [
[22, "v1", "pointer"],
[35, "v1", "pointer"],
[38, "v1", "pointer"],
[65, "v1", "pointer"],
[72, "v1", "pointer"],
[82, "v1", "pointer"],
[85, "v1", "pointer"],
// [58, "v1", "matrix"],
[[43, 49], "v1", "matrix"]
],
// placeholder
"placeholder-do-not-add-below": []
}
+22
View File
@@ -1873,6 +1873,15 @@ bool load_var_op_determine_type(types2::Type& type_out,
return true;
} else {
// normal virtual method access.
// first check special cases
if (type_name == "art" || type_name == "art-group") {
if (method_id == 10) {
type_out.type =
TP_Type::make_get_art_by_name(method_type, TypeSpec(type_name), method_id);
return true;
}
}
// nope
type_out.type = TP_Type::make_virtual_method(method_type, TypeSpec(type_name), method_id);
return true;
}
@@ -2259,6 +2268,19 @@ void CallOp::propagate_types2(types2::Instruction& instr,
in_type = state_to_go_function(state_typespec, TypeSpec("object"));
}
if (in_tp.kind == TP_Type::Kind::GET_ART_BY_NAME_METHOD) {
can_backprop = false;
// let's see what a2 holds...
auto& arg2_type = input_types[Register(Reg::GPR, arg_regs[2])];
if (arg2_type->type) {
auto& tpt = *arg2_type->type;
if (tpt.kind == TP_Type::Kind::TYPE_OF_TYPE_NO_VIRTUAL) {
ASSERT(in_type.last_arg() == TypeSpec("basic")); // just to double check right function
in_type.last_arg() = tpt.get_type_objects_typespec();
}
}
}
// special case: process initialization
if (in_tp.kind == TP_Type::Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION ||
in_tp.kind == TP_Type::Kind::SET_TO_RUN_FUNCTION) {
+5
View File
@@ -78,6 +78,8 @@ std::string TP_Type::print() const {
return "<set-to-run-func>";
case Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION:
return "<run-function-in-process-func>";
case Kind::GET_ART_BY_NAME_METHOD:
return "<get-art-by-name-method>";
case Kind::INVALID:
default:
ASSERT(false);
@@ -134,6 +136,7 @@ bool TP_Type::operator==(const TP_Type& other) const {
case Kind::ENTER_STATE_FUNCTION:
case Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION:
case Kind::SET_TO_RUN_FUNCTION:
case Kind::GET_ART_BY_NAME_METHOD:
return true;
case Kind::INVALID:
default:
@@ -200,6 +203,8 @@ TypeSpec TP_Type::typespec() const {
case Kind::SET_TO_RUN_FUNCTION:
// give a general function so we can't call it normally.
return TypeSpec("function");
case Kind::GET_ART_BY_NAME_METHOD:
return m_ts;
case Kind::INVALID:
default:
ASSERT(false);
+17 -2
View File
@@ -41,6 +41,7 @@ class TP_Type {
ENTER_STATE_FUNCTION,
RUN_FUNCTION_IN_PROCESS_FUNCTION,
SET_TO_RUN_FUNCTION,
GET_ART_BY_NAME_METHOD,
INVALID
} kind = Kind::UNINITIALIZED;
TP_Type() = default;
@@ -73,6 +74,7 @@ class TP_Type {
case Kind::ENTER_STATE_FUNCTION:
case Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION:
case Kind::SET_TO_RUN_FUNCTION:
case Kind::GET_ART_BY_NAME_METHOD:
return false;
case Kind::UNINITIALIZED:
case Kind::OBJECT_NEW_METHOD:
@@ -287,6 +289,17 @@ class TP_Type {
return result;
}
static TP_Type make_get_art_by_name(const TypeSpec& method_ts,
const TypeSpec& obj_ts,
int method_id) {
TP_Type result;
result.kind = Kind::GET_ART_BY_NAME_METHOD;
result.m_ts = method_ts;
result.m_method_from_type = obj_ts;
result.m_method_id = method_id;
return result;
}
const TypeSpec& get_objects_typespec() const {
ASSERT(kind == Kind::TYPESPEC || kind == Kind::INTEGER_CONSTANT_PLUS_VAR);
return m_ts;
@@ -347,12 +360,14 @@ class TP_Type {
}
const TypeSpec& method_from_type() const {
ASSERT(kind == Kind::VIRTUAL_METHOD || kind == Kind::NON_VIRTUAL_METHOD);
ASSERT(kind == Kind::VIRTUAL_METHOD || kind == Kind::NON_VIRTUAL_METHOD ||
kind == Kind::GET_ART_BY_NAME_METHOD);
return m_method_from_type;
}
int method_id() const {
ASSERT(kind == Kind::VIRTUAL_METHOD || kind == Kind::NON_VIRTUAL_METHOD);
ASSERT(kind == Kind::VIRTUAL_METHOD || kind == Kind::NON_VIRTUAL_METHOD ||
kind == Kind::GET_ART_BY_NAME_METHOD);
return m_method_id;
}
+1
View File
@@ -83,6 +83,7 @@ set(RUNTIME_SOURCE
mips2c/jak1_functions/tie_methods.cpp
mips2c/jak1_functions/time_of_day.cpp
mips2c/jak2_functions/collide_func.cpp
mips2c/jak2_functions/joint.cpp
overlord/dma.cpp
overlord/fake_iso.cpp
overlord/iso.cpp
-4
View File
@@ -1000,8 +1000,6 @@ u64 method_set(u32 type_, u32 method_id, u32 method) {
method_id, sym_to_string(sym)->data());
printf("***********************************\n");
}
// todo remove once checked
printf("doing method set: %s %d\n", sym_to_string(sym)->data(), method_id);
sym_value->get_method(method_id).offset = method;
}
}
@@ -1020,8 +1018,6 @@ u64 method_set(u32 type_, u32 method_id, u32 method) {
method_id, sym_to_string(sym)->data());
printf("***********************************\n");
}
// todo remove once checked
printf("doing method set: %s %d\n", sym_to_string(sym)->data(), method_id);
sym_value->get_method(method_id).offset = method;
}
}
File diff suppressed because it is too large Load Diff
+7 -1
View File
@@ -117,6 +117,9 @@ namespace generic_tie_convert { extern void link(); }
namespace jak2 {
namespace collide_do_primitives { extern void link(); }
namespace moving_sphere_triangle_intersect { extern void link(); }
namespace calc_animation_from_spr { extern void link(); }
namespace cspace_parented_transformq_joint { extern void link(); }
}
// clang-format on
@@ -194,7 +197,10 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
{"generic-tie", {jak1::generic_tie_dma_to_spad_sync::link, jak1::generic_tie_convert::link}}},
/////////// JAK 2
{{"collide-func",
{jak2::collide_do_primitives::link, jak2::moving_sphere_triangle_intersect::link}}}};
{jak2::collide_do_primitives::link, jak2::moving_sphere_triangle_intersect::link}},
{"joint",
{jak2::calc_animation_from_spr::link, jak2::cspace_parented_transformq_joint::link}}},
};
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
const auto& it = m_executes.insert({name, {exec, Ptr<u8>()}});
+14 -13
View File
@@ -34,18 +34,18 @@
;; DECOMP BEGINS
(deftype joint-control-channel (structure)
((parent joint-control :offset-assert 0)
(frame-group art-joint-anim :offset-assert 4)
(frame-num float :offset-assert 8)
(dist meters :offset-assert 12)
(num-func (function joint-control-channel float float float) :offset-assert 16)
(param float 3 :offset-assert 20)
(frame-interp float 2 :offset-assert 32)
(inspector-amount uint8 :offset-assert 40)
(command joint-control-command :offset-assert 48)
(group-sub-index int8 :offset-assert 56)
(grou-size int8 :offset-assert 57)
(eval-time uint32 :offset-assert 60)
((parent joint-control :offset-assert 0)
(frame-group art-joint-anim :offset-assert 4)
(frame-num float :offset-assert 8)
(dist meters :offset-assert 12)
(num-func (function joint-control-channel float float float float) :offset-assert 16)
(param float 3 :offset-assert 20)
(frame-interp float 2 :offset-assert 32)
(inspector-amount uint8 :offset-assert 40)
(command joint-control-command :offset-assert 48)
(group-sub-index int8 :offset-assert 56)
(group-size int8 :offset-assert 57)
(eval-time uint32 :offset-assert 60)
)
:method-count-assert 9
:size-assert #x40
@@ -105,9 +105,10 @@
:size-assert #x40
:flag-assert #xc00000040
(:methods
(new (symbol type int) _type_ 0)
(joint-control-method-9 () none 9)
(joint-control-method-10 () none 10)
(joint-control-method-11 () none 11)
(debug-print-channels (_type_ symbol) int 11)
)
)
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -61,7 +61,8 @@
:size-assert #x20
:flag-assert #xa00000020
(:methods
(cspace-method-9 () none 9)
(new (symbol type basic) _type_ 0)
(reset-and-assign-geo! (_type_ basic) _type_ 9)
)
)
+23 -22
View File
@@ -9,6 +9,7 @@
(declare-type merc-ctrl art-element)
(declare-type ripple-control basic)
(declare-type shadow-control basic)
(declare-type merc-eye-anim-block structure)
(defenum draw-control-status
:type uint16
@@ -83,8 +84,8 @@
)
(deftype joint-anim-frame (structure)
((matrices matrix 2 :inline :offset-assert 0)
(data matrix :dynamic :offset-assert 128)
((matrices matrix 2 :inline :offset-assert 0)
(data transformq :inline :dynamic :offset-assert 128)
)
:method-count-assert 9
:size-assert #x80
@@ -160,10 +161,10 @@
:size-assert #x14
:flag-assert #xd00000014
(:methods
(art-method-9 () none 9)
(art-method-10 () none 10)
(art-method-11 () none 11)
(art-method-12 () none 12)
(login (_type_) _type_ 9)
(get-art-by-name-method (_type_ string type) basic 10)
(get-art-idx-by-name-method (_type_ string type) int 11)
(needs-link? (_type_) symbol 12)
)
)
@@ -176,18 +177,18 @@
)
(deftype art-mesh-anim (art-element)
()
((data basic :dynamic :offset-assert 32)
)
:method-count-assert 13
:size-assert #x20
:flag-assert #xd00000020
)
;; definition of type art-joint-anim
(deftype art-joint-anim (art-element)
((speed float :offset 20)
(artist-base float :offset 24)
(artist-step float :offset 28)
(eye-anim basic :offset 4)
(eye-anim merc-eye-anim-block :offset 4)
(master-art-group-name string :offset-assert 32)
(master-art-group-index int32 :offset-assert 36)
(blend-shape-anim basic :offset-assert 40)
@@ -206,32 +207,32 @@
:size-assert #x20
:flag-assert #xf00000020
(:methods
(art-group-method-13 () none 13)
(relocate (_type_ kheap (pointer uint8)) none :replace 7)
(link-art! (_type_) art-group 13)
(art-group-method-14 () none 14)
)
)
;; definition of type art-mesh-geo
(deftype art-mesh-geo (art-element)
()
((data basic :dynamic :offset-assert 32)
)
:method-count-assert 13
:size-assert #x20
:flag-assert #xd00000020
)
;; definition of type art-joint-geo
(deftype art-joint-geo (art-element)
()
((data joint :dynamic :offset-assert 32)
)
:method-count-assert 13
:size-assert #x20
:flag-assert #xd00000020
)
;; definition of type art-joint-anim-manager-slot
(deftype art-joint-anim-manager-slot (structure)
((anim basic :offset-assert 0)
(comp-data uint32 :offset-assert 4)
(time-stamp uint64 :offset-assert 8)
((anim art-joint-anim :offset-assert 0)
(comp-data uint32 :offset-assert 4)
(time-stamp uint64 :offset-assert 8)
)
:method-count-assert 9
:size-assert #x10
@@ -248,10 +249,10 @@
:flag-assert #xe00000430
(:methods
(new (symbol type int) _type_ 0)
(art-joint-anim-manager-method-9 () none 9)
(art-joint-anim-manager-method-10 () none 10)
(unload-from-slot (_type_ int) none 11)
(art-joint-anim-manager-method-12 () none 12)
(decompress (_type_ art-joint-anim) art-joint-anim 9)
(update-time-stamp (_type_ art-joint-anim) art-joint-anim 10)
(unload-from-slot (_type_ int) art-joint-anim 11)
(used-bytes-for-slot (_type_ int) int 12)
(unload-from-level (_type_ level) none 13)
)
)
@@ -5,6 +5,36 @@
;; name in dgo: memory-usage-h
;; dgos: ENGINE, GAME
(defenum mem-usage-id
:bitfield #f
:type uint32
(entity 43)
(camera 44)
(res 48)
(bsp-leaf-vis-self 62)
(bsp-leaf-vis-adj 63)
(level-code 65)
(entity-links 66)
(joint 67)
(joint-anim-compressed-control 69)
(joint-anim-fixed 70)
(joint-anim-frame 71)
(art-group 73)
(art-mesh-anim 74)
(art-mesh-geo 75)
(art-joint-geo 76)
(art-joint-anim 77)
(joint-anim-drawable 78)
(eye-anim 111)
)
;; DECOMP BEGINS
(declare-file (debug))
@@ -42,5 +72,7 @@
)
(define-extern mem-size (function basic symbol int int))
+3 -1
View File
@@ -16,6 +16,8 @@
(define-extern *level* level-group)
(define-extern *draw-index* int)
(define-extern *level-index* int)
(define-extern *print-login* symbol)
(defenum load-buffer-mode
:type uint32
@@ -487,7 +489,7 @@
(:methods
(level-get (_type_ symbol) level 9)
(level-get-with-status (_type_ symbol) level 10)
(get-level-by-heap-ptr-and-status (_type_ pointer uint) level 11)
(get-level-by-heap-ptr-and-status (_type_ pointer symbol) level 11)
(level-get-for-use (_type_ symbol symbol) level 12)
(activate-levels! (_type_) int 13)
(level-group-method-14 () none 14)
+2
View File
@@ -5,6 +5,8 @@
;; name in dgo: decomp-h
;; dgos: ENGINE, GAME
(define-extern unpack-comp-lzo (function object object none))
;; DECOMP BEGINS
;; temporary storage for visibility data decompression.
+5
View File
@@ -714,4 +714,9 @@
(defmacro defmethod-mips2c (name method-id method-type)
"Define a mips2c method."
`(method-set! ,method-type ,method-id (__pc-get-mips2c ,name))
)
(defmacro scratchpad-object (type &key (offset 0))
"Access an object on the scratchpad."
`(the-as ,type (&+ *fake-scratchpad-data* ,offset))
)
+5
View File
@@ -792,4 +792,9 @@
(defmacro set-setting! (s &rest args)
`(setting-control-func! set-setting ,s ,@args)
)
(defmacro get-art-by-name (obj name type)
"Helper macro for casting the result of get-art-by-name-method. Generated by decompiler."
`(the-as ,type (get-art-by-name-method ,obj ,name ,type))
)
+15 -18
View File
@@ -3,18 +3,18 @@
;; definition of type joint-control-channel
(deftype joint-control-channel (structure)
((parent joint-control :offset-assert 0)
(frame-group art-joint-anim :offset-assert 4)
(frame-num float :offset-assert 8)
(dist meters :offset-assert 12)
(num-func (function joint-control-channel float float float) :offset-assert 16)
(param float 3 :offset-assert 20)
(frame-interp float 2 :offset-assert 32)
(inspector-amount uint8 :offset-assert 40)
(command joint-control-command :offset-assert 48)
(group-sub-index int8 :offset-assert 56)
(grou-size int8 :offset-assert 57)
(eval-time uint32 :offset-assert 60)
((parent joint-control :offset-assert 0)
(frame-group art-joint-anim :offset-assert 4)
(frame-num float :offset-assert 8)
(dist meters :offset-assert 12)
(num-func (function joint-control-channel float float float float) :offset-assert 16)
(param float 3 :offset-assert 20)
(frame-interp float 2 :offset-assert 32)
(inspector-amount uint8 :offset-assert 40)
(command joint-control-command :offset-assert 48)
(group-sub-index int8 :offset-assert 56)
(group-size int8 :offset-assert 57)
(eval-time uint32 :offset-assert 60)
)
:method-count-assert 9
:size-assert #x40
@@ -74,7 +74,7 @@
)
)
(format #t "~1Tgroup-sub-index: ~D~%" (-> obj group-sub-index))
(format #t "~1Tgroup-size: ~D~%" (-> obj grou-size))
(format #t "~1Tgroup-size: ~D~%" (-> obj group-size))
(format #t "~1Teval-time: ~D~%" (-> obj eval-time))
(label cfg-23)
obj
@@ -165,9 +165,10 @@
:size-assert #x40
:flag-assert #xc00000040
(:methods
(new (symbol type int) _type_ 0)
(joint-control-method-9 () none 9)
(joint-control-method-10 () none 10)
(joint-control-method-11 () none 11)
(debug-print-channels (_type_ symbol) int 11)
)
)
@@ -339,7 +340,3 @@
;; failed to figure out what this is:
0
File diff suppressed because it is too large Load Diff
+2 -5
View File
@@ -121,7 +121,8 @@
:size-assert #x20
:flag-assert #xa00000020
(:methods
(cspace-method-9 () none 9)
(new (symbol type basic) _type_ 0)
(reset-and-assign-geo! (_type_ basic) _type_ 9)
)
)
@@ -186,7 +187,3 @@
;; failed to figure out what this is:
0
+22 -18
View File
@@ -88,8 +88,8 @@
;; definition of type joint-anim-frame
(deftype joint-anim-frame (structure)
((matrices matrix 2 :inline :offset-assert 0)
(data matrix :dynamic :offset-assert 128)
((matrices matrix 2 :inline :offset-assert 0)
(data transformq :inline :dynamic :offset-assert 128)
)
:method-count-assert 9
:size-assert #x80
@@ -249,10 +249,10 @@
:size-assert #x14
:flag-assert #xd00000014
(:methods
(art-method-9 () none 9)
(art-method-10 () none 10)
(art-method-11 () none 11)
(art-method-12 () none 12)
(login (_type_) _type_ 9)
(get-art-by-name-method (_type_ string type) basic 10)
(get-art-idx-by-name-method (_type_ string type) int 11)
(needs-link? (_type_) symbol 12)
)
)
@@ -295,7 +295,8 @@
;; definition of type art-mesh-anim
(deftype art-mesh-anim (art-element)
()
((data basic :dynamic :offset-assert 32)
)
:method-count-assert 13
:size-assert #x20
:flag-assert #xd00000020
@@ -306,7 +307,7 @@
((speed float :offset 20)
(artist-base float :offset 24)
(artist-step float :offset 28)
(eye-anim basic :offset 4)
(eye-anim merc-eye-anim-block :offset 4)
(master-art-group-name string :offset-assert 32)
(master-art-group-index int32 :offset-assert 36)
(blend-shape-anim basic :offset-assert 40)
@@ -348,14 +349,16 @@
:size-assert #x20
:flag-assert #xf00000020
(:methods
(art-group-method-13 () none 13)
(relocate (_type_ kheap (pointer uint8)) none :replace 7)
(link-art! (_type_) art-group 13)
(art-group-method-14 () none 14)
)
)
;; definition of type art-mesh-geo
(deftype art-mesh-geo (art-element)
()
((data basic :dynamic :offset-assert 32)
)
:method-count-assert 13
:size-assert #x20
:flag-assert #xd00000020
@@ -363,7 +366,8 @@
;; definition of type art-joint-geo
(deftype art-joint-geo (art-element)
()
((data joint :dynamic :offset-assert 32)
)
:method-count-assert 13
:size-assert #x20
:flag-assert #xd00000020
@@ -371,9 +375,9 @@
;; definition of type art-joint-anim-manager-slot
(deftype art-joint-anim-manager-slot (structure)
((anim basic :offset-assert 0)
(comp-data uint32 :offset-assert 4)
(time-stamp uint64 :offset-assert 8)
((anim art-joint-anim :offset-assert 0)
(comp-data uint32 :offset-assert 4)
(time-stamp uint64 :offset-assert 8)
)
:method-count-assert 9
:size-assert #x10
@@ -405,10 +409,10 @@
:flag-assert #xe00000430
(:methods
(new (symbol type int) _type_ 0)
(art-joint-anim-manager-method-9 () none 9)
(art-joint-anim-manager-method-10 () none 10)
(unload-from-slot (_type_ int) none 11)
(art-joint-anim-manager-method-12 () none 12)
(decompress (_type_ art-joint-anim) art-joint-anim 9)
(update-time-stamp (_type_ art-joint-anim) art-joint-anim 10)
(unload-from-slot (_type_ int) art-joint-anim 11)
(used-bytes-for-slot (_type_ int) int 12)
(unload-from-level (_type_ level) none 13)
)
)
+1 -1
View File
@@ -686,7 +686,7 @@
(:methods
(level-get (_type_ symbol) level 9)
(level-get-with-status (_type_ symbol) level 10)
(get-level-by-heap-ptr-and-status (_type_ pointer uint) level 11)
(get-level-by-heap-ptr-and-status (_type_ pointer symbol) level 11)
(level-get-for-use (_type_ symbol symbol) level 12)
(activate-levels! (_type_) int 13)
(level-group-method-14 () none 14)
+2
View File
@@ -43,6 +43,8 @@
"load-game-text-info",
// - never fixed this one in jak 1, assumed there was an original bug?
"print-game-text",
// joint asm
"cspace<-parented-transformq-joint!", "(method 11 art-joint-anim-manager)", "make-joint-jump-tables",
"i-hopefully-will-never-exist-dont-add-anything-after-me-please"
],