Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decomp: finish effect-control -- fixed ambient-sound type def #876

Merged
merged 2 commits into from
Oct 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions decompiler/IR2/FormExpressionAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2687,13 +2687,8 @@ void FunctionCallElement::update_from_stack(const Env& env,
std::swap(all_pop_vars.at(0), all_pop_vars.at(1));
}

if (tp_type.kind == TP_Type::Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION) {
if (unstacked.at(0)->to_string(env) != "run-function-in-process") {
throw std::runtime_error(
fmt::format("Expression pass could not find the run-function-in-process function. Found "
"{} instead. Make sure there are no casts on this function.",
all_pop_vars.at(0).to_string(env)));
}
if (tp_type.kind == TP_Type::Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION &&
unstacked.at(0)->to_string(env) == "run-function-in-process") {
unstacked.at(0) = pool.form<ConstantTokenElement>("run-now-in-process");
}

Expand Down
24 changes: 12 additions & 12 deletions decompiler/config/all-types.gc
Original file line number Diff line number Diff line change
Expand Up @@ -2962,7 +2962,7 @@
(falloff-near int32 :offset-assert 80)
(falloff-far int32 :offset-assert 84)
(falloff-mode int32 :offset-assert 88)
(params sound-play-parms :offset-assert 92)
(params (pointer float) :offset-assert 92)
(param-count int32 :offset-assert 96)
(entity entity :offset-assert 100)
(sound-count int32 :offset-assert 104)
Expand Down Expand Up @@ -11556,20 +11556,20 @@
(last-frame-num float :offset-assert 16)
(channel-offset int32 :offset-assert 20)
(res res-lump :offset-assert 24)
(name uint32 :offset-assert 28)
(name (pointer res-tag) :offset-assert 28)
(param uint32 :offset-assert 32)
)
:method-count-assert 15
:size-assert #x24
:flag-assert #xf00000024
(:methods
(new (symbol type process-drawable) _type_)
(dummy-9 () none 9)
(dummy-10 (_type_ symbol float int) none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(TODO-RENAME-9 (_type_) none 9)
(dummy-10 (_type_ symbol float int) object 10)
(dummy-11 (_type_ symbol basic int basic int) none 11)
(dummy-12 (_type_ symbol basic int basic sound-name) int 12)
(set-channel-offset! (_type_ int) none 13)
(dummy-14 () none 14)
(TODO-RENAME-14 (_type_ float float float) none 14)
)
)

Expand Down Expand Up @@ -15141,7 +15141,7 @@
(define-extern get-sound-buffer-entry (function pointer))
(define-extern sound-trans-convert (function vector3w vector int))
(define-extern sound-stop (function sound-id int))
(define-extern effect-param->sound-spec (function sound-spec sound-play-parms int sound-spec))
(define-extern effect-param->sound-spec (function sound-spec (pointer float) int sound-spec))
(define-extern ear-trans (function vector))
(define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id))
(define-extern sound-play-by-name (function sound-name sound-id int int int uint vector sound-id))
Expand Down Expand Up @@ -16631,7 +16631,7 @@
(define-extern sp-get-particle (function sparticle-system int sparticle-launch-state sparticle-cpuinfo))
(define-extern particle-adgif (function adgif-shader texture-id none))
(define-extern lookup-part-group-by-name (function string basic))
(define-extern lookup-part-group-pointer-by-name (function string (pointer sparticle-launch-group)))
(define-extern lookup-part-group-pointer-by-name (function string (pointer sparticle-launch-group))) ;; this can actually be a pointer to way more than just a SLG - can be - SLG | sparticle-launcher | sound-spec | death-info. See effect-control::10
(define-extern unlink-part-group-by-heap (function kheap int))
(define-extern particle-setup-adgif (function adgif-shader texture-id none))
(define-extern sp-queue-launch (function sparticle-system sparticle-launcher vector int))
Expand Down Expand Up @@ -19560,7 +19560,7 @@

;; - Functions

(define-extern target-land-effect function)
(define-extern target-land-effect (function none :behavior target))
(define-extern target-hit-ground-anim function)
(define-extern mod-var-jump function)
(define-extern init-var-jump function)
Expand Down Expand Up @@ -20298,11 +20298,11 @@

;; - Functions

(define-extern sound-name-with-material function)
(define-extern sound-name-with-material (function symbol int string sound-name))

