From d6e08df0945b5228eec8a00990d06840f637f98c Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Fri, 18 Aug 2023 03:25:21 +0100 Subject: [PATCH] [jak2] widescreen fix for splash/jp subtitles (#2916) --- goal_src/jak2/engine/gfx/blit-displays.gc | 12 ++++++++++++ goal_src/jak2/engine/scene/scene.gc | 16 ++++++++++++++++ goal_src/jak2/pc/damage-number.gc | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/goal_src/jak2/engine/gfx/blit-displays.gc b/goal_src/jak2/engine/gfx/blit-displays.gc index 82fcafe7e1..2f82b8d068 100644 --- a/goal_src/jak2/engine/gfx/blit-displays.gc +++ b/goal_src/jak2/engine/gfx/blit-displays.gc @@ -136,6 +136,10 @@ (with-dma-buffer-add-bucket ((s0-0 (-> *display* frames (-> *display* on-screen) global-buf)) arg0 ) + (#when PC_PORT + ;; draw a black rectangle covering the screen first + (draw-sprite2d-xy s0-0 0 0 512 416 (static-rgba 0 0 0 128)) + ) ;; (upload-vram-data s0-0 0 (the-as pointer arg1) arg3 arg2) (pc-upload-raw-texture s0-0 (the pointer arg1) arg2 arg3 0) (set! sv-32 (+ (log2 (+ arg2 -1)) 1)) @@ -157,6 +161,14 @@ (set-vector! (the-as vector4w (&+ v1-19 64)) #x7000 #x7300 0 0) (set-vector! (the-as vector4w (&+ v1-19 80)) (* arg2 16) (* arg3 16) 0 0) (set-vector! (the-as vector4w (&+ v1-19 96)) #x9000 #x8d00 0 0) + (#when PC_PORT + (when (not (-> *pc-settings* use-vis?)) + (let ((corrected-width (the int (* (-> *pc-settings* aspect-ratio-reciprocal) #x1000)))) + (set-vector! (the-as vector4w (&+ v1-19 64)) (- #x8000 corrected-width) #x7300 0 0) + (set-vector! (the-as vector4w (&+ v1-19 96)) (+ #x8000 corrected-width) #x8d00 0 0) + ) + ) + ) ) (&+! (-> s0-0 base) 112) (set-dirty-mask! arg4 arg5 (* (* arg3 arg2) 4) 0) diff --git a/goal_src/jak2/engine/scene/scene.gc b/goal_src/jak2/engine/scene/scene.gc index b2371a1251..3c135a381d 100644 --- a/goal_src/jak2/engine/scene/scene.gc +++ b/goal_src/jak2/engine/scene/scene.gc @@ -671,6 +671,14 @@ (a0-23 (+ a2-23 (-> arg0 width))) (a1-33 (+ a3-8 (-> arg0 height))) ) + (#when PC_PORT + (when (not (-> *pc-settings* use-vis?)) + (let ((corrected-width (the int (* (-> *pc-settings* aspect-ratio-reciprocal) (-> arg0 width))))) + (set! a2-23 (+ (- 1793 (the-as int (shr corrected-width 1))) (the int (+ (-> arg1 origin x) (* 0.5 (-> arg1 width)))))) + (set! a0-23 (+ a2-23 corrected-width)) + ) + ) + ) (set! (-> (the-as (pointer uint128) v1-28) 0) (-> *subtitle-work* draw-tmpl dma-vif quad)) (set! (-> (the-as (pointer uint128) v1-28) 1) (-> *subtitle-work* draw-tmpl quad 1)) (set! (-> (the-as (pointer uint128) v1-28) 2) (-> *subtitle-work* color0 quad)) @@ -688,6 +696,14 @@ (a0-30 (+ a1-38 (-> arg0 width))) (a2-28 (+ a3-11 (-> arg0 height))) ) + (#when PC_PORT + (when (not (-> *pc-settings* use-vis?)) + (let ((corrected-width (the int (* (-> *pc-settings* aspect-ratio-reciprocal) (-> arg0 width))))) + (set! a1-38 (+ (- 1793 (the-as int (shr corrected-width 1))) (the int (+ (-> arg1 origin x) (* 0.5 (-> arg1 width)))))) + (set! a0-30 (+ a1-38 corrected-width)) + ) + ) + ) (set! (-> (the-as (pointer uint128) v1-32) 0) (-> *subtitle-work* draw-tmpl dma-vif quad)) (set! (-> (the-as (pointer uint128) v1-32) 1) (-> *subtitle-work* draw-tmpl quad 1)) (set! (-> (the-as (pointer uint128) v1-32) 2) (-> *subtitle-work* color1 quad)) diff --git a/goal_src/jak2/pc/damage-number.gc b/goal_src/jak2/pc/damage-number.gc index b096052361..ec3b11cb76 100644 --- a/goal_src/jak2/pc/damage-number.gc +++ b/goal_src/jak2/pc/damage-number.gc @@ -194,7 +194,7 @@ (set! (-> color b) (the int (lerp-scale (the float (-> *color-yellow* b)) (the float (-> *color-red* b)) percentage 0.55 0.1))) ) ) - (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf)) bucket ) (cond