[decomp] fix joint type (#1827)

* fix joint type

* fix relocate hack bug

* update
This commit is contained in:
water111
2022-08-31 19:48:06 -04:00
committed by GitHub
parent d264779173
commit 937ae0cb97
10 changed files with 58 additions and 42 deletions
+3 -1
View File
@@ -1225,7 +1225,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
auto& name = env.func->guessed_name;
if (name.kind == FunctionName::FunctionKind::METHOD && name.method_id == 7 &&
env.func->type.arg_count() == 3) {
if (env.dts->ts.tc(TypeSpec("structure"), arg0_type.typespec()) && (arg1_i || arg1_u)) {
if ((env.dts->ts.tc(TypeSpec("structure"), arg0_type.typespec()) ||
arg0_type.typespec().base_type() == "inline-array") &&
(arg1_i || arg1_u)) {
auto new_form = pool.alloc_element<GenericElement>(
GenericOperator::make_fixed(FixedOperatorKind::ADDITION_PTR), args.at(0), args.at(1));
result->push_back(new_form);
+1 -1
View File
@@ -12331,7 +12331,7 @@
((status joint-control-status)
(allocated-length uint8)
(active-channels uint8)
(root-channel uint32 :offset 16)
(root-channel (inline-array joint-control) :offset 16)
(blend-index uint8)
(active-frame-interp uint8)
(float-channels uint8)
+4 -1
View File
@@ -702,7 +702,10 @@
[14, "v1", "(pointer art)"]
],
"(method 9 art-joint-anim)": [[9, "v1", "pointer"]],
"joint-control-copy!": [[8, "a0", "uint"]],
"joint-control-copy!": [
[8, "a0", "uint"],
[8, "v1", "uint"]
],
"joint-control-remap!": [
[127, "t9", "(function joint-control joint-control-channel int object)"],
[181, "t9", "(function joint-control joint-control-channel int object)"],
+16 -15
View File
@@ -85,21 +85,21 @@
)
(deftype joint-control (basic)
((status joint-control-status :offset-assert 4)
(allocated-length uint8 :offset-assert 6)
(active-channels uint8 :offset-assert 7)
(root-channel uint32 :offset 16)
(blend-index uint8 :offset-assert 20)
(active-frame-interp uint8 :offset-assert 21)
(float-channels uint8 :offset-assert 22)
(generate-frame-function function :offset-assert 24)
(prebind-function function :offset-assert 28)
(postbind-function function :offset-assert 32)
(effect basic :offset-assert 36)
(interp-select int64 2 :offset-assert 40)
(top-anim top-anim-joint-control :offset-assert 56)
(override basic :offset-assert 60)
(channel joint-control-channel :inline :dynamic :offset-assert 64)
((status joint-control-status :offset-assert 4)
(allocated-length uint8 :offset-assert 6)
(active-channels uint8 :offset-assert 7)
(root-channel (inline-array joint-control) :offset 16)
(blend-index uint8 :offset-assert 20)
(active-frame-interp uint8 :offset-assert 21)
(float-channels uint8 :offset-assert 22)
(generate-frame-function function :offset-assert 24)
(prebind-function function :offset-assert 28)
(postbind-function function :offset-assert 32)
(effect basic :offset-assert 36)
(interp-select int64 2 :offset-assert 40)
(top-anim top-anim-joint-control :offset-assert 56)
(override basic :offset-assert 60)
(channel joint-control-channel :inline :dynamic :offset-assert 64)
)
:method-count-assert 12
:size-assert #x40
@@ -112,6 +112,7 @@
)
)
(deftype matrix-stack (structure)
((top matrix :offset-assert 0)
(data matrix 24 :inline :offset-assert 16)
+8 -2
View File
@@ -158,7 +158,7 @@
(set! (-> v0-0 allocated-length) (the-as uint arg0))
(set! (-> v0-0 active-channels) (the-as uint 0))
(set! (-> v0-0 float-channels) (the-as uint 0))
(set! (-> v0-0 root-channel) (the-as uint (-> v0-0 channel)))
(set! (-> v0-0 root-channel) (the-as (inline-array joint-control) (-> v0-0 channel)))
(set! (-> v0-0 generate-frame-function) create-interpolated-joint-animation-frame)
(set! (-> v0-0 prebind-function) #f)
(set! (-> v0-0 postbind-function) #f)
@@ -666,7 +666,13 @@
(set! (-> arg0 active-channels) (-> arg1 active-channels))
(set! (-> arg0 float-channels) (the-as uint 0))
(set! (-> arg0 root-channel)
(the-as uint (-> arg0 channel (/ (the-as int (- (-> arg1 root-channel) (the-as uint (-> arg1 channel)))) 64)))
(the-as
(inline-array joint-control)
(-> arg0
channel
(/ (the-as int (- (the-as uint (-> arg1 root-channel)) (the-as uint (the-as uint (-> arg1 channel))))) 64)
)
)
)
(let ((v1-10 (min (the-as int (-> arg0 allocated-length)) (the-as int (-> arg1 active-channels)))))
(mem-copy! (the-as pointer (-> arg0 channel)) (the-as pointer (-> arg1 channel)) (* v1-10 64))
+1 -1
View File
@@ -212,7 +212,7 @@
(if (-> obj top-anim)
(&+! (-> obj top-anim) arg0)
)
(+! (-> obj root-channel) arg0)
(&+! (-> obj root-channel) arg0)
(countdown (v1-10 (-> obj allocated-length))
(&+! (-> obj channel v1-10 parent) arg0)
)
+1 -3
View File
@@ -224,9 +224,7 @@
(if (-> obj effect)
(&+! (-> obj effect) arg0)
)
(set! (-> obj root-channel)
(the-as (inline-array joint-control-channel) (+ (the-as uint (-> obj root-channel)) arg0))
)
(set! (-> obj root-channel) (the-as (inline-array joint-control-channel) (&+ (-> obj root-channel) arg0)))
(countdown (v1-6 (-> obj allocated-length))
(&+! (-> obj channel v1-6 parent) arg0)
)
+15 -15
View File
@@ -145,21 +145,21 @@
;; definition of type joint-control
(deftype joint-control (basic)
((status joint-control-status :offset-assert 4)
(allocated-length uint8 :offset-assert 6)
(active-channels uint8 :offset-assert 7)
(root-channel uint32 :offset 16)
(blend-index uint8 :offset-assert 20)
(active-frame-interp uint8 :offset-assert 21)
(float-channels uint8 :offset-assert 22)
(generate-frame-function function :offset-assert 24)
(prebind-function function :offset-assert 28)
(postbind-function function :offset-assert 32)
(effect basic :offset-assert 36)
(interp-select int64 2 :offset-assert 40)
(top-anim top-anim-joint-control :offset-assert 56)
(override basic :offset-assert 60)
(channel joint-control-channel :inline :dynamic :offset-assert 64)
((status joint-control-status :offset-assert 4)
(allocated-length uint8 :offset-assert 6)
(active-channels uint8 :offset-assert 7)
(root-channel (inline-array joint-control) :offset 16)
(blend-index uint8 :offset-assert 20)
(active-frame-interp uint8 :offset-assert 21)
(float-channels uint8 :offset-assert 22)
(generate-frame-function function :offset-assert 24)
(prebind-function function :offset-assert 28)
(postbind-function function :offset-assert 32)
(effect basic :offset-assert 36)
(interp-select int64 2 :offset-assert 40)
(top-anim top-anim-joint-control :offset-assert 56)
(override basic :offset-assert 60)
(channel joint-control-channel :inline :dynamic :offset-assert 64)
)
:method-count-assert 12
:size-assert #x40
+8 -2
View File
@@ -167,7 +167,7 @@
(set! (-> v0-0 allocated-length) (the-as uint arg0))
(set! (-> v0-0 active-channels) (the-as uint 0))
(set! (-> v0-0 float-channels) (the-as uint 0))
(set! (-> v0-0 root-channel) (the-as uint (-> v0-0 channel)))
(set! (-> v0-0 root-channel) (the-as (inline-array joint-control) (-> v0-0 channel)))
(set! (-> v0-0 generate-frame-function) create-interpolated-joint-animation-frame)
(set! (-> v0-0 prebind-function) #f)
(set! (-> v0-0 postbind-function) #f)
@@ -708,7 +708,13 @@
(set! (-> arg0 active-channels) (-> arg1 active-channels))
(set! (-> arg0 float-channels) (the-as uint 0))
(set! (-> arg0 root-channel)
(the-as uint (-> arg0 channel (/ (the-as int (- (-> arg1 root-channel) (the-as uint (-> arg1 channel)))) 64)))
(the-as
(inline-array joint-control)
(-> arg0
channel
(/ (the-as int (- (the-as uint (-> arg1 root-channel)) (the-as uint (the-as uint (-> arg1 channel))))) 64)
)
)
)
(let ((v1-10 (min (the-as int (-> arg0 allocated-length)) (the-as int (-> arg1 active-channels)))))
(mem-copy! (the-as pointer (-> arg0 channel)) (the-as pointer (-> arg1 channel)) (* v1-10 64))
+1 -1
View File
@@ -218,7 +218,7 @@
(if (-> obj top-anim)
(&+! (-> obj top-anim) arg0)
)
(+! (-> obj root-channel) arg0)
(&+! (-> obj root-channel) arg0)
(countdown (v1-10 (-> obj allocated-length))
(&+! (-> obj channel v1-10 parent) arg0)
)