From 9f66a69859c7670442ff8fbaea60306d7f2570c2 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Wed, 15 Apr 2026 02:31:17 +0200 Subject: [PATCH] always set vu function length to 0 --- goal_src/jak1/engine/dma/dma-buffer.gc | 3 ++- goal_src/jak2/engine/dma/dma-buffer.gc | 3 ++- goal_src/jak3/engine/dma/dma-buffer.gc | 3 ++- goal_src/jak3/engine/math/math.gc | 3 +++ test/decompiler/reference/jak3/decompiler-macros.gc | 4 ++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/goal_src/jak1/engine/dma/dma-buffer.gc b/goal_src/jak1/engine/dma/dma-buffer.gc index 0b3af410fe..5cc0dcb926 100644 --- a/goal_src/jak1/engine/dma/dma-buffer.gc +++ b/goal_src/jak1/engine/dma/dma-buffer.gc @@ -161,7 +161,8 @@ but creates a reference to the existing VU function." ;; The first 4 bytes of a vu-function object's data are discarded because they aren't aligned. (let ((func-ptr (the-as pointer (&-> vu-func data 4))) - (qlen (-> vu-func qlength)) ;; number of quadwords + ;; og:preserve-this we rely on the vu functions being empty on pc + (qlen (#if PC_PORT 0 (-> vu-func qlength))) ;; number of quadwords (origin (-> vu-func origin)) ;; destination address in VU instruction memory. ) ;; loop until whole program is transferred. diff --git a/goal_src/jak2/engine/dma/dma-buffer.gc b/goal_src/jak2/engine/dma/dma-buffer.gc index fedf0f823b..3cc7f25857 100644 --- a/goal_src/jak2/engine/dma/dma-buffer.gc +++ b/goal_src/jak2/engine/dma/dma-buffer.gc @@ -233,7 +233,8 @@ note that the second vifcode can also hold other stuff depending on the mode. ;; The first 4 bytes of a vu-function object's data are discarded because they aren't aligned. (let ((func-ptr (the-as pointer (&-> vu-func data 4))) - (qlen (-> vu-func qlength)) ;; number of quadwords + ;; og:preserve-this we rely on the vu functions being empty on pc + (qlen (#if PC_PORT 0 (-> vu-func qlength))) ;; number of quadwords (origin (-> vu-func origin)) ;; destination address in VU instruction memory. ) ;; loop until whole program is transferred. diff --git a/goal_src/jak3/engine/dma/dma-buffer.gc b/goal_src/jak3/engine/dma/dma-buffer.gc index 40c198c863..930181534c 100644 --- a/goal_src/jak3/engine/dma/dma-buffer.gc +++ b/goal_src/jak3/engine/dma/dma-buffer.gc @@ -431,7 +431,8 @@ ;; The first 4 bytes of a vu-function object's data are discarded because they aren't aligned. (let ((func-ptr (the-as pointer (&-> vu-func data 4))) - (qlen (-> vu-func qlength)) ;; number of quadwords + ;; og:preserve-this we rely on the vu functions being empty on pc + (qlen (#if PC_PORT 0 (-> vu-func qlength))) ;; number of quadwords (origin (-> vu-func origin)) ;; destination address in VU instruction memory. ) ;; loop until whole program is transferred. diff --git a/goal_src/jak3/engine/math/math.gc b/goal_src/jak3/engine/math/math.gc index 5dc2bbe684..b03bf138f5 100644 --- a/goal_src/jak3/engine/math/math.gc +++ b/goal_src/jak3/engine/math/math.gc @@ -10,6 +10,9 @@ `(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0)) ) +(defmacro square (x) + `(* ,x ,x)) + ;; DECOMP BEGINS (defun truncate ((arg0 float)) diff --git a/test/decompiler/reference/jak3/decompiler-macros.gc b/test/decompiler/reference/jak3/decompiler-macros.gc index 7bc58e3cd4..a913e937f9 100644 --- a/test/decompiler/reference/jak3/decompiler-macros.gc +++ b/test/decompiler/reference/jak3/decompiler-macros.gc @@ -1758,5 +1758,9 @@ ) ) +(defmacro square (x) + `(* ,x ,x) + ) + (import "goal_src/jak3/engine/data/tpages.gc") (import "goal_src/jak3/engine/data/textures.gc") \ No newline at end of file