mirror of
https://github.com/open-goal/jak-project
synced 2026-09-08 03:46:51 -04:00
[decomp] cleanup drawable and ocean stuff (#414)
* use `kmalloc-flags` for goal `kmalloc` * cleanup some drawable stuff, add offline tests * cleanup generic-h a bit * make decompiler work on 16-bit static data * cleanup ocean stuff * fix `ocean-spheres` * oops forgot this * I forgot to actually make `ocean-tables`
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type drawable-group
|
||||
(deftype drawable-group (drawable)
|
||||
((pad uint8 4 :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 18
|
||||
:size-assert #x24
|
||||
:flag-assert #x1200000024
|
||||
)
|
||||
|
||||
;; definition for symbol *collide-nodes*, type int
|
||||
(define *collide-nodes* 0)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-1 0))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type drawable
|
||||
(deftype drawable (basic)
|
||||
((id int16 :offset-assert 4)
|
||||
(bsphere vector :inline :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 18
|
||||
:size-assert #x20
|
||||
:flag-assert #x1200000020
|
||||
(:methods
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 (_type_) int 10)
|
||||
(dummy-11 () none 11)
|
||||
(dummy-12 () none 12)
|
||||
(dummy-13 () none 13)
|
||||
(dummy-14 () none 14)
|
||||
(dummy-15 () none 15)
|
||||
(dummy-16 () none 16)
|
||||
(dummy-17 () none 17)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type drawable
|
||||
(defmethod inspect drawable ((obj drawable))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tid: ~D~%" (-> obj id))
|
||||
(format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type drawable-error
|
||||
(deftype drawable-error (drawable)
|
||||
((name basic :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 18
|
||||
:size-assert #x24
|
||||
:flag-assert #x1200000024
|
||||
)
|
||||
|
||||
;; definition for method 3 of type drawable-error
|
||||
(defmethod inspect drawable-error ((obj drawable-error))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tid: ~D~%" (-> obj id))
|
||||
(format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
|
||||
(format #t "~Tname: ~A~%" (-> obj name))
|
||||
obj
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-2 0))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type joint
|
||||
(deftype joint (basic)
|
||||
((name basic :offset-assert 4)
|
||||
(number int32 :offset-assert 8)
|
||||
(parent joint :offset-assert 12)
|
||||
(bind-pose matrix :inline :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x50
|
||||
:flag-assert #x900000050
|
||||
)
|
||||
|
||||
;; definition for method 3 of type joint
|
||||
(defmethod inspect joint ((obj joint))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tname: ~A~%" (-> obj name))
|
||||
(format #t "~Tnumber: ~D~%" (-> obj number))
|
||||
(format #t "~Tparent: ~A~%" (-> obj parent))
|
||||
(format #t "~Tbind-pose: #<matrix @ #x~X>~%" (-> obj bind-pose))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type bone-cache
|
||||
(deftype bone-cache (structure)
|
||||
((bone-matrix uint32 :offset-assert 0)
|
||||
(parent-matrix uint32 :offset-assert 4)
|
||||
(dummy uint32 :offset-assert 8)
|
||||
(frame uint32 :offset-assert 12)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; definition for method 3 of type bone-cache
|
||||
(defmethod inspect bone-cache ((obj bone-cache))
|
||||
(format #t "[~8x] ~A~%" obj 'bone-cache)
|
||||
(format #t "~Tbone-matrix: ~D~%" (-> obj bone-matrix))
|
||||
(format #t "~Tparent-matrix: ~D~%" (-> obj parent-matrix))
|
||||
(format #t "~Tdummy: ~D~%" (-> obj dummy))
|
||||
(format #t "~Tframe: ~D~%" (-> obj frame))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type bone
|
||||
(deftype bone (structure)
|
||||
((transform matrix :inline :offset-assert 0)
|
||||
(position vector :inline :offset 48)
|
||||
(scale vector :inline :offset-assert 64)
|
||||
(cache bone-cache :inline :offset-assert 80)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x60
|
||||
:flag-assert #x900000060
|
||||
)
|
||||
|
||||
;; definition for method 3 of type bone
|
||||
(defmethod inspect bone ((obj bone))
|
||||
(format #t "[~8x] ~A~%" obj 'bone)
|
||||
(format #t "~Ttransform: #<matrix @ #x~X>~%" (-> obj transform))
|
||||
(format #t "~Tposition: #<vector @ #x~X>~%" (&-> obj transform data 12))
|
||||
(format #t "~Tscale: #<vector @ #x~X>~%" (-> obj scale))
|
||||
(format #t "~Tcache: #<bone-cache @ #x~X>~%" (-> obj cache))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type skeleton
|
||||
(deftype skeleton (inline-array-class)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; definition for method 3 of type skeleton
|
||||
(defmethod inspect skeleton ((obj skeleton))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tlength: ~D~%" (-> obj length))
|
||||
(format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
|
||||
(format #t "~Tdata[0] @ #x~X~%" (&-> obj data 4))
|
||||
obj
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> skeleton heap-base) (the-as uint 96))
|
||||
|
||||
;; definition of type cspace
|
||||
(deftype cspace (structure)
|
||||
((parent cspace :offset-assert 0)
|
||||
(joint joint :offset-assert 4)
|
||||
(joint-num int16 :offset-assert 8)
|
||||
(geo basic :offset-assert 12)
|
||||
(bone bone :offset-assert 16)
|
||||
(param0 basic :offset-assert 20)
|
||||
(param1 basic :offset-assert 24)
|
||||
(param2 basic :offset-assert 28)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x20
|
||||
:flag-assert #xa00000020
|
||||
(:methods
|
||||
(dummy-9 () none 9)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type cspace
|
||||
(defmethod inspect cspace ((obj cspace))
|
||||
(format #t "[~8x] ~A~%" obj 'cspace)
|
||||
(format #t "~Tparent: #<cspace @ #x~X>~%" (-> obj parent))
|
||||
(format #t "~Tjoint: ~A~%" (-> obj joint))
|
||||
(format #t "~Tjoint-num: ~D~%" (-> obj joint-num))
|
||||
(format #t "~Tgeo: ~A~%" (-> obj geo))
|
||||
(format #t "~Tbone: #<bone @ #x~X>~%" (-> obj bone))
|
||||
(format #t "~Tparam0: ~A~%" (-> obj param0))
|
||||
(format #t "~Tparam1: ~A~%" (-> obj param1))
|
||||
(format #t "~Tparam2: ~A~%" (-> obj param2))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type cspace-array
|
||||
(deftype cspace-array (inline-array-class)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; definition for method 3 of type cspace-array
|
||||
(defmethod inspect cspace-array ((obj cspace-array))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tlength: ~D~%" (-> obj length))
|
||||
(format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
|
||||
(format #t "~Tdata[0] @ #x~X~%" (&-> obj data 4))
|
||||
obj
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> cspace-array heap-base) (the-as uint 32))
|
||||
|
||||
;; definition for method 2 of type cspace
|
||||
(defmethod print cspace ((obj cspace))
|
||||
(format #t "#<cspace ~S @ #x~X>" (if (-> obj joint)
|
||||
(-> obj joint name)
|
||||
"nojoint"
|
||||
)
|
||||
obj
|
||||
)
|
||||
obj
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-6 0))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ const std::unordered_set<std::string> g_object_files_to_decompile = {
|
||||
"dma-bucket", "dma-disasm", "pad", "gs", "display-h", "vector", "file-io", "loader-h",
|
||||
"texture-h", "level-h", "math-camera-h", /* math-camera, "font-h",*/ "decomp-h", "display",
|
||||
/* gap */
|
||||
"mspace-h", "drawable-h", "drawable-group-h",
|
||||
/* gap */
|
||||
"bounding-box",
|
||||
/* gap */
|
||||
"sync-info-h", "sync-info"};
|
||||
@@ -36,6 +38,8 @@ const std::vector<std::string> g_object_files_to_check_against_reference = {
|
||||
"dma-buffer", "dma-bucket", "dma-disasm", "pad", "gs", "display-h", "vector", "file-io",
|
||||
"loader-h", "texture-h", "level-h", "math-camera-h", /* math-camera, "font-h",*/ "decomp-h",
|
||||
"display",
|
||||
/* gap */
|
||||
"mspace-h", "drawable-h", "drawable-group-h",
|
||||
/* gap */ "bounding-box",
|
||||
/* gap */
|
||||
"sync-info-h", "sync-info"};
|
||||
@@ -454,6 +458,9 @@ TEST_F(OfflineDecompilation, Compile) {
|
||||
if (skip_files_in_compiling.find(file) != skip_files_in_compiling.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lg::info("Compiling {}...", file);
|
||||
|
||||
auto& obj_l = db->obj_files_by_name.at(file);
|
||||
ASSERT_EQ(obj_l.size(), 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user