mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
Decomp assert and debug-h (#282)
* [assert-h] decomp * [assert] decomp * Update assert.gc * [debug-h] decomp * oops
This commit is contained in:
parent
f6a6b4c107
commit
9d84ba8ca4
|
@ -8288,7 +8288,12 @@
|
|||
)
|
||||
)
|
||||
|
||||
;; debug-h
|
||||
|
||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; DEBUG-H ;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||
(deftype pos-history (structure)
|
||||
((points uint32 :offset-assert 0)
|
||||
(num-points int32 :offset-assert 4)
|
||||
|
@ -8300,7 +8305,6 @@
|
|||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; debug-h
|
||||
(deftype debug-vertex (structure)
|
||||
((trans vector4w :inline :offset-assert 0)
|
||||
(normal vector3h :inline :offset-assert 16)
|
||||
|
@ -8312,16 +8316,16 @@
|
|||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
; ;; debug-h
|
||||
; (deftype debug-vertex-stats (basic)
|
||||
; ((length int32 :offset-assert 4)
|
||||
; (pos-count int32 :offset-assert 8)
|
||||
; (vertex UNKNOWN 600 :offset-assert 16)
|
||||
; )
|
||||
; :method-count-assert 9
|
||||
; :size-assert #x4b10
|
||||
; :flag-assert #x900004b10
|
||||
; )
|
||||
(deftype debug-vertex-stats (basic)
|
||||
((length int32 :offset-assert 4)
|
||||
(pos-count int32 :offset-assert 8)
|
||||
(vertex debug-vertex 600 :inline :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4b10
|
||||
:flag-assert #x900004b10
|
||||
;; inspect method is overriden in debug.gc
|
||||
)
|
||||
|
||||
;; joint-mod-h
|
||||
(deftype joint-mod (basic)
|
||||
|
@ -11453,9 +11457,14 @@
|
|||
;; inherited inspect of process
|
||||
)
|
||||
|
||||
;; assert-h
|
||||
|
||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; ASSERT-H ;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||
(deftype __assert-info-private-struct (structure)
|
||||
((filename basic :offset-assert 0)
|
||||
((filename string :offset-assert 0)
|
||||
(line-num uint16 :offset-assert 4)
|
||||
(column-num uint16 :offset-assert 6)
|
||||
)
|
||||
|
@ -11463,11 +11472,25 @@
|
|||
:size-assert #x8
|
||||
:flag-assert #xb00000008
|
||||
(:methods
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 () none 10)
|
||||
(set-private-assert-info (_type_ string uint16 uint16) int 9)
|
||||
(print-private-assert-info (_type_) int 10)
|
||||
)
|
||||
)
|
||||
|
||||
(define-extern *__private-assert-info* __assert-info-private-struct)
|
||||
|
||||
|
||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; ASSERT ;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||
(define-extern *run-time-assert-enable* symbol)
|
||||
(define-extern __assert (function symbol string int))
|
||||
(define-extern __assert-min-max-range-float (function float float float string string string int))
|
||||
(define-extern __assert-min-max-range-int (function int int int string string string int))
|
||||
(define-extern __assert-zero-lim-range-int (function int int string string int))
|
||||
|
||||
;; hud-h
|
||||
(deftype hud-icon (basic)
|
||||
((icon uint32 :offset-assert 4)
|
||||
|
@ -12419,15 +12442,6 @@
|
|||
:flag-assert #x90000000c
|
||||
)
|
||||
|
||||
; ;; debug
|
||||
; (deftype debug-vertex-stats (basic)
|
||||
; ()
|
||||
; :method-count-assert 9
|
||||
; :size-assert #x4b10
|
||||
; :flag-assert #x900004b10
|
||||
; ;; too many basic blocks
|
||||
; )
|
||||
|
||||
;; merc-blend-shape
|
||||
(deftype blerc-block-header (structure)
|
||||
((tag generic-merc-tag :inline :offset-assert 0)
|
||||
|
@ -33192,9 +33206,6 @@
|
|||
;;(define-extern oscillating-float object) ;; unknown type
|
||||
;;(define-extern smush-control object) ;; unknown type
|
||||
;;(define-extern trajectory object) ;; unknown type
|
||||
;;(define-extern debug-vertex-stats object) ;; unknown type
|
||||
;;(define-extern debug-vertex object) ;; unknown type
|
||||
;;(define-extern pos-history object) ;; unknown type
|
||||
;;(define-extern joint-mod-wheel object) ;; unknown type
|
||||
;;(define-extern joint-mod object) ;; unknown type
|
||||
;;(define-extern joint-mod-set-local object) ;; unknown type
|
||||
|
@ -33488,8 +33499,6 @@
|
|||
;;(define-extern *camera-smush-control* object) ;; unknown type
|
||||
;;(define-extern *external-cam-options* object) ;; unknown type
|
||||
;;(define-extern *external-cam-mode* object) ;; unknown type
|
||||
;;(define-extern __assert-info-private-struct object) ;; unknown type
|
||||
;;(define-extern *__private-assert-info* object) ;; unknown type
|
||||
(define-extern hud-icon type)
|
||||
(define-extern hud-particle type)
|
||||
;;(define-extern hud-parts object) ;; unknown type
|
||||
|
@ -35312,11 +35321,6 @@
|
|||
;;(define-extern target-look-around object) ;; unknown type
|
||||
;;(define-extern priority object) ;; unknown type
|
||||
(define-extern bottom-hud-hidden? function)
|
||||
(define-extern __assert-min-max-range-float function)
|
||||
(define-extern __assert-zero-lim-range-int function)
|
||||
(define-extern __assert function)
|
||||
;;(define-extern *run-time-assert-enable* object) ;; unknown type
|
||||
(define-extern __assert-min-max-range-int function)
|
||||
;;(define-extern launcher-active object) ;; unknown type
|
||||
(define-extern command-get-process function)
|
||||
(define-extern ja-anim-done? function)
|
||||
|
|
|
@ -468,6 +468,26 @@
|
|||
"(method 0 display)":{
|
||||
"args":["allocation", "type-to-make", "psm", "w", "h", "ztest", "zpsm"],
|
||||
"vars":{"gp-0":"obj"}
|
||||
},
|
||||
|
||||
"(method 9 __assert-info-private-struct)":{
|
||||
"args":["obj", "filename", "line-num", "column-num"]
|
||||
},
|
||||
|
||||
"__assert":{
|
||||
"args":["exp", "msg"]
|
||||
},
|
||||
|
||||
"__assert-min-max-range-float":{
|
||||
"args":["exp", "minimum", "maximum", "msg-exp", "msg-min", "msg-max"]
|
||||
},
|
||||
|
||||
"__assert-min-max-range-int":{
|
||||
"args":["exp", "minimum", "maximum", "msg-exp", "msg-min", "msg-max"]
|
||||
},
|
||||
|
||||
"__assert-zero-lim-range-int":{
|
||||
"args":["exp", "maximum", "msg-exp", "msg-max"]
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,3 +5,34 @@
|
|||
;; name in dgo: assert-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
|
||||
(deftype __assert-info-private-struct (structure)
|
||||
((filename string :offset-assert 0)
|
||||
(line-num uint16 :offset-assert 4)
|
||||
(column-num uint16 :offset-assert 6)
|
||||
)
|
||||
:method-count-assert 11
|
||||
:size-assert #x8
|
||||
:flag-assert #xb00000008
|
||||
(:methods
|
||||
(set-private-assert-info (_type_ string uint16 uint16) int 9)
|
||||
(print-private-assert-info (_type_) int 10)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defmethod set-private-assert-info __assert-info-private-struct ((obj __assert-info-private-struct)
|
||||
(filename string) (line-num uint16) (column-num uint16))
|
||||
(set! (-> obj filename) filename)
|
||||
(set! (-> obj line-num) line-num)
|
||||
(set! (-> obj column-num) column-num)
|
||||
0
|
||||
)
|
||||
|
||||
(defmethod print-private-assert-info __assert-info-private-struct ((obj __assert-info-private-struct))
|
||||
(format #t "file ~S.gc, line ~D, col ~D.~%" (-> obj filename) (-> obj line-num) (-> obj column-num))
|
||||
0
|
||||
)
|
||||
|
||||
(define *__private-assert-info* (new 'static '__assert-info-private-struct))
|
||||
|
||||
|
|
|
@ -5,3 +5,47 @@
|
|||
;; name in dgo: assert
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
|
||||
(define *run-time-assert-enable* #t) ;; where is this used?
|
||||
|
||||
(defun __assert ((exp symbol) (msg string))
|
||||
"Assert that exp is truthy, print assert information otherwise"
|
||||
(when (not exp)
|
||||
(format #t "(ASSERT ~S) FAILED in "
|
||||
msg)
|
||||
(print-private-assert-info *__private-assert-info*)
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
(defun __assert-min-max-range-float
|
||||
((exp float) (minimum float) (maximum float) (msg-exp string) (msg-min string) (msg-max string))
|
||||
"Assert that float exp is a larger value than minimum and smaller than maximum, print assert information otherwise"
|
||||
(when (or (< exp minimum) (< maximum exp))
|
||||
(format #t "(ASSERT_MIN_MAX_RANGE_FLOAT ~S ~S ~S) FAILED (values ~F ~F ~F) in "
|
||||
msg-exp msg-min msg-max exp minimum maximum)
|
||||
(print-private-assert-info *__private-assert-info*)
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
(defun __assert-min-max-range-int
|
||||
((exp int) (minimum int) (maximum int) (msg-exp string) (msg-min string) (msg-max string))
|
||||
"Assert that integer exp is a larger value than minimum and smaller than maximum, print assert information otherwise"
|
||||
(when (or (< exp minimum) (< maximum exp))
|
||||
(format #t "(ASSERT_MIN_MAX_RANGE_INT ~S ~S ~S) FAILED (values ~D ~D ~D) in "
|
||||
msg-exp msg-min msg-max exp minimum maximum)
|
||||
(print-private-assert-info *__private-assert-info*)
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
(defun __assert-zero-lim-range-int ((exp int) (maximum int) (msg-exp string) (msg-max string))
|
||||
"Assert that integer exp is a larger value than zero and smaller than maximum, print assert information otherwise"
|
||||
(when (or (< exp 0) (>= exp max))
|
||||
(format #t "(ASSERT_ZERO_LIM_RANGE_INT ~S ~S) FAILED (values ~D ~D) in "
|
||||
msg-exp msg-max exp maximum)
|
||||
(print-private-assert-info *__private-assert-info*)
|
||||
)
|
||||
0
|
||||
)
|
||||
|
|
|
@ -5,3 +5,39 @@
|
|||
;; name in dgo: debug-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
|
||||
(deftype pos-history (structure)
|
||||
((points uint32 :offset-assert 0)
|
||||
(num-points int32 :offset-assert 4)
|
||||
(h-first int32 :offset-assert 8)
|
||||
(h-last int32 :offset-assert 12)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype debug-vertex (structure)
|
||||
((trans vector4w :inline :offset-assert 0)
|
||||
(normal vector3h :inline :offset-assert 16)
|
||||
(st vector2h :inline :offset-assert 22)
|
||||
(color uint32 :offset-assert 28)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
|
||||
(deftype debug-vertex-stats (basic)
|
||||
((length int32 :offset-assert 4)
|
||||
(pos-count int32 :offset-assert 8)
|
||||
(vertex debug-vertex 600 :inline :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4b10
|
||||
:flag-assert #x900004b10
|
||||
;; inspect method is overriden in debug.gc
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue