Skip to content

Commit

Permalink
[decomp] flags for continue points (#1303)
Browse files Browse the repository at this point in the history
* make flags!

* finish flags

* refs

* Update game.gp

* fix target decomp

* Update target.gc
  • Loading branch information
ManDude authored Apr 15, 2022
1 parent ab063bf commit 5300a7f
Show file tree
Hide file tree
Showing 21 changed files with 3,282 additions and 3,202 deletions.
4 changes: 2 additions & 2 deletions decompiler/IR2/FormExpressionAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,8 @@ void SimpleExpressionElement::update_from_stack_fpr_to_gpr(const Env& env,
m_popped = false;
update_from_stack(env, pool, stack, result, allow_side_effects);
} else {
throw std::runtime_error(
fmt::format("FPR -> GPR applied to a {} in {}", src_type.print(), to_string(env)));
throw std::runtime_error(fmt::format("FPR -> GPR applied to a {} in {} at {}", src_type.print(),
to_string(env), m_my_idx));
}
}

Expand Down
21 changes: 19 additions & 2 deletions decompiler/config/all-types.gc
Original file line number Diff line number Diff line change
Expand Up @@ -9358,7 +9358,7 @@
((want level-buffer-state 2 :inline :offset-assert 4)
(vis-nick symbol :offset-assert 36)
(command-list pair :offset-assert 40)
(object-name symbol 256 :offset-assert 44)
(object-name symbol 256 :offset-assert 44) ;; TODO string
(object-status basic 256 :offset-assert 1068)
)
:method-count-assert 21
Expand All @@ -9381,10 +9381,27 @@
)
)

(defenum continue-flags
:type uint32
:bitfield #t
(contf00)
(contf01)
(warp)
(demo)
(intro)
(sage-intro)
(sage-demo-convo)
(title)
(contf08)
(contf09)
(game-start)
(sage-ecorocks)
)

