mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-23 14:20:07 +00:00
decomp: lights.gc
(#420)
* scripts: Hack script to quickly identify the next goal_src file that hasn't been decomp'd yet * config: Delete old type_hints file * decomp: Decompile lights.gc * decomp-tests: Add offline tests and temporary forward defs * vs: Rename / add new offline test run config * decomp: Add formatted lights.gc source * decomp: Temporary define stub in geometry,gc * decomp: Cleanup `lights-group` handling
This commit is contained in:
parent
cc3f8ffbf5
commit
73a4f2c83e
3
.gitignore
vendored
3
.gitignore
vendored
@ -14,4 +14,5 @@ logs/*
|
||||
/result*
|
||||
|
||||
\#*#
|
||||
.#*#
|
||||
.#*#
|
||||
*.pyc
|
@ -4,61 +4,62 @@
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name" : "Run Tests - Summary",
|
||||
"name" : "Tests - Unit-Tests - Summary",
|
||||
"args" : ["--gtest_brief=1"]
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name" : "Run Tests - Verbose",
|
||||
"name" : "Tests - Unit-Tests - Verbose",
|
||||
"args" : ["--gtest_brief=0"]
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name" : "Run Draft Tests - Verbose",
|
||||
"name" : "Tests - Draft Tests - Verbose",
|
||||
"args" : ["--gtest_brief=0", "--gtest_filter=\"*Draft*\""]
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "offline-test.exe (bin\\offline-test.exe)",
|
||||
"name" : "Tests - Offline Tests",
|
||||
"args" : ["${workspaceRoot}/iso_data/jak1"]
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "gk.exe (bin\\gk.exe)",
|
||||
"name" : "Run Runtime (no kernel)",
|
||||
"name" : "Run - Runtime (no kernel)",
|
||||
"args" : [ "-fakeiso", "-debug", "-nokernel", "-v", "-nodisplay" ]
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "gk.exe (bin\\gk.exe)",
|
||||
"name" : "Run Runtime (with kernel)",
|
||||
"name" : "Run - Runtime (with kernel)",
|
||||
"args" : [ "-fakeiso", "-debug", "-v", "-nodisplay" ]
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "goalc.exe (bin\\goalc.exe)",
|
||||
"name" : "Build Compiler"
|
||||
"name" : "Run - REPL"
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "decompiler.exe (bin\\decompiler.exe)",
|
||||
"name" : "Build Decompiler"
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "decompiler.exe (bin\\decompiler.exe)",
|
||||
"name" : "Run Decompiler - Jak 1",
|
||||
"name" : "Run - Decompiler - Jak 1",
|
||||
"args" : [ "${workspaceRoot}/decompiler/config/jak1_ntsc_black_label.jsonc", "${workspaceRoot}/iso_data/jak1", "${workspaceRoot}/decompiler_out/jak1"]
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "decompiler.exe (bin\\decompiler.exe)",
|
||||
"name" : "Run Decompiler - Jak 2",
|
||||
"name" : "Run - Decompiler - Jak 2",
|
||||
"args" : [ "${workspaceRoot}/decompiler/config/jak2_ntsc_v1.jsonc", "${workspaceRoot}/iso_data/jak2", "${workspaceRoot}/decompiler_out/jak2"]
|
||||
}
|
||||
]
|
||||
|
@ -1607,7 +1607,7 @@
|
||||
(define-extern matrix-rot-diff! (function matrix matrix matrix float))
|
||||
(define-extern quaternion-seek (function quaternion quaternion quaternion float quaternion))
|
||||
(define-extern vector-deg-seek (function vector vector vector none))
|
||||
(define-extern vector-deg-slerp (function vector vector vector float float vector))
|
||||
(define-extern vector-deg-slerp (function vector vector vector float vector))
|
||||
(define-extern vector-vector-deg-slerp! function) ;; stack spills!
|
||||
(define-extern normal-of-plane (function vector vector vector vector vector))
|
||||
(define-extern vector-3pt-cross! (function vector vector vector vector))
|
||||
@ -5737,9 +5737,9 @@
|
||||
|
||||
;; lights-h
|
||||
(deftype vu-lights (structure)
|
||||
((direction uint128 3 :offset-assert 0)
|
||||
(color uint128 3 :offset-assert 48)
|
||||
(ambient vector :inline :offset-assert 96)
|
||||
((direction vector 3 :inline :offset-assert 0)
|
||||
(color vector 3 :inline :offset-assert 48)
|
||||
(ambient vector :inline :offset-assert 96)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x70
|
||||
@ -5824,12 +5824,18 @@
|
||||
(dir1 light :inline :offset-assert 48)
|
||||
(dir2 light :inline :offset-assert 96)
|
||||
(ambi light :inline :offset-assert 144)
|
||||
(lights light 4 :inline :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #xc0
|
||||
:flag-assert #x9000000c0
|
||||
)
|
||||
|
||||
;; lights
|
||||
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;
|
||||
;; ocean-h
|
||||
;;;;;;;;;;;
|
||||
@ -7355,7 +7361,7 @@
|
||||
:flag-assert #x9000001a0
|
||||
)
|
||||
|
||||
; generic-merc-h
|
||||
;; generic-merc-h
|
||||
(deftype generic-merc-input (structure)
|
||||
((geo-tag generic-merc-tag :inline :offset-assert 0)
|
||||
(geo-block uint8 1296 :offset-assert 16)
|
||||
@ -33642,15 +33648,6 @@
|
||||
;;(define-extern *gsf-buffer* object) ;; unknown type
|
||||
;;(define-extern generic-consts object) ;; unknown type
|
||||
;;(define-extern generic-envmap-consts object) ;; unknown type
|
||||
;;(define-extern vu-lights object) ;; unknown type
|
||||
;;(define-extern light-ellipse object) ;; unknown type
|
||||
;;(define-extern light-array object) ;; unknown type
|
||||
;;(define-extern light-volume-array object) ;; unknown type
|
||||
;;(define-extern light-volume object) ;; unknown type
|
||||
;;(define-extern light-group object) ;; unknown type
|
||||
;;(define-extern light object) ;; unknown type
|
||||
;;(define-extern light-volume-sphere object) ;; unknown type
|
||||
;;(define-extern light-volume-planes object) ;; unknown type
|
||||
(define-extern ocean-trans-indices type)
|
||||
(define-extern ocean-work type)
|
||||
;;(define-extern ocean-mid-upload object) ;; unknown type
|
||||
@ -33851,7 +33848,6 @@
|
||||
;;(define-extern mc-file-info object) ;; unknown type
|
||||
|
||||
;;(define-extern mc-run object) ;; unknown type
|
||||
;;(define-extern mc-get-slot-info object) ;; unknown type
|
||||
;;(define-extern mc-check-result object) ;; unknown type
|
||||
(define-extern game-bank type)
|
||||
;;(define-extern load-state object) ;; unknown type
|
||||
@ -33911,12 +33907,12 @@
|
||||
;;(define-extern task object) ;; unknown type
|
||||
;;(define-extern base object) ;; unknown type
|
||||
;;(define-extern rot object) ;; unknown type
|
||||
(define-extern vu-lights-default! (function light-group none))
|
||||
(define-extern light-group-slerp function)
|
||||
(define-extern light-slerp function)
|
||||
(define-extern light-group-process! function)
|
||||
;;(define-extern *default-lights* object) ;; unknown type
|
||||
(define-extern vu-lights<-light-group! function)
|
||||
(define-extern vu-lights-default! (function vu-lights vu-lights))
|
||||
(define-extern light-group-slerp (function light-group light-group light-group float light-group))
|
||||
(define-extern light-slerp (function light light light float light))
|
||||
(define-extern light-group-process! (function vu-lights light-group vector vector none))
|
||||
(define-extern *default-lights* vu-lights)
|
||||
(define-extern vu-lights<-light-group! (function vu-lights light-group none))
|
||||
(define-extern time-to-apex (function float float int))
|
||||
(define-extern time-to-ground (function float float float int))
|
||||
(define-extern *standard-dynamics* dynamics)
|
||||
|
@ -432,5 +432,11 @@
|
||||
["L359", "float", true],
|
||||
["L358", "float", true],
|
||||
["L361", "float", true]
|
||||
],
|
||||
|
||||
"lights": [
|
||||
["L8", "float", true],
|
||||
["L9", "float", true],
|
||||
["L10", "float", true]
|
||||
]
|
||||
}
|
||||
|
@ -141,5 +141,7 @@
|
||||
|
||||
//"(method 0 fact-info)": [[16, "res-tag"]],
|
||||
|
||||
"(method 10 oscillating-vector)":[[16, "vector"]]
|
||||
"(method 10 oscillating-vector)":[[16, "vector"]],
|
||||
|
||||
"show-mc-info": [[16, "mc-slot-info"]]
|
||||
}
|
||||
|
@ -1,274 +0,0 @@
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// THIS FILE IS NO LONGER USED!!!!!!!!!!!!!!!!!!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// see type_casts.jsonc instead.
|
||||
|
||||
{
|
||||
"(method 2 array)":[
|
||||
[23, ["gp", "(array int32)"]],
|
||||
[43, ["gp", "(array uint32)"]],
|
||||
[63, ["gp", "(array int64)"]],
|
||||
[83, ["gp", "(array uint64)"]],
|
||||
[102, ["gp", "(array int8)"]],
|
||||
[121, ["gp", "(array uint8)"]],
|
||||
[141, ["gp", "(array int16)"]],
|
||||
[161, ["gp", "(array uint16)"]],
|
||||
[186, ["gp", "(array uint128)"]],
|
||||
[204, ["gp", "(array int32)"]],
|
||||
[223, ["gp", "(array float)"]],
|
||||
[232, ["gp", "(array float)"]],
|
||||
[249, ["gp", "(array basic)"]],
|
||||
[258, ["gp", "(array basic)"]]
|
||||
],
|
||||
|
||||
"(method 3 array)":[
|
||||
[44, ["gp", "(array int32)"]],
|
||||
[62, ["gp", "(array uint32)"]],
|
||||
[80, ["gp", "(array int64)"]],
|
||||
[98, ["gp", "(array uint64)"]],
|
||||
[115, ["gp", "(array int8)"]],
|
||||
[132, ["gp", "(array int8)"]], // bug in game
|
||||
[150, ["gp", "(array int16)"]],
|
||||
[168, ["gp", "(array uint16)"]],
|
||||
[190, ["gp", "(array uint128)"]],
|
||||
[203, ["gp", "(array int32)"]],
|
||||
[225, ["gp", "(array float)"]],
|
||||
[242, ["gp", "(array basic)"]]
|
||||
],
|
||||
|
||||
"(method 2 handle)":[
|
||||
[10, ["a2", "(pointer process)"]],
|
||||
[11, ["a3", "process"]],
|
||||
[12, ["v1", "int"]],
|
||||
[16, ["gp", "int"]]
|
||||
],
|
||||
|
||||
"(method 3 handle)":[
|
||||
[10, ["gp", "int"]]
|
||||
],
|
||||
|
||||
"(method 0 cpu-thread)":[
|
||||
[13, ["v0", "cpu-thread"]]
|
||||
],
|
||||
|
||||
"(method 0 dead-pool-heap)":[
|
||||
[60, ["v0", "int"]], // a lie, actually the 115 is an align16 constant propagated on addr of heap start.
|
||||
[61, ["a0", "pointer"], ["v0", "dead-pool-heap"]]
|
||||
],
|
||||
|
||||
"(method 21 dead-pool-heap)":[
|
||||
[5, ["v1", "pointer"]],
|
||||
[13, ["a0", "pointer"]],
|
||||
[25, ["v1", "pointer"]]
|
||||
],
|
||||
|
||||
"(method 5 dead-pool-heap)":[
|
||||
[3, ["v1", "int"], ["a0", "int"]]
|
||||
],
|
||||
|
||||
"(method 0 process)":[
|
||||
[12, ["a0", "int"]],
|
||||
[13, ["v0", "process"]]
|
||||
],
|
||||
|
||||
"inspect-process-heap":[
|
||||
[4, ["s5", "basic"]],
|
||||
[17, ["s5", "int"]]
|
||||
],
|
||||
|
||||
"return-from-thread-dead":[
|
||||
[0, ["s6", "process"]]
|
||||
],
|
||||
|
||||
"(method 14 dead-pool)":[
|
||||
// bug in game!
|
||||
[24, ["v1", "(pointer process-tree)"]],
|
||||
[30, ["s4", "(pointer process-tree)"]]
|
||||
],
|
||||
|
||||
"throw":[
|
||||
[20, ["s4", "protect-frame"]] // type case
|
||||
],
|
||||
|
||||
"(method 0 protect-frame)":[
|
||||
[0, ["a0", "int"]],
|
||||
[1, ["v0", "protect-frame"]]
|
||||
],
|
||||
|
||||
"(method 9 process)":[
|
||||
[43, ["s5", "process"]]
|
||||
],
|
||||
|
||||
"(method 10 process)":[
|
||||
[24, ["s4", "protect-frame"]]
|
||||
],
|
||||
|
||||
"enter-state":[
|
||||
[67, ["s0", "protect-frame"]]
|
||||
],
|
||||
|
||||
"name=":[
|
||||
[24, ["a1", "symbol"]],
|
||||
[39, ["a0", "symbol"]]
|
||||
],
|
||||
|
||||
"string-cat-to-last-char":[
|
||||
[3, ["s5", "(pointer uint8)"]],
|
||||
[4, ["s5", "string"]]
|
||||
],
|
||||
|
||||
"string-strip-trailing-whitespace!":[
|
||||
[15, ["v1", "(pointer uint8)"]]
|
||||
],
|
||||
|
||||
"(anon-function 15 hud)":[
|
||||
[0, ["s6", "hud"]]
|
||||
],
|
||||
|
||||
"dma-send-to-spr":[
|
||||
[5, ["s5", "dma-bank-spr"]]],
|
||||
"dma-send-to-spr-no-flush":[
|
||||
[5, ["s5", "dma-bank-spr"]]],
|
||||
"dma-send-from-spr":[
|
||||
[5, ["s5", "dma-bank-spr"]]],
|
||||
"dma-send-from-spr-no-flush":[
|
||||
[5, ["s5", "dma-bank-spr"]]],
|
||||
"dma-initialize":[
|
||||
[1, ["v1", "vif-bank"]],
|
||||
[6, ["a0", "vif-bank"]],
|
||||
[8, ["v1", "vif-bank"]],
|
||||
[13, ["a0", "vif-bank"]]],
|
||||
|
||||
"clear-vu0-mem":[
|
||||
[1, ["v1", "(pointer uint32)"]]
|
||||
],
|
||||
"clear-vu1-mem":[
|
||||
[1, ["v1", "(pointer uint32)"]]
|
||||
],
|
||||
|
||||
"dump-vu1-mem":[
|
||||
[1, ["gp", "(pointer uint32)"]]],
|
||||
|
||||
"dump-vu1-range":[
|
||||
[3, ["s4", "(pointer uint32)"]]],
|
||||
|
||||
"ultimate-memcpy":[
|
||||
[5, ["s3", "dma-bank-spr"],["s4", "dma-bank-spr"]]
|
||||
],
|
||||
|
||||
"dma-buffer-add-vu-function":[
|
||||
[13, ["v1", "uint"]],
|
||||
[23, ["t2", "(pointer uint32)"]]
|
||||
],
|
||||
|
||||
"dma-buffer-add-buckets":[
|
||||
[1, ["v0", "dma-bucket"]],
|
||||
[5, ["v1", "uint"]],
|
||||
[6, ["t0", "uint"]],
|
||||
[9, ["v1", "dma-bucket"]],
|
||||
[11, ["v1", "uint"]],
|
||||
[12, ["v1", "dma-bucket"]]
|
||||
],
|
||||
|
||||
"dma-buffer-patch-buckets":[
|
||||
[7, ["a0", "uint"]],
|
||||
[11, ["a0", "dma-bucket"]],
|
||||
[14, ["a0", "uint"]],
|
||||
[15, ["a0", "dma-bucket"]]
|
||||
],
|
||||
|
||||
"dma-bucket-insert-tag":[
|
||||
[1, ["a0", "uint"]],
|
||||
[2, ["v1", "dma-bucket"]]
|
||||
],
|
||||
|
||||
"default-buffer-init":[
|
||||
[9, ["a1", "gs-gif-tag"]],
|
||||
[15, ["a1", "pointer"]],
|
||||
[16, ["a1", "gs-gif-tag"]],
|
||||
[19, ["a1", "gs-gif-tag"]],
|
||||
[24, ["a1", "pointer"]],
|
||||
[25, ["a1", "gs-gif-tag"]],
|
||||
[31, ["a1", "(pointer uint64)"]],
|
||||
[68, ["a0", "gs-gif-tag"]],
|
||||
[72, ["a0", "pointer"]]
|
||||
],
|
||||
|
||||
"glst-find-node-by-name":[
|
||||
[17, ["s5", "glst-named-node"]]
|
||||
],
|
||||
|
||||
"glst-length-of-longest-name":[
|
||||
[17, ["s5", "glst-named-node"]]
|
||||
],
|
||||
|
||||
"move-target-from-pad":[
|
||||
[2, ["sp", "int"]],
|
||||
[3, ["s4", "vector"]]
|
||||
],
|
||||
|
||||
"(method 0 engine)":[
|
||||
[39, ["v0", "int"]],
|
||||
[40, ["v0", "engine"]]
|
||||
],
|
||||
|
||||
"(method 12 engine)":[
|
||||
[7, ["s4", "connection"]]
|
||||
],
|
||||
|
||||
"(method 13 engine)":[
|
||||
[7, ["s4", "connection"]]
|
||||
],
|
||||
|
||||
"(method 15 engine)":[
|
||||
[6, ["v1", "connection"]]],
|
||||
|
||||
"(method 19 engine)":[
|
||||
[8, ["a0", "connection"]]],
|
||||
"(method 20 engine)":[
|
||||
[8, ["a0", "connection"]]],
|
||||
|
||||
"(method 0 collide-shape-prim-sphere)":[
|
||||
[4, ["v0", "collide-shape-prim-sphere"]]
|
||||
],
|
||||
|
||||
"(method 0 collide-shape-prim-mesh)":[
|
||||
[6, ["v0", "collide-shape-prim-mesh"]]
|
||||
],
|
||||
"(method 0 collide-shape-prim-group)":[
|
||||
[11, ["v0", "collide-shape-prim-group"]]
|
||||
],
|
||||
|
||||
"(method 11 touching-prims-entry-pool)":[
|
||||
[5, ["a1", "(inline-array touching-prims-entry)"]]],
|
||||
|
||||
"(method 0 touching-list)":[
|
||||
[6, ["v0", "touching-list"]]],
|
||||
|
||||
"str-load":[
|
||||
[21, ["s2", "load-chunk-msg"]]
|
||||
],
|
||||
|
||||
"str-play-async":[
|
||||
[13, ["s4", "load-chunk-msg"]]
|
||||
],
|
||||
|
||||
"str-play-stop":[
|
||||
[7, ["v0", "load-chunk-msg"]]
|
||||
],
|
||||
|
||||
"str-play-queue":[
|
||||
[19, ["v0", "load-chunk-msg"]]
|
||||
],
|
||||
|
||||
"str-ambient-play":[
|
||||
[7, ["v0", "load-chunk-msg"]]
|
||||
],
|
||||
|
||||
"str-ambient-stop":[
|
||||
[7, ["v0", "load-chunk-msg"]]
|
||||
]
|
||||
|
||||
|
||||
|
||||
}
|
@ -4,4 +4,3 @@
|
||||
;; name: bones.gc
|
||||
;; name in dgo: bones
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
|
@ -5,3 +5,5 @@
|
||||
;; name in dgo: geometry
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; TODO - temporary for lights.gc
|
||||
(define-extern vector-deg-slerp (function vector vector vector float vector))
|
@ -6,9 +6,9 @@
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(deftype vu-lights (structure)
|
||||
((direction uint128 3 :offset-assert 0)
|
||||
(color uint128 3 :offset-assert 48)
|
||||
(ambient vector :inline :offset-assert 96)
|
||||
((direction vector 3 :inline :offset-assert 0)
|
||||
(color vector 3 :inline :offset-assert 48)
|
||||
(ambient vector :inline :offset-assert 96)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x70
|
||||
@ -102,6 +102,7 @@
|
||||
(dir1 light :inline :offset-assert 48)
|
||||
(dir2 light :inline :offset-assert 96)
|
||||
(ambi light :inline :offset-assert 144)
|
||||
(lights light 4 :inline :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #xc0
|
||||
|
@ -5,3 +5,96 @@
|
||||
;; name in dgo: lights
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(defun light-slerp ((out light) (a light) (b light) (alpha float))
|
||||
"Linearly interpolate between two light's vectors. Alpha is clamped between 0 - 1."
|
||||
(let ((clamped-alpha (fmax 0.0 (fmin 1.0 alpha))))
|
||||
(vector-lerp! (-> out color) (-> a color) (-> b color) clamped-alpha)
|
||||
(vector-deg-slerp
|
||||
(-> out direction)
|
||||
(-> a direction)
|
||||
(-> b direction)
|
||||
clamped-alpha
|
||||
)
|
||||
(let ((f0-2 (-> a levels x))
|
||||
(f1-2 (-> b levels x))
|
||||
)
|
||||
(set! (-> out levels x) (+ f0-2 (* clamped-alpha (- f1-2 f0-2))))
|
||||
)
|
||||
)
|
||||
out
|
||||
)
|
||||
|
||||
(defun light-group-slerp ((out light-group) (a light-group) (b light-group) (alpha float))
|
||||
"Linearly interpolate between each of the 4 vectors of two light-groups.
|
||||
Alpha is clamped between 0 - 1."
|
||||
(dotimes (vec-index 4)
|
||||
(light-slerp
|
||||
(-> out lights vec-index)
|
||||
(-> a lights vec-index)
|
||||
(-> b lights vec-index)
|
||||
alpha
|
||||
)
|
||||
)
|
||||
out
|
||||
)
|
||||
|
||||
;; TODO - temporary for lights.gc
|
||||
(define-extern vu-lights<-light-group! (function vu-lights light-group none))
|
||||
|
||||
(defun light-group-process! ((lights vu-lights) (group light-group) (vector-1 vector) (vector-2 vector))
|
||||
"Unused - Seems to do effectively nothing"
|
||||
;; NOTE - dead code
|
||||
;; (let ((f0-0 (rotate-y<-vector+vector arg3 arg2)))
|
||||
;; )
|
||||
(vu-lights<-light-group! lights group)
|
||||
(none)
|
||||
)
|
||||
|
||||
(define *default-lights* (the-as vu-lights (new 'global 'vu-lights)))
|
||||
|
||||
(defun vu-lights-default! ((lights vu-lights))
|
||||
"Initialize a lights object with default values"
|
||||
(let ((ambient-light (-> lights ambient)))
|
||||
(set! (-> ambient-light x) 0.3)
|
||||
(set! (-> ambient-light y) 0.3)
|
||||
(set! (-> ambient-light z) 0.3)
|
||||
(set! (-> ambient-light w) 1.0)
|
||||
)
|
||||
(let ((red (-> lights color)))
|
||||
(set! (-> red 0 x) 1.0)
|
||||
(set! (-> red 0 y) 1.0)
|
||||
(set! (-> red 0 z) 1.0)
|
||||
(set! (-> red 0 w) 1.0)
|
||||
)
|
||||
(let ((green (-> lights color 1)))
|
||||
(set! (-> green x) 0.2)
|
||||
(set! (-> green y) 0.2)
|
||||
(set! (-> green z) 0.2)
|
||||
(set! (-> green w) 1.0)
|
||||
)
|
||||
(let ((blue (-> lights color 2)))
|
||||
(set! (-> blue x) 0.0)
|
||||
(set! (-> blue y) 0.0)
|
||||
(set! (-> blue z) 0.0)
|
||||
(set! (-> blue w) 1.0)
|
||||
)
|
||||
(let ((dir-light-x (-> lights direction)))
|
||||
(set! (-> dir-light-x 0 x) 1.0)
|
||||
(set! (-> dir-light-x 0 y) 0.0)
|
||||
(set! (-> dir-light-x 0 z) 0.0)
|
||||
(set! (-> dir-light-x 0 w) 1.0)
|
||||
)
|
||||
(let ((dir-light-y (-> lights direction 1)))
|
||||
(set! (-> dir-light-y x) 0.0)
|
||||
(set! (-> dir-light-y y) 1.0)
|
||||
(set! (-> dir-light-y z) 0.0)
|
||||
(set! (-> dir-light-y w) 1.0)
|
||||
)
|
||||
(let ((dir-light-z (-> lights direction 2)))
|
||||
(set! (-> dir-light-z x) 0.0)
|
||||
(set! (-> dir-light-z y) 0.0)
|
||||
(set! (-> dir-light-z z) 1.0)
|
||||
(set! (-> dir-light-z w) 1.0)
|
||||
)
|
||||
lights
|
||||
)
|
||||
|
@ -997,7 +997,7 @@
|
||||
)
|
||||
|
||||
(defun vector-lerp! ((out vector) (a vector) (b vector) (alpha float))
|
||||
"Linearly interpolate between two vectors. Alpha isn't clampled.
|
||||
"Linearly interpolate between two vectors. Alpha isn't clamped.
|
||||
w will be set to 1."
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
|
@ -62,3 +62,7 @@
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
|
||||
;; TODO - show-mc-info - failed to decompile
|
||||
;; WARN: Type Propagation failed: Failed to find a stack variable at offset 16
|
||||
;; WARN: Type Propagation failed: Type analysis failed
|
1087
scripts/jak1_file_list.py
Normal file
1087
scripts/jak1_file_list.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
35
scripts/next-decomp-file.py
Normal file
35
scripts/next-decomp-file.py
Normal file
@ -0,0 +1,35 @@
|
||||
import sys
|
||||
from jak1_file_list import file_list
|
||||
|
||||
skip_count = 0
|
||||
if len(sys.argv) >= 2:
|
||||
skip_count = int(sys.argv[1])
|
||||
|
||||
print(skip_count)
|
||||
|
||||
new_file_contents = []
|
||||
|
||||
for file in file_list:
|
||||
with open("goal_src/" + file[4] + "/" + file[0] + ".gc") as f:
|
||||
lines = f.readlines()
|
||||
# print("goal_src/" + file[4] + "/" + file[0] + ".gc" + " " + str(len(lines)))
|
||||
if skip_count <= 0 and len(lines) <= 7:
|
||||
print("Next file to decompile is - " + file[0])
|
||||
print("Target is - " + "goal_src/" + file[4] + "/" + file[0] + ".gc")
|
||||
print("Uses the following CGO / DGO - " + str(file[3]))
|
||||
# TODO, update the CGO/DGO
|
||||
with open("decompiler\config\jak1_ntsc_black_label.jsonc", "r") as config_file:
|
||||
cfg_lines = config_file.readlines()
|
||||
for line in cfg_lines:
|
||||
if "allowed_objects" in line:
|
||||
line = " \"allowed_objects\": [\"" + file[0] + "\"],\n"
|
||||
new_file_contents.append(line)
|
||||
if len(new_file_contents) > 0:
|
||||
with open("decompiler\config\jak1_ntsc_black_label.jsonc", "w") as f:
|
||||
f.writelines(new_file_contents)
|
||||
print("Allowed objects list updated")
|
||||
break
|
||||
elif len(lines) <= 7:
|
||||
skip_count = skip_count - 1
|
||||
|
||||
|
@ -428,4 +428,12 @@
|
||||
(declare-type level basic)
|
||||
|
||||
;; main-h
|
||||
(define-extern *dproc* process)
|
||||
(define-extern *dproc* process)
|
||||
|
||||
;; GEOMETRY - TODO
|
||||
(define-extern vector-deg-slerp (function vector vector vector float vector))
|
||||
|
||||
;; bones - TODO
|
||||
(declare-type vu-lights structure)
|
||||
(declare-type light-group structure)
|
||||
(define-extern vu-lights<-light-group! (function vu-lights light-group none))
|
@ -3,9 +3,9 @@
|
||||
|
||||
;; definition of type vu-lights
|
||||
(deftype vu-lights (structure)
|
||||
((direction uint128 3 :offset-assert 0)
|
||||
(color uint128 3 :offset-assert 48)
|
||||
(ambient vector :inline :offset-assert 96)
|
||||
((direction vector 3 :inline :offset-assert 0)
|
||||
(color vector 3 :inline :offset-assert 48)
|
||||
(ambient vector :inline :offset-assert 96)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x70
|
||||
|
96
test/decompiler/reference/lights_REF.gc
Normal file
96
test/decompiler/reference/lights_REF.gc
Normal file
@ -0,0 +1,96 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for function light-slerp
|
||||
(defun light-slerp ((arg0 light) (arg1 light) (arg2 light) (arg3 float))
|
||||
(let ((s3-0 (fmax 0.0 (fmin 1.0 arg3))))
|
||||
(vector-lerp! (-> arg0 color) (-> arg1 color) (-> arg2 color) s3-0)
|
||||
(vector-deg-slerp
|
||||
(-> arg0 direction)
|
||||
(-> arg1 direction)
|
||||
(-> arg2 direction)
|
||||
s3-0
|
||||
)
|
||||
(let ((f0-2 (-> arg1 levels x))
|
||||
(f1-2 (-> arg2 levels x))
|
||||
)
|
||||
(set! (-> arg0 levels x) (+ f0-2 (* s3-0 (- f1-2 f0-2))))
|
||||
)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
;; definition for function light-group-slerp
|
||||
(defun
|
||||
light-group-slerp
|
||||
((arg0 light-group) (arg1 light-group) (arg2 light-group) (arg3 float))
|
||||
(dotimes (s2-0 4)
|
||||
(light-slerp
|
||||
(the-as light (+ (+ (* 48 s2-0) 0) (the-as int arg0)))
|
||||
(the-as light (+ (+ (* 48 s2-0) 0) (the-as int arg1)))
|
||||
(the-as light (+ (+ (* 48 s2-0) 0) (the-as int arg2)))
|
||||
arg3
|
||||
)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
;; definition for function light-group-process!
|
||||
(defun
|
||||
light-group-process!
|
||||
((arg0 vu-lights) (arg1 light-group) (arg2 vector) (arg3 vector))
|
||||
(let ((f0-0 (rotate-y<-vector+vector arg3 arg2)))
|
||||
)
|
||||
(vu-lights<-light-group! arg0 arg1)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for symbol *default-lights*, type vu-lights
|
||||
(define *default-lights* (the-as vu-lights (new 'global 'vu-lights)))
|
||||
|
||||
;; definition for function vu-lights-default!
|
||||
(defun vu-lights-default! ((arg0 vu-lights))
|
||||
(let ((v1-0 (-> arg0 ambient)))
|
||||
(set! (-> v1-0 x) 0.3)
|
||||
(set! (-> v1-0 y) 0.3)
|
||||
(set! (-> v1-0 z) 0.3)
|
||||
(set! (-> v1-0 w) 1.0)
|
||||
)
|
||||
(let ((v1-1 (-> arg0 color)))
|
||||
(set! (-> v1-1 0 x) 1.0)
|
||||
(set! (-> v1-1 0 y) 1.0)
|
||||
(set! (-> v1-1 0 z) 1.0)
|
||||
(set! (-> v1-1 0 w) 1.0)
|
||||
)
|
||||
(let ((v1-2 (-> arg0 color 1)))
|
||||
(set! (-> v1-2 x) 0.2)
|
||||
(set! (-> v1-2 y) 0.2)
|
||||
(set! (-> v1-2 z) 0.2)
|
||||
(set! (-> v1-2 w) 1.0)
|
||||
)
|
||||
(let ((v1-3 (-> arg0 color 2)))
|
||||
(set! (-> v1-3 x) 0.0)
|
||||
(set! (-> v1-3 y) 0.0)
|
||||
(set! (-> v1-3 z) 0.0)
|
||||
(set! (-> v1-3 w) 1.0)
|
||||
)
|
||||
(let ((v1-4 (-> arg0 direction)))
|
||||
(set! (-> v1-4 0 x) 1.0)
|
||||
(set! (-> v1-4 0 y) 0.0)
|
||||
(set! (-> v1-4 0 z) 0.0)
|
||||
(set! (-> v1-4 0 w) 1.0)
|
||||
)
|
||||
(let ((v1-5 (-> arg0 direction 1)))
|
||||
(set! (-> v1-5 x) 0.0)
|
||||
(set! (-> v1-5 y) 1.0)
|
||||
(set! (-> v1-5 z) 0.0)
|
||||
(set! (-> v1-5 w) 1.0)
|
||||
)
|
||||
(let ((v1-6 (-> arg0 direction 2)))
|
||||
(set! (-> v1-6 x) 0.0)
|
||||
(set! (-> v1-6 y) 0.0)
|
||||
(set! (-> v1-6 z) 1.0)
|
||||
(set! (-> v1-6 w) 1.0)
|
||||
)
|
||||
arg0
|
||||
)
|
@ -22,8 +22,9 @@ const std::unordered_set<std::string> g_object_files_to_decompile = {
|
||||
"connect", "text-h", "settings-h", "capture", "memory-usage-h", /* "texture", */ "main-h",
|
||||
"mspace-h", "drawable-h", "drawable-group-h", "drawable-inline-array-h", "draw-node-h",
|
||||
"drawable-tree-h", "drawable-actor-h", "drawable-ambient-h", "game-task-h", "hint-control-h",
|
||||
"generic-h", "lights-h", "ocean-h", "ocean-trans-tables", /* "ocean-tables", "ocean-frames", */
|
||||
"sky-h", "mood-h", /* "time-of-day-h", */
|
||||
"generic-h", "lights-h", "lights", "ocean-h",
|
||||
"ocean-trans-tables", /* "ocean-tables", "ocean-frames", */
|
||||
"sky-h", "mood-h", /* "time-of-day-h", */
|
||||
/* gap */
|
||||
"bounding-box",
|
||||
/* gap */
|
||||
@ -42,9 +43,9 @@ const std::vector<std::string> g_object_files_to_check_against_reference = {
|
||||
"display", "connect", "text-h", "settings-h", "capture", "memory-usage-h",
|
||||
/* "texture", */ "main-h", "mspace-h", "drawable-h", "drawable-group-h",
|
||||
"drawable-inline-array-h", "draw-node-h", "drawable-tree-h", "drawable-actor-h",
|
||||
"drawable-ambient-h", "game-task-h", "hint-control-h", "generic-h", "lights-h", "ocean-h",
|
||||
"ocean-trans-tables", /* "ocean-tables", "ocean-frames", */
|
||||
"sky-h", "mood-h", /* "time-of-day-h", */
|
||||
"drawable-ambient-h", "game-task-h", "hint-control-h", "generic-h", "lights-h", "lights",
|
||||
"ocean-h", "ocean-trans-tables", /* "ocean-tables", "ocean-frames", */
|
||||
"sky-h", "mood-h", /* "time-of-day-h", */
|
||||
/* gap */ "bounding-box",
|
||||
/* gap */
|
||||
"sync-info-h", "sync-info"};
|
||||
|
Loading…
Reference in New Issue
Block a user