mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
45 lines
1.2 KiB
Common Lisp
45 lines
1.2 KiB
Common Lisp
|
|
(start-test "game-text")
|
|
|
|
(defun hack-load ()
|
|
;(declare (inline))
|
|
(str-load "0TEST.TXT"
|
|
-1
|
|
(the pointer (align64 (-> *common-text-heap* current)))
|
|
; note, this max size is probably wrong because of the alignment.
|
|
(the int (&- (-> *common-text-heap* top) (-> *common-text-heap* current)))
|
|
)
|
|
|
|
|
|
(sync *load-str-rpc* '#t)
|
|
|
|
(let* ((got-length (new 'stack-no-clear 'array 'int32 1))
|
|
(status (str-load-status got-length)))
|
|
;(format #t "Status is ~A, length ~D~%" status (-> got-length))
|
|
|
|
;; failed!
|
|
(if (!= status 'complete)
|
|
(return-from #f #f)
|
|
)
|
|
|
|
(link (the pointer (align64 (-> *common-text-heap* current)))
|
|
(-> "test" data)
|
|
(-> got-length)
|
|
*common-text-heap*
|
|
0
|
|
)
|
|
)
|
|
|
|
)
|
|
|
|
(let ((text (the game-text-info (hack-load))))
|
|
(format 0 "~I~%" text)
|
|
(expect-true (= #x123 (-> text data 0 id)))
|
|
(expect-true (= #x456 (-> text data 1 id)))
|
|
(expect-true (= #\e (-> text data 1 text data 1)))
|
|
(expect-true (= 5 (-> text data 1 text allocated-length)))
|
|
(expect-true (= 5 (length (-> text data 1 text))))
|
|
)
|
|
|
|
(finish-test)
|