mirror of
https://github.com/open-goal/jak-project
synced 2026-09-10 20:29:51 -04:00
move and cleanup pc debug code
This commit is contained in:
@@ -246,3 +246,12 @@
|
||||
(defmacro real-current-time ()
|
||||
`(-> *display* real-frame-counter)
|
||||
)
|
||||
|
||||
|
||||
;; debug stuff really
|
||||
(defmacro get-screen-x (frac)
|
||||
`(the int (* ,frac 512)))
|
||||
|
||||
(defmacro get-screen-y (frac)
|
||||
`(the int (* ,frac 224)))
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; This script creates a simple process that draws text demonstrating
|
||||
;; all of GOAL's color constants to the on-screen debug output.
|
||||
|
||||
;; Create somewhere for the handle to the process to live. See https://open-goal.github.io/docs/reference/process_and_state
|
||||
;; as well as kernel/gstate.gc
|
||||
(define *color-display-handle* (new 'static 'handle))
|
||||
(set! *color-display-handle* (the handle #f))
|
||||
|
||||
|
||||
(defun-debug start-display-text-colors ()
|
||||
"Spawn an onscreen string displaying all possible colors"
|
||||
(if (not (handle->process *color-display-handle*))
|
||||
(let ((disp-proc
|
||||
(process-spawn-function process :name 'display-proc
|
||||
(lambda :behavior process ()
|
||||
(stack-size-set! (-> self main-thread) 256)
|
||||
(loop
|
||||
;; These constants live in engine/gfx/font-h.gc
|
||||
(format *stdcon* "~0k~%~%
|
||||
~0L 0 default ~1L 1 white
|
||||
~2L 2 gray ~3L 3 orange-red
|
||||
~4L 4 bright-orange-red ~5L 5 bright-orange-red
|
||||
~6L 6 bright-green ~7L 7 dark-blue
|
||||
~8L 8 light-blue ~9L 9 dark-pink
|
||||
~10L10 lighter-blue ~11L11 dark-light-blue
|
||||
~12L12 dim-white ~13L13 dim-gray
|
||||
~14L14 orange-red-2 ~15L15 yellow-green
|
||||
~16L16 dark-green ~17L17 another-gray
|
||||
~18L18 dark-dark-green ~19L19 flat-dark-purple
|
||||
~20L20 flat-yellow ~21L21 blue-white
|
||||
~22L22 pad-back ~23L23 pad-shine
|
||||
~24L24 pad-square ~25L25 pad-circle
|
||||
~26L26 pad-triangle ~27L27 pad-x
|
||||
~28L28 lighter-lighter-blue ~29L29 yellow-orange
|
||||
~30L30 yellow-green-2 ~31L31 another-light-blue
|
||||
~32L32 light-yellow ~33L33 red-orange
|
||||
~34L34 another-orange-red~0L~%
|
||||
alternate names
|
||||
~3L3 red ~4L4 red2 ~5L5 yellow ~6L6 green ~7L7 blue
|
||||
~10L10 cyan ~33L33 red-reverse ~34L34 red-obverse~0L"
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
))
|
||||
(set! *color-display-handle* (ppointer->handle disp-proc))
|
||||
)
|
||||
;; else
|
||||
(format #t "Colors are already being displayed")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun-debug stop-display-text-colors ()
|
||||
"Kill the example text color display"
|
||||
(kill-by-name 'display-proc *active-pool*)
|
||||
)
|
||||
@@ -0,0 +1,52 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; This script creates a simple process that draws text demonstrating
|
||||
;; all of GOAL's color constants to the on-screen debug output.
|
||||
|
||||
;; Create somewhere for the handle to the process to live. See https://open-goal.github.io/docs/reference/process_and_state
|
||||
;; as well as kernel/gstate.gc
|
||||
(define *color-displays* (new 'global 'inline-array 'handle 1))
|
||||
|
||||
(defmacro get-color-display-handle ()
|
||||
`(-> *color-displays* 0))
|
||||
|
||||
(set! (get-color-display-handle) INVALID_HANDLE)
|
||||
|
||||
;; font-color is from font-h.gc
|
||||
(defun font-color->string ((val font-color))
|
||||
"return the name of the font-color"
|
||||
(enum->string font-color val)
|
||||
)
|
||||
|
||||
(defun draw-all-font-colors ()
|
||||
"draws all font color names onscreen"
|
||||
(with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf))
|
||||
(bucket-id debug-no-zbuf))
|
||||
(dotimes (i 48)
|
||||
(draw-string-xy (string-format "~2D ~S" i (font-color->string (the font-color i))) buf
|
||||
(+ 4 (* (get-screen-x 0.5) (mod i 2))) (+ 8 (* 8 (/ i 2))) (the font-color i) (font-flags shadow)))
|
||||
)
|
||||
)
|
||||
|
||||
(defun start-display-text-colors ()
|
||||
"Spawn an onscreen string displaying all possible colors"
|
||||
(if (handle->process (get-color-display-handle))
|
||||
(format #t "Colors are already being displayed")
|
||||
;; else
|
||||
(set! (get-color-display-handle)
|
||||
(ppointer->handle (process-spawn-function process :name 'display-proc
|
||||
(lambda :behavior process ()
|
||||
(loop
|
||||
(draw-all-font-colors)
|
||||
(suspend))
|
||||
)
|
||||
)))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun-debug stop-display-text-colors ()
|
||||
"Kill the example text color display"
|
||||
(kill-by-name 'display-proc *active-pool*)
|
||||
)
|
||||
+14
-25
@@ -8,11 +8,9 @@
|
||||
;; To run this:
|
||||
|
||||
#|
|
||||
(make-group "iso") ;; build the game
|
||||
(lt) ;; connect to the runtime
|
||||
(lg) ;; have the runtime load the game engine
|
||||
(test-play) ;; start the game loop
|
||||
(ml "goal_src/pc_debug/font-encode-test.gc") ;; build and load this file.
|
||||
(mi) ;; build the game
|
||||
(lt) ;; connect to the runtime
|
||||
(ml "goal_src/jak1/pc/util/font-encode-test.gc") ;; build and load this file.
|
||||
|#
|
||||
|
||||
|
||||
@@ -30,8 +28,8 @@
|
||||
;;;; functions
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define *font-string* (new 'global 'string 64 (the-as string #f)))
|
||||
(define *font-string-ex* "")
|
||||
(define *font-string* (new 'global 'string 64 (the string #f)))
|
||||
(define *font-string-ex* (the string #f))
|
||||
(define *font-string-val* #x96)
|
||||
|
||||
(defun-debug font-encode-test-start ()
|
||||
@@ -40,9 +38,6 @@
|
||||
(unless (process-by-name 'font-encode *active-pool*)
|
||||
(process-spawn-function process :name 'font-encode
|
||||
(lambda :behavior process ()
|
||||
|
||||
(stack-size-set! (-> self main-thread) 768)
|
||||
|
||||
(let ((fnt (new 'stack 'font-context *font-default-matrix* FONT_ENCODE_TEXT_LEFT FONT_ENCODE_TEXT_Y 0.0
|
||||
(font-color orange-red) (font-flags shadow kerning large middle)))
|
||||
)
|
||||
@@ -54,27 +49,20 @@
|
||||
(suspend)
|
||||
|
||||
(if (or (cpad-pressed? 0 left) (cpad-hold? 0 l1))
|
||||
(-! *font-string-val* 1)
|
||||
)
|
||||
(-! *font-string-val* 1))
|
||||
(if (or (cpad-pressed? 0 right) (cpad-hold? 0 r1))
|
||||
(+! *font-string-val* 1)
|
||||
)
|
||||
(if (< *font-string-val* 1)
|
||||
(set! *font-string-val* 1)
|
||||
)
|
||||
(if (> *font-string-val* #x1ff)
|
||||
(set! *font-string-val* #x1ff)
|
||||
)
|
||||
(+! *font-string-val* 1))
|
||||
(minmax! *font-string-val* 1 #x1ff)
|
||||
|
||||
(clear *font-string*)
|
||||
(cond
|
||||
((>= *font-string-val* #x100)
|
||||
(set! (-> *font-string* data 0) (/ *font-string-val* 256))
|
||||
(set! (-> *font-string* data 1) (mod *font-string-val* 256))
|
||||
(set! (-> *font-string* data 1) (logand *font-string-val* #xff))
|
||||
(set! (-> *font-string* data 2) 0)
|
||||
)
|
||||
(else
|
||||
(set! (-> *font-string* data 0) (mod *font-string-val* 256))
|
||||
(set! (-> *font-string* data 0) (logand *font-string-val* #xff))
|
||||
(set! (-> *font-string* data 1) 0)
|
||||
)
|
||||
)
|
||||
@@ -82,11 +70,12 @@
|
||||
(set-origin! fnt FONT_ENCODE_TEXT_LEFT FONT_ENCODE_TEXT_Y)
|
||||
(set-flags! fnt (font-flags shadow kerning large middle))
|
||||
(print-game-text *font-string* fnt #f 128 24)
|
||||
(set-origin! fnt FONT_ENCODE_TEXT_LEFT (+ FONT_ENCODE_TEXT_Y 32))
|
||||
(print-game-text *font-string-ex* fnt #f 128 24)
|
||||
(when *font-string-ex*
|
||||
(set-origin! fnt FONT_ENCODE_TEXT_LEFT (+ FONT_ENCODE_TEXT_Y 32))
|
||||
(print-game-text *font-string-ex* fnt #f 128 24))
|
||||
(set-origin! fnt FONT_ENCODE_TEXT_LEFT (- FONT_ENCODE_TEXT_Y 16))
|
||||
(set-flags! fnt (font-flags shadow kerning middle))
|
||||
(print-game-text (string-format "#x~X" *font-string-val*) fnt #f 128 12)
|
||||
(print-game-text (string-format "#x~x" *font-string-val*) fnt #f 128 12)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
;; To run this:
|
||||
|
||||
#|
|
||||
(make-group "iso") ;; build the game
|
||||
(lt) ;; connect to the runtime
|
||||
(lg) ;; have the runtime load the game engine
|
||||
(test-play) ;; start the game loop
|
||||
(ml "goal_src/pc_debug/pc-pad-utils.gc") ;; build and load this file.
|
||||
(mi) ;; build the game
|
||||
(lt) ;; connect to the runtime
|
||||
(ml "goal_src/jak1/pc/util/pc-pad-utils.gc") ;; build and load this file.
|
||||
|#
|
||||
|
||||
|
||||
@@ -30,12 +28,12 @@
|
||||
)
|
||||
|
||||
(define *pc-pad-proc-list* (new 'static 'pc-pad-proc-list))
|
||||
(set! (-> *pc-pad-proc-list* show) (the handle #f))
|
||||
(set! (-> *pc-pad-proc-list* input) (the handle #f))
|
||||
(set! (-> *pc-pad-proc-list* show) INVALID_HANDLE)
|
||||
(set! (-> *pc-pad-proc-list* input) INVALID_HANDLE)
|
||||
|
||||
;; a pc pad process
|
||||
(deftype pc-pad-proc (process)
|
||||
((state-time int64)
|
||||
((state-time time-frame)
|
||||
(input-index uint64)
|
||||
(pad-idx int64)
|
||||
)
|
||||
Reference in New Issue
Block a user