From 9535cd6360093dd25628f57022dd0760ba4f5275 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Mon, 26 Sep 2022 20:07:35 -0400 Subject: [PATCH] d/jak2: almost finished `progress-draw` --- decompiler/config/jak2/all-types.gc | 199 ++++++++++++------ decompiler/config/jak2/hacks.jsonc | 44 +++- decompiler/config/jak2/label_types.jsonc | 97 ++++++++- decompiler/config/jak2/stack_structures.jsonc | 20 +- decompiler/config/jak2/type_casts.jsonc | 171 +++++++++++++++ 5 files changed, 466 insertions(+), 65 deletions(-) diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 9f25109aab..4b8e0d6e4a 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -3069,7 +3069,7 @@ (bucket-311 311) ;; depth-cue (tex-all-sprite 312) - (bucket-313 313) ;; particles + (bucket-313 313) ;; particles | progress (percent bar) (bucket-314 314) ;; shadow (bucket-315 315) ;; effects (tex-all-warp 316) ;; tex @@ -3077,7 +3077,7 @@ (debug-no-zbuf1 318) ;; debug, no zbuf (tex-all-map 319) ;; tex - (bucket-320 320) ;; hud + (bucket-320 320) ;; hud | progress (screen-filter 321) ;; hud letterbox, no zbuf (bucket-322 322) ;; hud (bucket-323 323) ;; hud @@ -6578,9 +6578,85 @@ (defenum game-text-id :type uint32 :bitfield #f -;; GAME-TEXT-ID ENUM BEGINS (pause 257) -;; GAME-TEXT-ID ENUM ENDS + (progress-on-off-1TODO 270) + (progress-on-off-2TODO 271) + (progress-1k2jn1kj2n3 272) + (progress-kj1231nj23 286) + (progress-12434g343v 287) + (progress-video-asda 288) + (progress-video-j1n2 289) + (progress-draw-yes-or-no-1-TODO 292) + (progress-draw-yes-or-no-2-TODO 293) + (progress-1ikjhb231hjik2b31ihb231 303) + (progress-unlocked-oj1n23jn1 345) + (progress-unlocked-k1231kkj 346) + (progress-unlocked-jn12j 347) + (progress-unlocked-m12312 348) + (progress-unlocked-1231h2bn 349) + (progress-unlocked-akjisndaj 350) + (progress-unlocked-iwudnq 351) + (progress-unlocked-n51i51n 352) + (progress-1k2ijn1jkn3 360) + (progress-1kj2n31j23 367) + (progress-iko1jn231kjhn23 368) + (progress-1klj2n31j2n3 369) + (progress-i1un23i12b341 370) + (progress-2kj3n2kji3n42 377) + (progress-draw-continue-retry-1-TODO 382) + (progress-j1n23j1kn23kjn12 395) + (progress-2j021j394j 396) + (progress-kj6n324i63n 397) + (progress-3iou4n3i45n3 398) + (progress-39u4n359n45 399) + (progress-iun34593n45 400) + (progress-on2394234n 401) + (progress-l1jkn231jkn23 402) + (progress-kj1n231kjn2 403) + (progress-1lkjn231jnk2 404) + (progress-n12n211n1n 405) + (progress-2iu3bn4289u34n 406) + (progress-oj1n23kj1n23123 409) + (progress-1kjn231kjn23 410) + (progress-1kj2b31k2b3 411) + (progress-j1nb23kj1hbn2 412) + (progress-1kj2bkoij1231 413) + (progress-1nmn1221n21n12n 414) + (progress-busy-loading-TODO 416) + (progress-1jib12o3nj12j3 419) + (progress-1m23n1n23n21 420) + (progress-1jk2n31jkn23n1j 421) + (progress-1n23kjn12nk3j12 422) + (progress-draw-continue-retry-2-TODO 423) + (progress-kj12k3j1n23n 424) + (progress-1kj2bn31kjhnb2 426) + (progress-jk1n23kj1n2 429) + (progress-k1jn23k1h23b 430) + (progress-k1jn23kj1n23 431) + (progress-1kjn231j2 432) + (progress-1kj2n31kjn231 433) + (progress-1kj2n31jkn23 434) + (progress-1kjn2123919 435) + (progress-jn12n3j1n2 436) + (progress-n12jin313 437) + (progress-main-23jn42 531) + (progress-main-63j46j3n4 532) + (progress-main-m123j1m 533) + (progress-main-634jn6 534) + (progress-main-52o352nm 535) + (progress-main-63jk46n3 536) + (progress-main-j324nm3 537) + (progress-main-k1j2n3n1 538) + (progress-main-6mn346mn 539) + (progress-main-63jn463jn 540) + (progress-main-63j46n3j 541) + (progress-main-52kj3n52 542) + (progress-main-52jn35j2 543) + (progress-main-3643m6m 544) + (progress-main-36j46jn 545) + (progress-main-63mn46nm 546) + (progress-main-364jn6n 547) + (progress-ikj123i1khb231 784) ) @@ -8766,7 +8842,7 @@ (:methods (dummy-9 () none 9) (dummy-10 () none 10) - (dummy-11 () none 11) + (open? (_type_) symbol 11) (dummy-12 () none 12) (dummy-13 () none 13) ) @@ -11905,7 +11981,7 @@ (last-continue continue-point :offset-assert 244) (play-list (array game-task-info) :offset-assert 248) (sub-task-list (array game-task-node-info) :offset-assert 252) - (unknown-pad5 array :offset-assert 256) + (mission-list (array game-task-node-info) :offset-assert 256) (task-counter uint32 :offset-assert 260) (unknown-pad6 uint32 :offset-assert 264) (level-opened uint8 32 :offset-assert 268) @@ -20160,7 +20236,7 @@ (deftype menu-option (basic) ((name uint32 :offset-assert 4) - (scale basic :offset-assert 8) + (scale float :offset-assert 8) (unknown function :offset-assert 12) ;; No idea what is going on here.... ;; but i believe they are all `menu-options` -- look at `(method 24 progress)` @@ -20292,6 +20368,7 @@ (deftype menu-memcard-slot-option (menu-option) ((sprites hud-sprite 5 :inline :offset-assert 48) ;; total guess + (something-hud-related basic :offset 112) (pad uint8 32) ) :method-count-assert 12 @@ -29079,7 +29156,7 @@ (define-extern hide-hud-quick (function symbol none)) (define-extern show-hud (function object none)) (define-extern hud-hidden? (function symbol)) -;; (define-extern set-hud-piece-position! function) +(define-extern set-hud-piece-position! (function basic int int none)) ;; (define-extern set-as-offset-from! function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -29206,7 +29283,7 @@ (total-num-tasks int32 :offset-assert 208) (scene-player-act int32 :offset-assert 212) (stereo-mode-backup int32 :offset-assert 216) - (secrets-unlocked basic :offset-assert 220) + (secrets-unlocked symbol :offset-assert 220) (missions-total-spacing float :offset-assert 224) (clear-screen basic :offset-assert 228) ) @@ -29243,7 +29320,7 @@ (define-extern hide-progress-screen (function none)) (define-extern progress-allowed? (function symbol)) (define-extern menu-update-purchase-secrets (function menu-secret-option none)) -(define-extern progress-trans (function none :behavior progress)) ;; TODO - assertion hit when defining behavior +(define-extern progress-trans (function none)) ;; TODO - assertion hit when defining behavior (define-extern begin-scan (function hud-box progress int)) (define-extern end-scan (function hud-box float int)) (define-extern progress-post (function none :behavior progress)) @@ -29270,61 +29347,61 @@ :flag-assert #x900000028 ) -(define-extern progress-selected (function int none :behavior progress)) -;; (define-extern draw-percent-bar function) ;; (function int int float rgba none) -;; (define-extern draw-highlight function) -;; (define-extern draw-busy-loading function) -;; (define-extern draw-previous-next function) -;; (define-extern draw-up-down function) -;; (define-extern draw-missions-up-down function) -;; (define-extern draw-scene-up-down function) -;; (define-extern begin-scissor function) -;; (define-extern end-scissor function) -;; (define-extern begin-scissor-secret function) -;; (define-extern end-scissor-secret function) -;; (define-extern begin-scissor-missions function) -;; (define-extern end-scissor-missions function) -;; (define-extern begin-scissor-scene function) -;; (define-extern end-scissor-scene function) -;; (define-extern begin-scissor-level function) -;; (define-extern end-scissor-level function) -;; (define-extern print-language-name function) ;; (function int font-context int symbol font-context) -;; (define-extern unlocked-secret-menu? function) -(define-extern memcard-unlocked-secrets? (function symbol symbol)) -;; (define-extern num-unlocked-secret? function) -;; (define-extern print-menu-text function) -;; (define-extern draw-yes-no function) -;; (define-extern draw-continue-retry function) -;; (define-extern draw-savegame-box function) -;; (define-extern get-level-icon-id-01 function) -;; (define-extern get-level-icon-id-02 function) -;; (define-extern get-level-icon-id-03 function) -;; (define-extern get-level-icon-id-04 function) -;; (define-extern draw-decoration function) -;; (define-extern draw-missions-decoration function) -;; (define-extern draw-sound-options-decoration function) -;; (define-extern draw-decoration-secrets function) -;; (define-extern draw-decoration-load-save function) -;; (define-extern sort-task-node-result function) -;; (define-extern find-mission-text-at-index function) -;; (define-extern draw-secret-list function) -;; (define-extern draw-highscore-icon function) +(define-extern progress-selected (function int int :behavior progress)) +(define-extern draw-percent-bar (function int int float rgba none)) ;; +(define-extern draw-highlight (function int int float pointer)) +(define-extern draw-busy-loading (function object float :behavior progress)) +(define-extern draw-previous-next (function object int int none)) +(define-extern draw-up-down (function object none)) +(define-extern draw-missions-up-down (function object none)) +(define-extern draw-scene-up-down (function object none)) +(define-extern begin-scissor (function vector none)) +(define-extern end-scissor (function none)) +(define-extern begin-scissor-secret (function vector none)) +(define-extern end-scissor-secret (function none)) +(define-extern begin-scissor-missions (function vector float none)) +(define-extern end-scissor-missions (function vector none)) +(define-extern begin-scissor-scene (function vector none)) +(define-extern end-scissor-scene (function none)) +(define-extern begin-scissor-level (function vector none)) +(define-extern end-scissor-level (function none)) +(define-extern print-language-name (function game-text-id font-context int symbol none)) +(define-extern unlocked-secret-menu? (function symbol)) ;; a bit field of some kind! probably task related - HANG! +(define-extern memcard-unlocked-secrets? "TODO - cleanup bitfields / arg passing" (function symbol symbol)) +(define-extern num-unlocked-secret? "@returns The number of secrets currently unlocked" (function int int)) ;; a bit field of some kind! probably task related +(define-extern print-menu-text (function game-text-id float font-context progress none)) +(define-extern draw-yes-no (function progress float none)) +(define-extern draw-continue-retry (function progress float none)) +(define-extern draw-savegame-box (function menu-memcard-slot-option float float float float none)) +(define-extern get-level-icon-id-01 "TODO - Icon id enum perhaps?" (function int uint)) +(define-extern get-level-icon-id-02 "TODO - Icon id enum perhaps?" (function int uint)) +(define-extern get-level-icon-id-03 "TODO - Icon id enum perhaps?" (function int uint)) +(define-extern get-level-icon-id-04 "TODO - Icon id enum perhaps?" (function int uint)) +(define-extern draw-decoration (function none)) +(define-extern draw-missions-decoration (function none)) +(define-extern draw-sound-options-decoration (function menu-slider-option font-context int symbol none)) +(define-extern draw-decoration-secrets (function menu-secret-option font-context float none)) +(define-extern draw-decoration-load-save (function symbol font-context float int none)) +(define-extern sort-task-node-result (function object none)) +(define-extern find-mission-text-at-index (function int game-task-node-info)) +(define-extern draw-secret-list (function none)) +(define-extern draw-highscore-icon (function menu-highscores-option uint int int none)) ;; (define-extern draw-highscore-cup function) -;; (define-extern get-highscore-score function) -;; (define-extern eval-highscore function) -;; (define-extern str-print-time function) -;; (define-extern print-highscore function) -;; (define-extern get-highscore-text function) -;; (define-extern get-highscore-text-sub function) -;; (define-extern get-highscore-icon function) -;; (define-extern get-highscore-type function) -(define-extern highscore-available? (function symbol)) +(define-extern get-highscore-score "TODO - takes and returns an enum?" (function int int)) +(define-extern eval-highscore (function object none)) +(define-extern str-print-time (function float string)) +(define-extern print-highscore (function print-highscore-obj none)) +(define-extern get-highscore-text "TODO - takes an enum?" (function int game-text-id)) +(define-extern get-highscore-text-sub "TODO - takes an enum?" (function int game-text-id)) +(define-extern get-highscore-icon "TODO - Icon id enum perhaps?" (function int uint)) +(define-extern get-highscore-type "TODO - takes an enum?" (function int symbol)) +(define-extern highscore-available? (function int symbol)) (define-extern get-num-highscores (function int)) (define-extern get-next-highscore (function int int)) (define-extern get-prev-highscore (function int int)) -;; (define-extern get-highscore-icon-scale function) -;; (define-extern get-highscore-icon-xoffset function) -;; (define-extern get-highscore-icon-yoffset function) +(define-extern get-highscore-icon-scale "TODO - takes an enum?" (function int float)) +(define-extern get-highscore-icon-xoffset (function int)) +(define-extern get-highscore-icon-yoffset "TODO - takes an enum?" (function int int)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ocean ;; diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index e7ae430d5e..1ee5310186 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -243,7 +243,17 @@ " textures ~192H~5DK ~280Htextures~456H~5DK~%": 2, " misc ~192H~5DK ~280Hsprite~456H~5DK~%": 2, " entity ~192H~5DK~%": 1, - " pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%": 2 + " pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%": 2, + "~33L~S~32L ~S": 2, + "~32L~S ~33L~S~1L": 2, + "~35L~S~33L ~S": 2, + "~1L~S~35L ~S": 2, + "~35L~S ~1L~S~1L": 2, + "~33L~S~35L ~S": 2, + "~33L~C~34L~S~33L~C": 3, + "~35L~S ~33L~S~1L": 2, + "~33L~S ~35L~S~1L": 2, + "~33L~C": 1 }, "blocks_ending_in_asm_branch": { @@ -298,7 +308,37 @@ // Add information about those format instructions here. // e.g. "function-name":[[op, argc], [op, argc], ...] // where "op" is the op number for the call to format. - "dynamic_format_arg_counts": {}, + "dynamic_format_arg_counts": { + "(method 10 menu-loading-option)": [ + [118, 1] + ], + "(method 10 menu-insufficient-space-option)": [ + [63, 1], + [103, 1] + ], + "(method 10 menu-secrets-insufficient-space-option)": [ + [55, 1] + ], + "(method 10 menu-card-removed-option)": [ + [48, 1] + ], + "(method 10 menu-format-card-option)": [ + [49, 1] + ], + "(method 10 menu-create-game-option)": [ + [49, 1] + ], + "(method 10 menu-error-auto-saving-option)": [ + [72, 1] + ], + "(method 10 menu-error-loading-option)": [ + [64, 1], + [99, 1] + ], + "(method 10 menu-insert-card-option)": [ + [48, 1] + ] + }, "mips2c_functions_by_name": [ "collide-do-primitives", diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 86d2bede55..d8ee56d606 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -252,5 +252,100 @@ ], "target-gun": [["L595", "uint64", true]], "tie-methods": [["L328", "(inline-array tie-init-data)", 6]], - "nav-mesh": [["L347", "(inline-array vector)", 2]] + "progress-draw": [ + ["L933", "uint64", true], + ["L934", "uint64", true], + ["L935", "uint64", true], + ["L936", "uint64", true], + ["L937", "uint64", true], + ["L938", "uint64", true], + ["L939", "uint64", true], + ["L940", "uint64", true], + ["L941", "uint64", true], + ["L942", "uint64", true], + ["L943", "uint64", true], + ["L944", "uint64", true], + ["L945", "uint64", true], + ["L946", "uint64", true], + ["L947", "uint64", true], + ["L948", "uint64", true], + ["L949", "uint64", true], + ["L950", "uint64", true], + ["L951", "uint64", true], + ["L952", "uint64", true], + ["L953", "uint64", true], + ["L954", "uint64", true], + ["L955", "uint64", true], + ["L956", "uint64", true], + ["L957", "uint64", true], + ["L958", "uint64", true], + ["L959", "uint64", true], + ["L960", "uint64", true], + ["L961", "uint64", true], + ["L962", "uint64", true], + ["L963", "uint64", true], + ["L964", "uint64", true], + ["L965", "uint64", true], + ["L966", "uint64", true], + ["L967", "uint64", true], + ["L968", "uint64", true], + ["L969", "uint64", true], + ["L970", "uint64", true], + ["L971", "uint64", true], + ["L972", "uint64", true], + ["L973", "uint64", true], + ["L974", "uint64", true], + ["L975", "uint64", true], + ["L976", "uint64", true], + ["L977", "uint64", true], + ["L978", "uint64", true], + ["L979", "uint64", true], + ["L980", "uint64", true], + ["L981", "uint64", true], + ["L982", "uint64", true], + ["L983", "uint64", true], + ["L984", "uint64", true], + ["L985", "uint64", true], + ["L986", "uint64", true], + ["L987", "uint64", true], + ["L988", "uint64", true], + ["L989", "uint64", true], + ["L990", "uint64", true], + ["L991", "uint64", true], + ["L992", "uint64", true], + ["L993", "uint64", true], + ["L994", "uint64", true], + ["L995", "uint64", true], + ["L996", "uint64", true], + ["L997", "uint64", true], + ["L998", "uint64", true], + ["L999", "uint64", true], + ["L1000", "uint64", true], + ["L1001", "uint64", true], + ["L1002", "uint64", true], + ["L1003", "uint64", true], + ["L1004", "uint64", true], + ["L1005", "uint64", true], + ["L1006", "uint64", true], + ["L1007", "uint64", true], + ["L1008", "uint64", true], + ["L1009", "uint64", true], + ["L1010", "uint64", true], + ["L1011", "uint64", true], + ["L1012", "uint64", true], + ["L1013", "uint64", true], + ["L1014", "uint64", true], + ["L1015", "uint64", true], + ["L1016", "uint64", true], + ["L1017", "uint64", true], + ["L1018", "uint64", true], + ["L1019", "uint64", true], + ["L1020", "uint64", true], + ["L1021", "uint64", true], + ["L1022", "uint64", true], + ["L1023", "uint64", true], + ["L1024", "uint64", true], + ["L1025", "uint64", true], + ["L1041", "uint64", true] + ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 38ec0e4cba..7171462cd0 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -3123,5 +3123,23 @@ 112, "hud-box" ] + ], + "(method 10 menu-missions-option)": [ + [ + 224, + "vector" + ] + ], + "(method 10 menu-secret-option)": [ + [ + 64, + "vector" + ] + ], + "(method 10 menu-highscores-option)": [ + [ + 16, + "vector" + ] ] -} +} \ No newline at end of file diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index b14d9bbffc..0cd9643fbe 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -13480,5 +13480,176 @@ "v1", "menu-highscores-option" ] + ], + "draw-highlight": [ + [ + [ + 44, + 47 + ], + "v1", + "dma-packet" + ] + ], + "end-scissor": [ + [ + [ + 16, + 19 + ], + "v1", + "dma-packet" + ] + ], + "begin-scissor-secret": [ + [ + [ + 49, + 52 + ], + "v1", + "dma-packet" + ] + ], + "end-scissor-secret": [ + [ + [ + 16, + 19 + ], + "v1", + "dma-packet" + ] + ], + "begin-scissor-missions": [ + [ + [ + 49, + 52 + ], + "v1", + "dma-packet" + ] + ], + "end-scissor-missions": [ + [ + [ + 16, + 19 + ], + "v1", + "dma-packet" + ] + ], + "begin-scissor-scene": [ + [ + [ + 49, + 52 + ], + "v1", + "dma-packet" + ] + ], + "end-scissor-scene": [ + [ + [ + 16, + 19 + ], + "v1", + "dma-packet" + ] + ], + "begin-scissor-level": [ + [ + [ + 49, + 52 + ], + "v1", + "dma-packet" + ] + ], + "end-scissor-level": [ + [ + [ + 16, + 19 + ], + "v1", + "dma-packet" + ] + ], + "(method 10 menu-memcard-slot-option)": [ + [ + 162, + "a0", + "float" + ], + [ + 322, + "t1", + "float" + ], + [ + 541, + "t1", + "float" + ], + [ + 677, + "a0", + "float" + ], + [ + 691, + "a0", + "float" + ], + [ + 728, + "a0", + "float" + ], + [ + 767, + "a0", + "float" + ], + [ + 805, + "a0", + "float" + ] + ], + "(method 10 menu-secret-option)": [ + [ + 47, + "v1", + "float" + ], + [ + 106, + "a0", + "float" + ] + ], + "(method 10 menu-highscores-option)": [ + [ + 31, + "v1", + "float" + ], + [ + 38, + "v1", + "float" + ], + [ + 122, + "a0", + "float" + ] ] } \ No newline at end of file