;; - Unknowns

;;(define-extern *footstep-surface* object) ;; unknown type
(define-extern *footstep-surface* int) ;; unknown type


;; ----------------------
Expand Down
12 changes: 12 additions & 0 deletions decompiler/config/jak1_ntsc_black_label/label_types.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,18 @@
["L733", "uint64", true]
],

"effect-control": [
["L300", "float", true],
["L301", "float", true],
["L302", "float", true],
["L306", "float", true],
["L307", "float", true],
["L309", "float", true],
["L310", "float", true],
["L312", "float", true],
["L314", "float", true]
],

// please do not add things after this entry! git is dumb.
"object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": []
}
18 changes: 18 additions & 0 deletions decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2733,5 +2733,23 @@
[16, "event-message-block"]
],

"(method 10 effect-control)": [
[16, "event-message-block"],
[96, "vector"],
[112, "vector"],
[128, "vector"],
[144, "vector"]
],

"(method 11 effect-control)": [
[16, "vector"],
[32, "vector"]
],

"(method 12 effect-control)": [
[16, "sound-spec"],
[96, "vector"]
],

"placeholder-do-not-add-below!": []
}
13 changes: 13 additions & 0 deletions decompiler/config/jak1_ntsc_black_label/type_casts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3911,5 +3911,18 @@
[2, "v1", "(pointer process-drawable)"]
],

"(method 10 effect-control)": [
[88, "v1", "collide-shape-moving"],
[143, "s3", "(pointer sparticle-launch-group)"],
[147, "s3", "sparticle-launch-group"],
[199, "s3", "sparticle-launch-group"],
[240, "s3", "basic"],
[286, "s3", "basic"],
[346, "s3", "basic"],
[367, "s3", "basic"],
[367, "s3", "basic"],
[[371, 451], "s3", "death-info"]
],

"placeholder-do-not-add-below": []
}
4 changes: 2 additions & 2 deletions goal_src/engine/ambient/ambient.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@
(if a1-7
(effect-param->sound-spec
s4-2
(the-as sound-play-parms a1-7)
(the-as (pointer float) a1-7)
(the-as int (-> sv-112 elt-count))
)
)
Expand Down Expand Up @@ -1115,7 +1115,7 @@
)
(t9-2
a0-5
(the-as sound-play-parms (&+ (-> v1-8 data-base) (-> a1-2 data-offset)))
(the-as (pointer float) (&+ (-> v1-8 data-base) (-> a1-2 data-offset)))
(the-as int (-> (the-as (pointer res-tag) s3-0) 0 elt-count))
)
)
Expand Down
32 changes: 18 additions & 14 deletions goal_src/engine/game/effect-control-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,31 @@
;; name in dgo: effect-control-h
;; dgos: GAME, ENGINE

(define-extern effect-param->sound-spec (function sound-spec (pointer float) int sound-spec))

;; decomp begins

(deftype effect-control (basic)
((process process-drawable :offset-assert 4)
(flags uint32 :offset-assert 8)
(last-frame-group art-joint-anim :offset-assert 12)
(last-frame-num float :offset-assert 16)
(channel-offset int32 :offset-assert 20)
(res res-lump :offset-assert 24)
(name uint32 :offset-assert 28)
(param uint32 :offset-assert 32)
((process process-drawable :offset-assert 4)
(flags uint32 :offset-assert 8)
(last-frame-group art-joint-anim :offset-assert 12)
(last-frame-num float :offset-assert 16)
(channel-offset int32 :offset-assert 20)
(res res-lump :offset-assert 24)
(name (pointer res-tag) :offset-assert 28)
(param uint32 :offset-assert 32)
)
:method-count-assert 15
:size-assert #x24
:flag-assert #xf00000024
(:methods
(new (symbol type process-drawable) _type_ 0)
(dummy-9 () none 9)
(dummy-10 (_type_ symbol float int) none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(new (symbol type process-drawable) _type_)
(TODO-RENAME-9 (_type_) none 9)
(dummy-10 (_type_ symbol float int) object 10)
(dummy-11 (_type_ symbol basic int basic int) none 11)
(dummy-12 (_type_ symbol basic int basic sound-name) int 12)
(set-channel-offset! (_type_ int) none 13)
(dummy-14 () none 14)
(TODO-RENAME-14 (_type_ float float float) none 14)
)
)

Expand Down
Loading