From dc203502fc9e26e3bb6196bd26ff4550676ddd46 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Sun, 5 Apr 2026 16:58:19 +0200 Subject: [PATCH] jak3: fix potential `wascity-defend` softlock, stick sens setting, fix `freeze-screen` regression (#4182) There was some bad manual decomp in `wasdef-manager` that caused the mission to sometimes softlock, preventing Jak from exiting the turret after destroying all Makers. Also adds stick sensitivity setting from Jak 2 and fixes a regression with the Light Jak freeze screen overlay on PC aspect ratios. Closes #4179 Closes #4154 --- decompiler/config/jak3/all-types.gc | 1 + .../config/jak3/ntsc_v1/type_casts.jsonc | 9 +-- .../jak3/text/game_custom_text_en-US.json | 3 +- .../jak3/engine/target/target-lightjak.gc | 5 +- goal_src/jak3/engine/ui/text-h.gc | 1 + .../jak3/levels/wascity/wasdef-manager.gc | 31 ++++++---- .../jak3/pc/progress/progress-static-pc.gc | 11 ++++ .../jak3/levels/wascity/wasdef-manager_REF.gc | 61 +++++++------------ 8 files changed, 61 insertions(+), 61 deletions(-) diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 04608d3f21..ced83190fc 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -10309,6 +10309,7 @@ (progress-controller-options-enable-trigger-effects #x134c) (progress-misc-fix-projectile-focus #x134d) (progress-controller-options-pacman-dpad #x134e) + (progress-controller-options-analog-sensitivity #x134f) ) ;; ---text-h:text-id diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index 7ed25bf17c..870ba670fe 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -8686,12 +8686,9 @@ "(anon-function 8 mined-scenes)": [[31, "a0", "process"]], "(code flying maker)": [[10, "v1", "art-joint-anim"]], "(method 30 task-manager-wascity-defend)": [ - [28, "v1", "handle"], - [55, "v1", "handle"], - [82, "v1", "handle"], - [25, "v1", "handle"], - [52, "v1", "handle"], - [79, "v1", "handle"] + [[25, 32], "v1", "handle"], + [[52, 59], "v1", "handle"], + [[79, 86], "v1", "handle"] ], "(code walking maker)": [[[123, 126], "v1", "task-manager-wascity-defend"]], "(post flying maker)": [[[260, 275], "v1", "task-manager-wascity-defend"]], diff --git a/game/assets/jak3/text/game_custom_text_en-US.json b/game/assets/jak3/text/game_custom_text_en-US.json index 9f6b986fae..d233fd26ac 100644 --- a/game/assets/jak3/text/game_custom_text_en-US.json +++ b/game/assets/jak3/text/game_custom_text_en-US.json @@ -248,5 +248,6 @@ "134b": "Swap R1 and R2", "134c": "Trigger Effects", "134d": "Fix Projectile Focus", - "134e": "Eco Grid (Pac-Man) D-Pad Controls" + "134e": "Eco Grid (Pac-Man) D-Pad Controls", + "134f": "Analog Sensitivity" } diff --git a/goal_src/jak3/engine/target/target-lightjak.gc b/goal_src/jak3/engine/target/target-lightjak.gc index 99f9402319..fe8e8ba32c 100644 --- a/goal_src/jak3/engine/target/target-lightjak.gc +++ b/goal_src/jak3/engine/target/target-lightjak.gc @@ -2276,8 +2276,9 @@ (gp-0 (new 'stack-no-clear 'vector)) (f30-0 4096.0) ) - (let ((f0-4 (* 0.00013563369 (tan (/ (-> *math-camera* fov) 2)) f30-0))) - (set-vector! (-> this root scale) f0-4 f0-4 f0-4 1.0) + ;; og:preserve-this resize effect based on aspect ratio + (let ((f0-4 (* 0.00013563369 (tan (* 0.5 (-> *math-camera* fov))) f30-0))) + (set-vector! (-> this root scale) (* f0-4 (if (-> *pc-settings* use-vis?) 1.0 (-> *pc-settings* aspect-ratio-scale))) f0-4 f0-4 1.0) ) (vector-copy! gp-0 (camera-pos)) (vector-normalize-copy! s5-0 (-> s3-0 fvec) 1.0) diff --git a/goal_src/jak3/engine/ui/text-h.gc b/goal_src/jak3/engine/ui/text-h.gc index aca5255e09..ffd592fe6a 100644 --- a/goal_src/jak3/engine/ui/text-h.gc +++ b/goal_src/jak3/engine/ui/text-h.gc @@ -1600,6 +1600,7 @@ (progress-controller-options-enable-trigger-effects #x134c) (progress-misc-fix-projectile-focus #x134d) (progress-controller-options-pacman-dpad #x134e) + (progress-controller-options-analog-sensitivity #x134f) ) ;; ---text-id diff --git a/goal_src/jak3/levels/wascity/wasdef-manager.gc b/goal_src/jak3/levels/wascity/wasdef-manager.gc index 90c5f51d4b..067fc1c0a9 100644 --- a/goal_src/jak3/levels/wascity/wasdef-manager.gc +++ b/goal_src/jak3/levels/wascity/wasdef-manager.gc @@ -2342,18 +2342,25 @@ ) ) (('event-over) - ;; og:preserve-this handle->process nonsense - (let ((makers (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 maker)))) - (flyer-shots (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 dm-flyer-shot)))) - (grenades (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 maker-grenade)))) - ) - (and - (not (process->handle makers)) - (not (process->handle flyer-shots)) - (not (process->handle grenades)) - (-> this completed) - ) - ) + (and (not (handle->process + (process->handle (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 maker)))) + ) + ) + (not (handle->process + (process->handle + (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 dm-flyer-shot))) + ) + ) + ) + (and (not (handle->process + (process->handle + (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 maker-grenade))) + ) + ) + ) + (-> this completed) + ) + ) ) (('fail) ((method-of-type task-manager taskman-event-handler) this arg0 arg1 arg2 arg3) diff --git a/goal_src/jak3/pc/progress/progress-static-pc.gc b/goal_src/jak3/pc/progress/progress-static-pc.gc index 6a8a37b163..6d37bae9b3 100644 --- a/goal_src/jak3/pc/progress/progress-static-pc.gc +++ b/goal_src/jak3/pc/progress/progress-static-pc.gc @@ -274,6 +274,17 @@ This gives us more freedom to write code how we want. :on-confirm (lambda ((val float)) (set! (-> *pc-settings* stick-deadzone) val) (pc-settings-save))) + (new 'static 'menu-generic-slider-option + :name (text-id progress-controller-options-analog-sensitivity) + :min-value 50.0 + :max-value 200.0 + :step 1.0 + :show-decimal? #t + :get-value-fn (lambda () (-> *pc-settings* stick-sensitivity)) + :on-confirm (lambda ((val float)) + (pc-set-axis-scale! (/ val 100.0)) + (set! (-> *pc-settings* stick-sensitivity) val) + (pc-settings-save))) (new 'static 'menu-generic-boolean-option :name (text-id progress-controller-options-ignore-if-unfocused) :truthy-text (text-id progress-on) diff --git a/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc index 2dbc4e5716..e7e6edc0a4 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc @@ -2549,48 +2549,25 @@ ) ) (('event-over) - (let ((v1-4 (process->handle (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 maker))))) - ) - (and (not (and (nonzero? (l32-false-check (the-as handle v1-4))) - (let ((a0-10 (-> (.asm.sllv.r0 (the-as handle v1-4)) 0))) - (if (= (sar v1-4 32) (-> a0-10 pid)) - a0-10 - ) + (and (not (handle->process + (process->handle (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 maker)))) + ) + ) + (not (handle->process + (process->handle + (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 dm-flyer-shot))) + ) + ) + ) + (and (not (handle->process + (process->handle + (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 maker-grenade))) ) ) - ) - (let ((v1-9 (process->handle - (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 dm-flyer-shot))) - ) - ) - ) - (not (and (nonzero? (l32-false-check (the-as handle v1-9))) - (let ((a0-19 (-> (.asm.sllv.r0 (the-as handle v1-9)) 0))) - (if (= (sar v1-9 32) (-> a0-19 pid)) - a0-19 - ) - ) - ) - ) - ) - (let ((v1-14 (process->handle - (search-process-tree *active-pool* (lambda ((arg0 process-tree)) (type? arg0 maker-grenade))) - ) - ) - ) - (and (not (and (nonzero? (l32-false-check (the-as handle v1-14))) - (let ((a0-28 (-> (.asm.sllv.r0 (the-as handle v1-14)) 0))) - (if (= (sar v1-14 32) (-> a0-28 pid)) - a0-28 - ) - ) - ) - ) - (-> this completed) - ) - ) - ) - ) + ) + (-> this completed) + ) + ) ) (('fail) ((method-of-type task-manager taskman-event-handler) this arg0 arg1 arg2 arg3) @@ -2819,3 +2796,7 @@ 0 (none) ) + + + +