(deftype continue-point (basic)
((name string :offset-assert 4)
(level symbol :offset-assert 8)
(flags uint32 :offset-assert 12)
(flags continue-flags :offset-assert 12)
(trans vector :inline :offset-assert 16)
(quat quaternion :inline :offset-assert 32)
(camera-trans vector :inline :offset-assert 48)
Expand Down
100 changes: 50 additions & 50 deletions decompiler/config/jak1_ntsc_black_label/label_types.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -730,26 +730,26 @@
["L878", "float", true],
["L879", "float", true],
["L880", "float", true],
["L881", "(pointer float)", 1],
["L881", "float", true],
["L882", "float", true],
["L883", "float", true],
["L884", "(pointer float)", 1],
["L885", "(pointer float)", 1],
["L884", "float", true],
["L885", "float", true],
["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],
["L888", "float", true],
["L889", "float", true],
["L890", "float", true],
["L891", "float", true],
["L892", "float", true],
["L893", "float", true],
["L894", "float", true],
["L895", "float", true],
["L896", "(pointer float)", 1],
["L897", "(pointer float)", 1],
["L898", "(pointer float)", 1],
["L896", "float", true],
["L897", "float", true],
["L898", "float", true],
["L899", "float", true],
["L900", "(pointer float)", 1],
["L900", "float", true],
["L901", "uint64", true],
["L904", "uint64", true],
["L905", "uint64", true],
Expand Down Expand Up @@ -990,14 +990,14 @@
["L509", "(inline-array list-field)", 12],
["L523", "vector"],
["L524", "vector"],
["L649", "(pointer float)", 1],
["L650", "(pointer float)", 1],
["L651", "(pointer float)", 1],
["L652", "(pointer float)", 1],
["L653", "(pointer float)", 1],
["L654", "(pointer float)", 1],
["L655", "(pointer float)", 1],
["L656", "(pointer float)", 1],
["L649", "float", true],
["L650", "float", true],
["L651", "float", true],
["L652", "float", true],
["L653", "float", true],
["L654", "float", true],
["L655", "float", true],
["L656", "float", true],
["L657", "uint64", true],
["L658", "uint64", true],
["L663", "uint64", true],
Expand Down Expand Up @@ -1108,7 +1108,7 @@
["L765", "float", true],
["L766", "float", true],
["L767", "float", true],
["L768", "(pointer float)", 1],
["L768", "float", true],
["L769", "float", true],
["L770", "float", true],
["L771", "float", true],
Expand Down Expand Up @@ -1377,7 +1377,7 @@
["L412", "float", true],
["L413", "float", true],
["L414", "float", true],
["L415", "(pointer float)", 1],
["L415", "float", true],
["L416", "float", true],
["L417", "float", true],
["L418", "float", true],
Expand All @@ -1393,18 +1393,18 @@
["L428", "float", true],
["L429", "float", true],
["L430", "float", true],
["L431", "(pointer float)", 1],
["L431", "float", true],
["L432", "float", true],
["L433", "float", true],
["L434", "float", true],
["L435", "float", true],
["L436", "float", true],
["L437", "float", true],
["L438", "(pointer float)", 1],
["L438", "float", true],
["L439", "float", true],
["L440", "float", true],
["L441", "float", true],
["L442", "(pointer float)", 1],
["L442", "float", true],
["L443", "float", true],
["L444", "float", true],
["L445", "float", true],
Expand All @@ -1428,10 +1428,10 @@
["L463", "float", true],
["L464", "float", true],
["L465", "float", true],
["L466", "(pointer float)", 1],
["L466", "float", true],
["L467", "float", true],
["L468", "float", true],
["L469", "(pointer float)", 1],
["L469", "float", true],
["L470", "uint64", true],
["L498", "float", true],
["L499", "uint64", true],
Expand Down Expand Up @@ -1494,11 +1494,11 @@
["L731", "float", true],
["L732", "float", true],
["L733", "float", true],
["L734", "(pointer float)", 1],
["L735", "(pointer float)", 1],
["L736", "(pointer float)", 1],
["L737", "(pointer float)", 1],
["L738", "(pointer float)", 1],
["L734", "float", true],
["L735", "float", true],
["L736", "float", true],
["L737", "float", true],
["L738", "float", true],
["L739", "float", true],
["L740", "float", true],
["L741", "float", true],
Expand All @@ -1510,7 +1510,7 @@
["L747", "float", true],
["L748", "float", true],
["L749", "float", true],
["L750", "(pointer float)", 1],
["L750", "float", true],
["L751", "float", true],
["L752", "float", true],
["L753", "float", true],
Expand All @@ -1527,7 +1527,7 @@
["L764", "float", true],
["L765", "float", true],
["L766", "float", true],
["L767", "(pointer float)", 1],
["L767", "float", true],
["L768", "float", true],
["L769", "float", true],
["L770", "float", true],
Expand All @@ -1546,8 +1546,8 @@
["L783", "float", true],
["L784", "float", true],
["L785", "float", true],
["L786", "(pointer float)", 1],
["L787", "(pointer float)", 1],
["L786", "float", true],
["L787", "float", true],
["L788", "float", true],
["L789", "float", true],
["L790", "float", true],
Expand All @@ -1574,7 +1574,7 @@
["L811", "float", true],
["L812", "float", true],
["L813", "float", true],
["L814", "(pointer float)", 1],
["L814", "float", true],
["L815", "uint64", true]
],

Expand All @@ -1587,7 +1587,7 @@
["L201", "float", true],
["L202", "float", true],
["L203", "float", true],
["L204", "(pointer float)", 1],
["L204", "float", true],
["L205", "uint64", true],
["L206", "uint64", true],
["L207", "uint64", true],
Expand Down Expand Up @@ -1636,13 +1636,13 @@
["L367", "attack-info"],
["L370", "attack-info"],
["L371", "attack-info"],
["L384", "(pointer float)", 1],
["L384", "(pointer float)", 1],
["L385", "(pointer float)", 1],
["L386", "(pointer float)", 1],
["L387", "(pointer float)", 1],
["L388", "(pointer float)", 1],
["L389", "(pointer float)", 1],
["L384", "float", true],
["L384", "float", true],
["L385", "float", true],
["L386", "float", true],
["L387", "float", true],
["L388", "float", true],
["L389", "float", true],
["L390", "float", true],
["L391", "float", true],
["L392", "float", true],
Expand Down Expand Up @@ -1713,7 +1713,7 @@
["L457", "float", true],
["L458", "float", true],
["L459", "float", true],
["L460", "(pointer float)", 1],
["L460", "float", true],
["L461", "rgba", true],
["L462", "uint64", true],
["L463", "uint64", true],
Expand Down Expand Up @@ -1765,8 +1765,8 @@
["L438", "float", true],
["L439", "float", true],
["L440", "float", true],
["L441", "(pointer float)", 1],
["L442", "(pointer float)", 1],
["L441", "float", true],
["L442", "float", true],
["L443", "float", true],
["L444", "float", true],
["L445", "float", true],
Expand All @@ -1781,7 +1781,7 @@
["L454", "float", true],
["L455", "float", true],
["L456", "float", true],
["L457", "(pointer float)", 1],
["L457", "float", true],
["L458", "uint64", true],
["L459", "uint64", true],
["L460", "uint64", true],
Expand Down Expand Up @@ -1920,7 +1920,7 @@
["L735", "float", true],
["L736", "float", true],
["L737", "float", true],
["L738", "(pointer float)", 1],
["L738", "float", true],
["L739", "float", true],
["L740", "float", true],
["L741", "float", true],
Expand Down
23 changes: 18 additions & 5 deletions decompiler/config/jak1_ntsc_black_label/type_casts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3606,8 +3606,8 @@
],

"v-slrp!": [
[19, "v1", "(pointer float)"],
[26, "v1", "(pointer float)"]
[54, "s3", "float"],
[65, "s3", "float"]
],

"clmf-pos-rot": [
Expand Down Expand Up @@ -4866,7 +4866,10 @@

"(code plant-boss-root-idle)": [[17, "v1", "art-joint-anim"]],

"(code plant-boss-eat)": [[274, "v1", "art-joint-anim"]],
"(code plant-boss-eat)": [
[22, "v1", "float"],
[274, "v1", "art-joint-anim"]
],

"(code plant-boss-vulnerable)": [
[149, "v1", "art-joint-anim"],
Expand Down Expand Up @@ -5417,12 +5420,14 @@
],

"target-hit-ground-anim": [
[55, "v1", "float"],
[79, "v1", "art-joint-anim"],
[312, "v1", "art-joint-anim"],
[389, "v1", "art-joint-anim"],
[441, "v1", "art-joint-anim"],
[520, "v1", "art-joint-anim"],
[578, "v1", "art-joint-anim"],
[660, "v1", "float"],
[675, "v1", "art-joint-anim"],
[736, "v1", "art-joint-anim"],
[846, "v1", "art-joint-anim"]
Expand All @@ -5435,17 +5440,21 @@
[234, "v1", "art-joint-anim"],
[298, "v1", "art-joint-anim"],
[389, "v1", "art-joint-anim"],
[503, "v1", "art-joint-anim"]
[503, "v1", "art-joint-anim"],
[626, "v1", "float"]
],

"(code target-walk)": [
[146, "v1", "art-joint-anim"],
[243, "v1", "art-joint-anim"]
[243, "v1", "art-joint-anim"],
[527, "v1", "float"],
[591, "v1", "float"]
],

"(code target-slide-down)": [[26, "v1", "art-joint-anim"]],

"(code target-jump-forward)": [[13, "v1", "art-joint-anim"]],
"(code target-jump)": [[127, "v1", "float"]],

"(code target-double-jump)": [[24, "v1", "art-joint-anim"]],

Expand All @@ -5464,6 +5473,10 @@
[168, "v1", "art-joint-anim"]
],

"(code target-attack-uppercut)": [
[39, "v1", "float"]
],

"mod-var-jump": [
[77, "f0", "float"],
[80, "f0", "float"],
Expand Down
22 changes: 20 additions & 2 deletions goal_src/engine/game/game-info-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,29 @@

(define-extern *load-state* load-state)

;; a game checkpoint

(defenum continue-flags
:type uint32
:bitfield #t
(contf00)
(contf01)
(warp)
(demo)
(intro)
(sage-intro)
(sage-demo-convo)
(title)
(contf08)
(contf09)
(game-start)
(sage-ecorocks)
)

;; static data for a continue point
(deftype continue-point (basic)
((name string :offset-assert 4)
(level symbol :offset-assert 8)
(flags uint32 :offset-assert 12)
(flags continue-flags :offset-assert 12)
(trans vector :inline :offset-assert 16)
(quat quaternion :inline :offset-assert 32)
(camera-trans vector :inline :offset-assert 48)
Expand Down
Loading

0 comments on commit 5300a7f

Please sign in to comment.